card-mod-prosemirror_editor 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/db/migrate_core_cards/20160804112548_add_prosemirror_cards.rb +30 -0
- data/lib/javascript/script_prosemirror.js +13243 -0
- data/lib/javascript/script_prosemirror_config.js.coffee +31 -0
- data/lib/stylesheets/style_prosemirror.scss +298 -0
- data/set/all/prosemirror_editor.rb +8 -0
- data/set/self/script_prosemirror.rb +4 -0
- data/set/self/script_prosemirror_config.rb +5 -0
- data/set/self/style_prosemirror.rb +3 -0
- metadata +69 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
decko.addEditor(
|
2
|
+
'.prosemirror-editor',
|
3
|
+
->
|
4
|
+
decko.initProseMirror @[0].id,
|
5
|
+
->
|
6
|
+
prosemirrorContent @[0].id
|
7
|
+
)
|
8
|
+
|
9
|
+
$.extend decko,
|
10
|
+
setProseMirrorConfig: (string) ->
|
11
|
+
setter = ->
|
12
|
+
try
|
13
|
+
$.parseJSON string
|
14
|
+
catch
|
15
|
+
{}
|
16
|
+
decko.proseMirrorConfig = setter()
|
17
|
+
|
18
|
+
initProseMirror: (el_id) ->
|
19
|
+
conf = {
|
20
|
+
menuBar: true,
|
21
|
+
tooltipMenu: false
|
22
|
+
}
|
23
|
+
hard_conf = { docFormat: "html" }
|
24
|
+
user_conf = if decko.proseMirrorConfig? then decko.proseMirrorConfig else {}
|
25
|
+
$.extend conf, user_conf, hard_conf
|
26
|
+
createProseMirror(el_id, conf)
|
27
|
+
|
28
|
+
prosemirrorContent = (id) ->
|
29
|
+
content = getProseMirrorContent(id)
|
30
|
+
return '' if content == '<p></p>'
|
31
|
+
content
|
@@ -0,0 +1,298 @@
|
|
1
|
+
/*-- ProseMirror color variables */
|
2
|
+
|
3
|
+
$pm-yellow-1: #cc7;
|
4
|
+
$pm-yellow-2: #ffc;
|
5
|
+
$pm-grey-1: $gray-200;
|
6
|
+
$pm-grey-2: $gray-300;
|
7
|
+
$pm-grey-3: $gray-400;
|
8
|
+
$pm-grey-5: $gray-600;
|
9
|
+
$pm-cyan: $cyan;
|
10
|
+
|
11
|
+
.ProseMirror {
|
12
|
+
position: relative;
|
13
|
+
}
|
14
|
+
|
15
|
+
.ProseMirror {
|
16
|
+
white-space: pre-wrap;
|
17
|
+
}
|
18
|
+
|
19
|
+
.ProseMirror ul, .ProseMirror ol {
|
20
|
+
padding-left: 30px;
|
21
|
+
cursor: default;
|
22
|
+
}
|
23
|
+
|
24
|
+
.ProseMirror blockquote {
|
25
|
+
padding-left: 1em;
|
26
|
+
border-left: 3px solid $gray-300;
|
27
|
+
margin-left: 0; margin-right: 0;
|
28
|
+
}
|
29
|
+
|
30
|
+
.ProseMirror pre {
|
31
|
+
white-space: pre-wrap;
|
32
|
+
}
|
33
|
+
|
34
|
+
.ProseMirror li {
|
35
|
+
position: relative;
|
36
|
+
pointer-events: none; /* Don't do weird stuff with marker clicks */
|
37
|
+
}
|
38
|
+
.ProseMirror li > * {
|
39
|
+
pointer-events: auto;
|
40
|
+
}
|
41
|
+
|
42
|
+
.ProseMirror-nodeselection *::selection, .ProseMirror-widget *::selection { background: transparent; }
|
43
|
+
.ProseMirror-nodeselection *::-moz-selection, .ProseMirror-widget *::-moz-selection { background: transparent; }
|
44
|
+
|
45
|
+
.ProseMirror-selectednode {
|
46
|
+
outline: 2px solid $pm-cyan;
|
47
|
+
}
|
48
|
+
|
49
|
+
/* Make sure li selections wrap around markers */
|
50
|
+
|
51
|
+
li.ProseMirror-selectednode {
|
52
|
+
outline: none;
|
53
|
+
}
|
54
|
+
|
55
|
+
li.ProseMirror-selectednode:after {
|
56
|
+
content: "";
|
57
|
+
position: absolute;
|
58
|
+
left: -32px;
|
59
|
+
right: -2px; top: -2px; bottom: -2px;
|
60
|
+
border: 2px solid $pm-cyan;
|
61
|
+
pointer-events: none;
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
.ProseMirror-textblock-dropdown {
|
66
|
+
min-width: 3em;
|
67
|
+
}
|
68
|
+
|
69
|
+
.ProseMirror-menu {
|
70
|
+
margin: 0 -4px;
|
71
|
+
line-height: 1;
|
72
|
+
}
|
73
|
+
|
74
|
+
.ProseMirror-tooltip .ProseMirror-menu {
|
75
|
+
width: -webkit-fit-content;
|
76
|
+
width: fit-content;
|
77
|
+
white-space: pre;
|
78
|
+
}
|
79
|
+
|
80
|
+
.ProseMirror-menuitem {
|
81
|
+
margin-right: 3px;
|
82
|
+
display: inline-block;
|
83
|
+
}
|
84
|
+
|
85
|
+
.ProseMirror-menuseparator {
|
86
|
+
border-right: 1px solid $pm-grey-3;
|
87
|
+
margin-right: 3px;
|
88
|
+
}
|
89
|
+
|
90
|
+
.ProseMirror-menu-dropdown, .ProseMirror-menu-dropdown-menu {
|
91
|
+
font-size: 90%;
|
92
|
+
white-space: nowrap;
|
93
|
+
}
|
94
|
+
|
95
|
+
.ProseMirror-menu-dropdown {
|
96
|
+
vertical-align: 1px;
|
97
|
+
cursor: pointer;
|
98
|
+
}
|
99
|
+
|
100
|
+
.ProseMirror-menu-dropdown-wrap {
|
101
|
+
padding: 1px 14px 1px 4px;
|
102
|
+
display: inline-block;
|
103
|
+
position: relative;
|
104
|
+
}
|
105
|
+
|
106
|
+
.ProseMirror-menu-dropdown:after {
|
107
|
+
content: "";
|
108
|
+
border-left: 4px solid transparent;
|
109
|
+
border-right: 4px solid transparent;
|
110
|
+
border-top: 4px solid currentColor;
|
111
|
+
opacity: .6;
|
112
|
+
position: absolute;
|
113
|
+
right: 2px;
|
114
|
+
top: calc(50% - 2px);
|
115
|
+
}
|
116
|
+
|
117
|
+
.ProseMirror-menu-dropdown-menu, .ProseMirror-menu-submenu {
|
118
|
+
position: absolute;
|
119
|
+
background: white;
|
120
|
+
color: $pm-grey-5;
|
121
|
+
border: 1px solid #aaa;
|
122
|
+
padding: 2px;
|
123
|
+
}
|
124
|
+
|
125
|
+
.ProseMirror-menu-dropdown-menu {
|
126
|
+
z-index: 15;
|
127
|
+
min-width: 6em;
|
128
|
+
}
|
129
|
+
|
130
|
+
.ProseMirror-menu-dropdown-item {
|
131
|
+
cursor: pointer;
|
132
|
+
padding: 2px 8px 2px 4px;
|
133
|
+
}
|
134
|
+
|
135
|
+
.ProseMirror-menu-dropdown-item:hover {
|
136
|
+
background: $pm-grey-1;
|
137
|
+
}
|
138
|
+
|
139
|
+
.ProseMirror-menu-submenu-wrap {
|
140
|
+
position: relative;
|
141
|
+
margin-right: -4px;
|
142
|
+
}
|
143
|
+
|
144
|
+
.ProseMirror-menu-submenu-label:after {
|
145
|
+
content: "";
|
146
|
+
border-top: 4px solid transparent;
|
147
|
+
border-bottom: 4px solid transparent;
|
148
|
+
border-left: 4px solid currentColor;
|
149
|
+
opacity: .6;
|
150
|
+
position: absolute;
|
151
|
+
right: 4px;
|
152
|
+
top: calc(50% - 4px);
|
153
|
+
}
|
154
|
+
|
155
|
+
.ProseMirror-menu-submenu {
|
156
|
+
display: none;
|
157
|
+
min-width: 4em;
|
158
|
+
left: 100%;
|
159
|
+
top: -3px;
|
160
|
+
}
|
161
|
+
|
162
|
+
.ProseMirror-menu-active {
|
163
|
+
background: $pm-grey-2;
|
164
|
+
border-radius: 4px;
|
165
|
+
}
|
166
|
+
|
167
|
+
.ProseMirror-menu-active {
|
168
|
+
background: $pm-grey-2;
|
169
|
+
border-radius: 4px;
|
170
|
+
}
|
171
|
+
|
172
|
+
.ProseMirror-menu-disabled {
|
173
|
+
opacity: .3;
|
174
|
+
}
|
175
|
+
|
176
|
+
.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu, .ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu {
|
177
|
+
display: block;
|
178
|
+
}
|
179
|
+
|
180
|
+
.ProseMirror-menubar {
|
181
|
+
border-top-left-radius: inherit;
|
182
|
+
border-top-right-radius: inherit;
|
183
|
+
position: relative;
|
184
|
+
min-height: 1em;
|
185
|
+
color: $pm-grey-5;
|
186
|
+
padding: 1px 6px;
|
187
|
+
top: 0; left: 0; right: 0;
|
188
|
+
border-bottom: 1px solid silver;
|
189
|
+
background: white;
|
190
|
+
z-index: 10;
|
191
|
+
-moz-box-sizing: border-box;
|
192
|
+
box-sizing: border-box;
|
193
|
+
overflow: visible;
|
194
|
+
}
|
195
|
+
|
196
|
+
.ProseMirror-icon {
|
197
|
+
display: inline-block;
|
198
|
+
line-height: .8;
|
199
|
+
vertical-align: -2px; /* Compensate for padding */
|
200
|
+
padding: 2px 8px;
|
201
|
+
cursor: pointer;
|
202
|
+
}
|
203
|
+
|
204
|
+
.ProseMirror-icon svg {
|
205
|
+
fill: currentColor;
|
206
|
+
height: 1em;
|
207
|
+
}
|
208
|
+
|
209
|
+
.ProseMirror-icon span {
|
210
|
+
vertical-align: text-top;
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
/* Add space around the hr to make clicking it easier */
|
216
|
+
|
217
|
+
.ProseMirror-example-setup-style hr {
|
218
|
+
position: relative;
|
219
|
+
height: 6px;
|
220
|
+
border: none;
|
221
|
+
}
|
222
|
+
|
223
|
+
.ProseMirror-example-setup-style hr:after {
|
224
|
+
content: "";
|
225
|
+
position: absolute;
|
226
|
+
left: 10px;
|
227
|
+
right: 10px;
|
228
|
+
top: 2px;
|
229
|
+
border-top: 2px solid silver;
|
230
|
+
}
|
231
|
+
|
232
|
+
.ProseMirror-example-setup-style img {
|
233
|
+
cursor: default;
|
234
|
+
}
|
235
|
+
|
236
|
+
.ProseMirror-example-setup-style table {
|
237
|
+
border-collapse: collapse;
|
238
|
+
}
|
239
|
+
|
240
|
+
.ProseMirror-example-setup-style td {
|
241
|
+
vertical-align: top;
|
242
|
+
border: 1px solid $pm-grey-3;
|
243
|
+
padding: 3px 5px;
|
244
|
+
}
|
245
|
+
|
246
|
+
.ProseMirror-prompt {
|
247
|
+
background: white;
|
248
|
+
padding: 5px 10px 5px 15px;
|
249
|
+
border: 1px solid silver;
|
250
|
+
position: fixed;
|
251
|
+
border-radius: 3px;
|
252
|
+
z-index: 11;
|
253
|
+
box-shadow: -.5px 2px 5px rgba(0, 0, 0, .2);
|
254
|
+
}
|
255
|
+
|
256
|
+
.ProseMirror-prompt h5 {
|
257
|
+
margin: 0;
|
258
|
+
font-weight: normal;
|
259
|
+
font-size: 100%;
|
260
|
+
color: #444;
|
261
|
+
}
|
262
|
+
|
263
|
+
.ProseMirror-prompt input[type="text"],
|
264
|
+
.ProseMirror-prompt textarea {
|
265
|
+
background: $pm-grey-2;
|
266
|
+
border: none;
|
267
|
+
outline: none;
|
268
|
+
}
|
269
|
+
|
270
|
+
.ProseMirror-prompt input[type="text"] {
|
271
|
+
padding: 0 4px;
|
272
|
+
}
|
273
|
+
|
274
|
+
.ProseMirror-prompt-close {
|
275
|
+
position: absolute;
|
276
|
+
left: 2px; top: 1px;
|
277
|
+
color: $pm-grey-5;
|
278
|
+
border: none; background: transparent; padding: 0;
|
279
|
+
}
|
280
|
+
|
281
|
+
.ProseMirror-prompt-close:after {
|
282
|
+
content: "✕";
|
283
|
+
font-size: 12px;
|
284
|
+
}
|
285
|
+
|
286
|
+
.ProseMirror-invalid {
|
287
|
+
background: $pm-yellow-2;
|
288
|
+
border: 1px solid $pm-yellow-1;
|
289
|
+
border-radius: 4px;
|
290
|
+
padding: 5px 10px;
|
291
|
+
position: absolute;
|
292
|
+
min-width: 10em;
|
293
|
+
}
|
294
|
+
|
295
|
+
.ProseMirror-prompt-buttons {
|
296
|
+
margin-top: 5px;
|
297
|
+
display: none;
|
298
|
+
}
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: card-mod-prosemirror_editor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ethan McCutchen
|
8
|
+
- Philipp Kühl
|
9
|
+
- Gerry Gleason
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: card-mod-edit
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0.1'
|
29
|
+
description: ''
|
30
|
+
email:
|
31
|
+
- info@decko.org
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- db/migrate_core_cards/20160804112548_add_prosemirror_cards.rb
|
37
|
+
- lib/javascript/script_prosemirror.js
|
38
|
+
- lib/javascript/script_prosemirror_config.js.coffee
|
39
|
+
- lib/stylesheets/style_prosemirror.scss
|
40
|
+
- set/all/prosemirror_editor.rb
|
41
|
+
- set/self/script_prosemirror.rb
|
42
|
+
- set/self/script_prosemirror_config.rb
|
43
|
+
- set/self/style_prosemirror.rb
|
44
|
+
homepage: http://decko.org
|
45
|
+
licenses:
|
46
|
+
- GPL-2.0
|
47
|
+
- GPL-3.0
|
48
|
+
metadata:
|
49
|
+
card-mod: prosemirror_editor
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 2.3.0
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubygems_version: 3.0.3
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: Calendar editor
|
69
|
+
test_files: []
|