@themarioga/grid-editor 6.0.0-beta.5 → 7.0.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.
- package/AUTO_SAVE.md +2 -2
- package/BUILDING.md +45 -29
- package/CHANGELOG.md +54 -0
- package/README.md +140 -89
- package/UPGRADING.md +146 -2
- package/dist/grideditor.bundle.min.js +14 -0
- package/dist/grideditor.d.ts +335 -0
- package/dist/grideditor.esm.js +3977 -0
- package/dist/grideditor.jquery.js +253 -0
- package/dist/grideditor.jquery.min.js +1 -0
- package/dist/grideditor.jquery.min.js.map +7 -0
- package/dist/grideditor.js +3983 -0
- package/dist/grideditor.min.js +6 -0
- package/dist/grideditor.min.js.map +7 -0
- package/dist/locales/grideditor.es.esm.js +158 -0
- package/dist/locales/grideditor.es.js +164 -170
- package/dist/locales/grideditor.es.min.js +6 -2
- package/dist/locales/grideditor.es.min.js.map +7 -1
- package/dist/plugins/grideditor.accordion.esm.js +294 -0
- package/dist/plugins/grideditor.accordion.js +286 -180
- package/dist/plugins/grideditor.accordion.min.js +1 -2
- package/dist/plugins/grideditor.accordion.min.js.map +7 -1
- package/dist/plugins/grideditor.alignment.esm.js +55 -0
- package/dist/plugins/grideditor.alignment.js +58 -77
- package/dist/plugins/grideditor.alignment.min.js +1 -2
- package/dist/plugins/grideditor.alignment.min.js.map +7 -1
- package/dist/plugins/grideditor.card.esm.js +73 -0
- package/dist/plugins/grideditor.card.js +74 -64
- package/dist/plugins/grideditor.card.min.js +1 -2
- package/dist/plugins/grideditor.card.min.js.map +7 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +500 -0
- package/dist/plugins/grideditor.ckeditor.js +482 -493
- package/dist/plugins/grideditor.ckeditor.min.js +1 -2
- package/dist/plugins/grideditor.ckeditor.min.js.map +7 -1
- package/dist/plugins/grideditor.clipboard.esm.js +326 -0
- package/dist/plugins/grideditor.clipboard.js +298 -235
- package/dist/plugins/grideditor.clipboard.min.js +1 -2
- package/dist/plugins/grideditor.clipboard.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror-inline.esm.js +205 -0
- package/dist/plugins/grideditor.codemirror-inline.js +188 -168
- package/dist/plugins/grideditor.codemirror-inline.min.js +1 -2
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror.esm.js +63 -0
- package/dist/plugins/grideditor.codemirror.js +60 -71
- package/dist/plugins/grideditor.codemirror.min.js +1 -2
- package/dist/plugins/grideditor.codemirror.min.js.map +7 -1
- package/dist/plugins/grideditor.elements.esm.js +271 -0
- package/dist/plugins/grideditor.elements.js +256 -149
- package/dist/plugins/grideditor.elements.min.js +1 -2
- package/dist/plugins/grideditor.elements.min.js.map +7 -1
- package/dist/plugins/grideditor.float.esm.js +34 -0
- package/dist/plugins/grideditor.float.js +37 -52
- package/dist/plugins/grideditor.float.min.js +1 -2
- package/dist/plugins/grideditor.float.min.js.map +7 -1
- package/dist/plugins/grideditor.gutters.esm.js +143 -0
- package/dist/plugins/grideditor.gutters.js +134 -131
- package/dist/plugins/grideditor.gutters.min.js +1 -2
- package/dist/plugins/grideditor.gutters.min.js.map +7 -1
- package/dist/plugins/grideditor.order.esm.js +189 -0
- package/dist/plugins/grideditor.order.js +170 -182
- package/dist/plugins/grideditor.order.min.js +1 -2
- package/dist/plugins/grideditor.order.min.js.map +7 -1
- package/dist/plugins/grideditor.popup.esm.js +187 -0
- package/dist/plugins/grideditor.popup.js +183 -134
- package/dist/plugins/grideditor.popup.min.js +1 -2
- package/dist/plugins/grideditor.popup.min.js.map +7 -1
- package/dist/plugins/grideditor.sections.esm.js +271 -0
- package/dist/plugins/grideditor.sections.js +250 -173
- package/dist/plugins/grideditor.sections.min.js +1 -2
- package/dist/plugins/grideditor.sections.min.js.map +7 -1
- package/dist/plugins/grideditor.spacing.esm.js +318 -0
- package/dist/plugins/grideditor.spacing.js +296 -272
- package/dist/plugins/grideditor.spacing.min.js +1 -2
- package/dist/plugins/grideditor.spacing.min.js.map +7 -1
- package/dist/plugins/grideditor.summernote.esm.js +509 -0
- package/dist/plugins/grideditor.summernote.js +491 -471
- package/dist/plugins/grideditor.summernote.min.js +1 -2
- package/dist/plugins/grideditor.summernote.min.js.map +7 -1
- package/dist/plugins/grideditor.tabs.esm.js +237 -0
- package/dist/plugins/grideditor.tabs.js +233 -139
- package/dist/plugins/grideditor.tabs.min.js +1 -2
- package/dist/plugins/grideditor.tabs.min.js.map +7 -1
- package/dist/plugins/grideditor.textalign.esm.js +40 -0
- package/dist/plugins/grideditor.textalign.js +43 -56
- package/dist/plugins/grideditor.textalign.min.js +1 -2
- package/dist/plugins/grideditor.textalign.min.js.map +7 -1
- package/dist/plugins/grideditor.tinymce.esm.js +519 -0
- package/dist/plugins/grideditor.tinymce.js +500 -534
- package/dist/plugins/grideditor.tinymce.min.js +1 -2
- package/dist/plugins/grideditor.tinymce.min.js.map +7 -1
- package/dist/plugins/grideditor.visibility.esm.js +158 -0
- package/dist/plugins/grideditor.visibility.js +140 -149
- package/dist/plugins/grideditor.visibility.min.js +1 -2
- package/dist/plugins/grideditor.visibility.min.js.map +7 -1
- package/docs/events.md +47 -21
- package/docs/locale-keys.md +7 -4
- package/docs/plugins.md +49 -27
- package/example/adapter.html +112 -0
- package/example/attributes.html +85 -61
- package/example/autocols.html +9 -9
- package/example/autosave.html +13 -14
- package/example/basic.html +4 -5
- package/example/breakpoints.html +5 -6
- package/example/ckeditor.html +4 -5
- package/example/clipboard.html +11 -10
- package/example/codemirror.html +9 -7
- package/example/containers.html +7 -8
- package/example/custom_editor.html +53 -34
- package/example/elements.html +10 -11
- package/example/index.html +16 -2
- package/example/locale.html +6 -7
- package/example/plugins.html +44 -29
- package/example/summernote.html +6 -5
- package/example/utilities.html +17 -13
- package/example/wrap_content.html +9 -9
- package/package.json +43 -12
- package/src/js/dom.js +401 -0
- package/src/js/grideditor.classic.js +16 -0
- package/src/js/grideditor.jquery.js +325 -0
- package/src/js/{jquery.grideditor.js → grideditor.js} +1284 -1124
- package/src/js/locales/grideditor.es.js +163 -158
- package/src/js/plugins/grideditor.accordion.js +97 -77
- package/src/js/plugins/grideditor.alignment.js +5 -7
- package/src/js/plugins/grideditor.card.js +23 -23
- package/src/js/plugins/grideditor.ckeditor.js +107 -106
- package/src/js/plugins/grideditor.clipboard.js +49 -37
- package/src/js/plugins/grideditor.codemirror-inline.js +50 -37
- package/src/js/plugins/grideditor.codemirror.js +9 -10
- package/src/js/plugins/grideditor.elements.js +57 -33
- package/src/js/plugins/grideditor.float.js +4 -6
- package/src/js/plugins/grideditor.gutters.js +20 -15
- package/src/js/plugins/grideditor.order.js +28 -25
- package/src/js/plugins/grideditor.popup.js +63 -51
- package/src/js/plugins/grideditor.sections.js +39 -32
- package/src/js/plugins/grideditor.spacing.js +42 -45
- package/src/js/plugins/grideditor.summernote.js +112 -76
- package/src/js/plugins/grideditor.tabs.js +65 -57
- package/src/js/plugins/grideditor.textalign.js +4 -6
- package/src/js/plugins/grideditor.tinymce.js +147 -139
- package/src/js/plugins/grideditor.visibility.js +24 -25
- package/src/js/register.js +18 -0
- package/src/js/text/grideditor.text.js +81 -106
- package/types/grideditor.d.ts +335 -0
- package/dist/jquery.grideditor.bundle.min.js +0 -10
- package/dist/jquery.grideditor.js +0 -4927
- package/dist/jquery.grideditor.min.js +0 -2
- package/dist/jquery.grideditor.min.js.map +0 -1
|
@@ -8,30 +8,36 @@
|
|
|
8
8
|
*
|
|
9
9
|
* It is a feature plugin, `text`, that the `plugins` setting does not choose
|
|
10
10
|
* (content_types does), and it is everything a text is to the editor: the
|
|
11
|
-
* text block's drawer, the Text buttons in the toolbar
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* text block's drawer, the Text buttons in the toolbar, createText, opening
|
|
12
|
+
* an editor on a click and closing it again with the host's attributes put
|
|
13
|
+
* back, and making the host's plain content a text through the core's
|
|
14
|
+
* `textTypes` hook.
|
|
15
15
|
*
|
|
16
|
-
* Each editor registers under
|
|
16
|
+
* Each editor registers under GridEditor.texts, which is this file's own
|
|
17
17
|
* registry and not a contract: an editor of a host's own is a feature plugin
|
|
18
18
|
* of its own, as example/custom_editor.html shows.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
import { GridEditor } from '../grideditor.js';
|
|
21
|
+
import * as dom from '../dom.js';
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
// However many editors a page loads, each with a copy of this file in its
|
|
24
|
+
// classic script: the first one installs it
|
|
25
|
+
if (!GridEditor.features.text) {
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
'tool.add_text': 'Add text',
|
|
26
|
-
'tool.add_text_type': 'Add {editor} text',
|
|
27
|
+
Object.assign(GridEditor.locales.en, {
|
|
27
28
|
'text.add': 'Text',
|
|
28
29
|
'text.add_type': 'Text ({editor})',
|
|
29
30
|
'panel.editor': 'Editor',
|
|
30
31
|
'panel.kind_text': 'Text',
|
|
31
32
|
});
|
|
32
33
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* What a content area's attributes were before its editor opened, and
|
|
36
|
+
* once it had: the two readings closeText plays the host's changes
|
|
37
|
+
* back from. Shared by every editor on the page, like the nodes.
|
|
38
|
+
*/
|
|
39
|
+
var readBefore = new WeakMap();
|
|
40
|
+
var readReady = new WeakMap();
|
|
35
41
|
|
|
36
42
|
/** What a text editor puts on a content area while it is open, whenever it likes. */
|
|
37
43
|
var EDITOR_CLASS = /^(mce-|cke|note-)|^(active|ge-rte-active)$/;
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
|
|
40
46
|
function attributesOf(element) {
|
|
41
47
|
var found = {};
|
|
42
|
-
|
|
48
|
+
Array.prototype.slice.call(element.attributes).forEach(function(attribute) {
|
|
43
49
|
found[attribute.name] = attribute.value;
|
|
44
50
|
});
|
|
45
51
|
return found;
|
|
@@ -53,9 +59,9 @@
|
|
|
53
59
|
|
|
54
60
|
/** The host's markup, with what changed from `ready` to `open` played back onto it. */
|
|
55
61
|
function restoreAttributes(block, before, ready, open) {
|
|
56
|
-
var result =
|
|
62
|
+
var result = Object.assign({}, before);
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
Object.keys(Object.assign({}, ready, open)).forEach(function(name) {
|
|
59
65
|
if (name === 'class' || EDITOR_ATTRIBUTE.test(name) || ready[name] === open[name]) { return; }
|
|
60
66
|
|
|
61
67
|
if (open[name] === undefined) {
|
|
@@ -78,8 +84,8 @@
|
|
|
78
84
|
// shuffle a node's attributes because it was edited
|
|
79
85
|
if (classes.length) { result['class'] = classes.join(' '); } else { delete result['class']; }
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
Object.keys(attributesOf(block)).forEach(function(name) { block.removeAttribute(name); });
|
|
88
|
+
Object.keys(result).forEach(function(name) { block.setAttribute(name, result[name]); });
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
function textFeature(ge) {
|
|
@@ -88,8 +94,8 @@
|
|
|
88
94
|
var TEXTS = {};
|
|
89
95
|
var warned = {};
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
TEXTS[type] =
|
|
97
|
+
Object.keys(GridEditor.texts).forEach(function(type) {
|
|
98
|
+
TEXTS[type] = GridEditor.texts[type](ge);
|
|
93
99
|
});
|
|
94
100
|
|
|
95
101
|
// Every editor loaded, in the order the page loaded them, unless the
|
|
@@ -112,16 +118,17 @@
|
|
|
112
118
|
/** A detached content area of `type`, holding `content` or the editor's initial content. */
|
|
113
119
|
function makeText(type, content) {
|
|
114
120
|
var text = TEXTS[type];
|
|
121
|
+
var block = dom.element('div', {
|
|
122
|
+
'class': 'ge-content ge-content-type-' + type,
|
|
123
|
+
'data-ge-content-type': type,
|
|
124
|
+
});
|
|
115
125
|
|
|
116
|
-
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/** A text block at the end of a column, through the add events. */
|
|
123
|
-
function addTextTo(col, type) {
|
|
124
|
-
return ge.place(makeText(type), 'text', { appendTo: col, source: 'tool' });
|
|
126
|
+
if (content && content.nodeType) {
|
|
127
|
+
block.appendChild(content);
|
|
128
|
+
} else {
|
|
129
|
+
dom.setHtml(block, content !== undefined ? content : (text && text.initialContent) || '');
|
|
130
|
+
}
|
|
131
|
+
return block;
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
/**
|
|
@@ -151,21 +158,20 @@
|
|
|
151
158
|
|
|
152
159
|
/** Whether a content area is a text of one of the editors loaded here. */
|
|
153
160
|
function isOurs(block) {
|
|
154
|
-
return !!TEXTS[block.
|
|
161
|
+
return !!TEXTS[block.getAttribute('data-ge-content-type')];
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
/** Open the editor on a text, once: until it is closed again. */
|
|
158
165
|
function startText(block) {
|
|
159
|
-
if (
|
|
166
|
+
if (dom.hasClass(block, 'ge-rte-active')) { return; }
|
|
160
167
|
|
|
161
168
|
// A content area nobody can see - a tab that is not the open one,
|
|
162
169
|
// a closed accordion item - has no geometry for an editor to lay
|
|
163
170
|
// its toolbar out against, and nothing anyone can type into
|
|
164
|
-
if (!
|
|
171
|
+
if (!dom.visible(block)) { return; }
|
|
165
172
|
|
|
166
|
-
// The attribute
|
|
167
|
-
|
|
168
|
-
var text = TEXTS[block.attr('data-ge-content-type')];
|
|
173
|
+
// The attribute: it is markup, and the drawer reads it the same way
|
|
174
|
+
var text = TEXTS[block.getAttribute('data-ge-content-type')];
|
|
169
175
|
if (!text) { return; }
|
|
170
176
|
|
|
171
177
|
// Not marked active, so the next click tries again: the library
|
|
@@ -175,13 +181,14 @@
|
|
|
175
181
|
return;
|
|
176
182
|
}
|
|
177
183
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
readBefore.set(block, attributesOf(block));
|
|
185
|
+
readReady.delete(block);
|
|
186
|
+
dom.addClass(block, 'ge-rte-active');
|
|
187
|
+
text.start([block]);
|
|
181
188
|
}
|
|
182
189
|
|
|
183
190
|
function onClick() {
|
|
184
|
-
startText(
|
|
191
|
+
startText(this);
|
|
185
192
|
}
|
|
186
193
|
|
|
187
194
|
/**
|
|
@@ -199,28 +206,30 @@
|
|
|
199
206
|
* is left out either way.
|
|
200
207
|
*/
|
|
201
208
|
function closeText(block) {
|
|
202
|
-
var text = TEXTS[block.
|
|
203
|
-
var before =
|
|
204
|
-
var open = before ? attributesOf(block
|
|
209
|
+
var text = TEXTS[block.getAttribute('data-ge-content-type')];
|
|
210
|
+
var before = readBefore.get(block);
|
|
211
|
+
var open = before ? attributesOf(block) : null;
|
|
205
212
|
|
|
206
213
|
// Every content area is told, as in 5.x: one whose editor never
|
|
207
214
|
// started is the plugin's to ignore
|
|
208
|
-
if (text) { text.stop(block); }
|
|
215
|
+
if (text) { text.stop([block]); }
|
|
209
216
|
|
|
210
217
|
// After stop, not before: an editor that restores the class
|
|
211
218
|
// attribute it snapshotted would put ge-rte-active back
|
|
212
|
-
|
|
219
|
+
dom.removeClass(block, 'ge-rte-active');
|
|
213
220
|
|
|
214
221
|
if (before) {
|
|
215
|
-
restoreAttributes(block, before,
|
|
216
|
-
|
|
222
|
+
restoreAttributes(block, before, readReady.get(block) || before, open);
|
|
223
|
+
readBefore.delete(block);
|
|
224
|
+
readReady.delete(block);
|
|
217
225
|
}
|
|
218
226
|
}
|
|
219
227
|
|
|
220
228
|
function createTextControls(textBlock) {
|
|
221
|
-
var block =
|
|
222
|
-
var type = block.
|
|
223
|
-
var drawer =
|
|
229
|
+
var block = dom.child(textBlock, '.ge-content');
|
|
230
|
+
var type = block.getAttribute('data-ge-content-type');
|
|
231
|
+
var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-text-drawer' });
|
|
232
|
+
textBlock.insertBefore(drawer, textBlock.firstChild);
|
|
224
233
|
|
|
225
234
|
ge.createMoveTool(drawer);
|
|
226
235
|
|
|
@@ -228,10 +237,11 @@
|
|
|
228
237
|
|
|
229
238
|
// Which editor edits it, first in its settings: something to
|
|
230
239
|
// know about it, not something to do with it
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
240
|
+
var general = dom.child(details, '.ge-details-general');
|
|
241
|
+
var editor = dom.element('div', { 'class': 'ge-field ge-text-editor' });
|
|
242
|
+
editor.appendChild(dom.element('span', { 'class': 'ge-field-label' }, ge.t('panel.editor')));
|
|
243
|
+
editor.appendChild(dom.element('span', { 'class': 'ge-field-value' }, textLabel(type)));
|
|
244
|
+
general.insertBefore(editor, general.firstChild);
|
|
235
245
|
|
|
236
246
|
settings.text_tools.forEach(function(hostTool) {
|
|
237
247
|
ge.createTool(drawer, hostTool.title || '', hostTool.className || '',
|
|
@@ -243,7 +253,7 @@
|
|
|
243
253
|
// Its editor lets go first: removed while open, it would
|
|
244
254
|
// be left behind, attached to nothing
|
|
245
255
|
closeText(block);
|
|
246
|
-
|
|
256
|
+
dom.slideUp(textBlock, function() {
|
|
247
257
|
textBlock.remove();
|
|
248
258
|
removed();
|
|
249
259
|
});
|
|
@@ -253,54 +263,18 @@
|
|
|
253
263
|
|
|
254
264
|
/** A drawer for each text of ours in a text block that has none yet. */
|
|
255
265
|
function markTexts() {
|
|
256
|
-
ge.canvas
|
|
257
|
-
|
|
258
|
-
if (textBlock.children('.ge-tools-drawer').length) { return; }
|
|
259
|
-
if (!isOurs(textBlock.children('.ge-content'))) { return; }
|
|
260
|
-
|
|
261
|
-
createTextControls(textBlock);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
266
|
+
dom.all(ge.canvas, '.ge-text-block').forEach(function(textBlock) {
|
|
267
|
+
if (dom.child(textBlock, '.ge-tools-drawer')) { return; }
|
|
264
268
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
* a text of the first editor offered, or, held, of the one chosen.
|
|
268
|
-
*/
|
|
269
|
-
function addTextTools() {
|
|
270
|
-
var texts = offeredTexts();
|
|
271
|
-
if (!texts.length) { return; }
|
|
272
|
-
|
|
273
|
-
ge.canvas.find('.column').each(function() {
|
|
274
|
-
var col = $(this);
|
|
275
|
-
var drawer = col.children('.ge-tools-drawer');
|
|
276
|
-
if (!drawer.length || drawer.children('.ge-add-text').length) { return; }
|
|
269
|
+
var block = dom.child(textBlock, '.ge-content');
|
|
270
|
+
if (!block || !isOurs(block)) { return; }
|
|
277
271
|
|
|
278
|
-
|
|
279
|
-
if (ge.closePicker()) { return; } // The picker was open: that was the answer
|
|
280
|
-
|
|
281
|
-
addTextTo(col, texts[0]);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
var tool = drawer.children('.ge-add-text');
|
|
285
|
-
var addRow = drawer.children('.ge-add-row');
|
|
286
|
-
if (addRow.length) { tool.insertBefore(addRow); }
|
|
287
|
-
|
|
288
|
-
if (texts.length > 1) {
|
|
289
|
-
ge.attachPicker(tool, function() {
|
|
290
|
-
ge.openPicker(tool, texts.map(function(type) {
|
|
291
|
-
return {
|
|
292
|
-
label: textLabel(type),
|
|
293
|
-
title: ge.t('tool.add_text_type', { editor: textLabel(type) }),
|
|
294
|
-
attributes: { 'data-ge-content-type': type },
|
|
295
|
-
choose: function() { addTextTo(col, type); },
|
|
296
|
-
};
|
|
297
|
-
}), 'ge-text-picker');
|
|
298
|
-
});
|
|
299
|
-
}
|
|
272
|
+
createTextControls(textBlock);
|
|
300
273
|
});
|
|
301
274
|
}
|
|
302
275
|
|
|
303
276
|
var texts = offeredTexts();
|
|
277
|
+
var clicks = null; // The delegated click listener, while editing
|
|
304
278
|
|
|
305
279
|
return {
|
|
306
280
|
methods: {
|
|
@@ -326,8 +300,8 @@
|
|
|
326
300
|
available: text.available ? function() { return text.available(); } : null,
|
|
327
301
|
missingKey: text.missingKey,
|
|
328
302
|
edit: function(block) {
|
|
329
|
-
var textBlock = block.
|
|
330
|
-
if (textBlock
|
|
303
|
+
var textBlock = block.parentElement;
|
|
304
|
+
if (dom.hasClass(textBlock, 'ge-text-block') && !dom.child(textBlock, '.ge-tools-drawer')) {
|
|
331
305
|
createTextControls(textBlock);
|
|
332
306
|
}
|
|
333
307
|
|
|
@@ -354,28 +328,29 @@
|
|
|
354
328
|
|
|
355
329
|
onInit: function() {
|
|
356
330
|
markTexts();
|
|
357
|
-
addTextTools();
|
|
358
331
|
|
|
359
|
-
ge.canvas.
|
|
332
|
+
if (clicks) { ge.canvas.removeEventListener('click', clicks); }
|
|
333
|
+
clicks = dom.delegate(ge.canvas, 'click', '.ge-content', onClick);
|
|
360
334
|
},
|
|
361
335
|
|
|
362
336
|
// While the drawers and the text blocks are still there, as the
|
|
363
337
|
// editors left them
|
|
364
338
|
onBeforeDeinit: function() {
|
|
365
|
-
ge.canvas
|
|
366
|
-
if (isOurs(
|
|
339
|
+
dom.all(ge.canvas, '.ge-content').forEach(function(block) {
|
|
340
|
+
if (isOurs(block)) { closeText(block); }
|
|
367
341
|
});
|
|
368
342
|
},
|
|
369
343
|
|
|
370
344
|
onDeinit: function() {
|
|
371
|
-
ge.canvas.
|
|
345
|
+
if (clicks) { ge.canvas.removeEventListener('click', clicks); }
|
|
346
|
+
clicks = null;
|
|
372
347
|
},
|
|
373
348
|
|
|
374
349
|
// The first time only: an undo says ready again, and by then the
|
|
375
350
|
// host may have changed the content area itself
|
|
376
351
|
onContentReady: function(area) {
|
|
377
|
-
if (
|
|
378
|
-
|
|
352
|
+
if (readBefore.has(area) && !readReady.has(area)) {
|
|
353
|
+
readReady.set(area, attributesOf(area));
|
|
379
354
|
}
|
|
380
355
|
},
|
|
381
356
|
};
|
|
@@ -384,6 +359,6 @@
|
|
|
384
359
|
// Whatever the plugins setting says: content_types chooses the editors
|
|
385
360
|
textFeature.always = true;
|
|
386
361
|
|
|
387
|
-
|
|
362
|
+
GridEditor.features.text = textFeature;
|
|
388
363
|
|
|
389
|
-
}
|
|
364
|
+
}
|