card-mod-prosemirror_editor 0.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
+ }
@@ -1,11 +1,5 @@
1
- basket[:list_input_options] << "prosemirror editor"
2
- basket[:script_calls]["setProseMirrorConfig"] = :prosemirror_config
3
1
 
4
2
  format :html do
5
- def prosemirror_config
6
- Card::Rule.global_setting :prose_mirror
7
- end
8
-
9
3
  def prosemirror_editor_input
10
4
  wrap_with :div, id: unique_id, class: "prosemirror-editor" do
11
5
  hidden_field :content, class: "d0-card-content", value: card.content
@@ -0,0 +1,4 @@
1
+ include_set Abstract::CodeFile
2
+
3
+ Self::ScriptMods.add_item :script_prosemirror
4
+ Self::InputOptions.add_to_basket :options, "prosemirror editor"
@@ -0,0 +1,5 @@
1
+ include_set Abstract::CodeFile
2
+
3
+ Self::ScriptEditors.add_item :script_prosemirror_config
4
+ All::Head::HtmlFormat.add_to_basket :mod_js_config,
5
+ [:prose_mirror, "setProseMirrorConfig"]
@@ -0,0 +1,3 @@
1
+ include_set Abstract::CodeFile
2
+
3
+ Self::StyleMods.add_item :style_prosemirror
metadata CHANGED
@@ -1,44 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-prosemirror_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
- - Philipp Kühl
8
7
  - Ethan McCutchen
8
+ - Philipp Kühl
9
+ - Gerry Gleason
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2023-10-17 00:00:00.000000000 Z
13
+ date: 2020-12-24 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: card
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
- - - ">="
19
+ - - '='
19
20
  - !ruby/object:Gem::Version
20
- version: '0'
21
+ version: 1.101.0
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - ">="
26
+ - - '='
26
27
  - !ruby/object:Gem::Version
27
- version: '0'
28
+ version: 1.101.0
28
29
  - !ruby/object:Gem::Dependency
29
30
  name: card-mod-edit
30
31
  requirement: !ruby/object:Gem::Requirement
31
32
  requirements:
32
- - - ">="
33
+ - - '='
33
34
  - !ruby/object:Gem::Version
34
- version: '0'
35
+ version: 0.11.0
35
36
  type: :runtime
36
37
  prerelease: false
37
38
  version_requirements: !ruby/object:Gem::Requirement
38
39
  requirements:
39
- - - ">="
40
+ - - '='
40
41
  - !ruby/object:Gem::Version
41
- version: '0'
42
+ version: 0.11.0
42
43
  description: ''
43
44
  email:
44
45
  - info@decko.org
@@ -46,10 +47,14 @@ executables: []
46
47
  extensions: []
47
48
  extra_rdoc_files: []
48
49
  files:
49
- - LICENSE
50
- - README.md
50
+ - db/migrate_core_cards/20160804112548_add_prosemirror_cards.rb
51
+ - lib/javascript/script_prosemirror.js
52
+ - lib/javascript/script_prosemirror_config.js.coffee
53
+ - lib/stylesheets/style_prosemirror.scss
51
54
  - set/all/prosemirror_editor.rb
52
- - set/self/prose_mirror.rb
55
+ - set/self/script_prosemirror.rb
56
+ - set/self/script_prosemirror_config.rb
57
+ - set/self/style_prosemirror.rb
53
58
  homepage: http://decko.org
54
59
  licenses:
55
60
  - GPL-3.0
@@ -70,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
75
  - !ruby/object:Gem::Version
71
76
  version: '0'
72
77
  requirements: []
73
- rubygems_version: 3.4.10
78
+ rubygems_version: 3.0.3
74
79
  signing_key:
75
80
  specification_version: 4
76
81
  summary: Prose Mirror editor