@themarioga/grid-editor 9.0.0-beta.5 → 9.0.0-beta.7

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +43 -24
  3. package/UPGRADING.md +24 -5
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +5 -4
  6. package/dist/grideditor.d.ts +13 -20
  7. package/dist/grideditor.esm.js +174 -104
  8. package/dist/grideditor.jquery.js +1 -3
  9. package/dist/grideditor.jquery.min.js +1 -1
  10. package/dist/grideditor.jquery.min.js.map +2 -2
  11. package/dist/grideditor.js +174 -104
  12. package/dist/grideditor.min.css +1 -1
  13. package/dist/grideditor.min.css.map +1 -1
  14. package/dist/grideditor.min.js +2 -2
  15. package/dist/grideditor.min.js.map +3 -3
  16. package/dist/locales/grideditor.es.esm.js +1 -0
  17. package/dist/locales/grideditor.es.js +1 -0
  18. package/dist/locales/grideditor.es.min.js +1 -1
  19. package/dist/locales/grideditor.es.min.js.map +2 -2
  20. package/dist/plugins/grideditor.accordion.esm.js +16 -0
  21. package/dist/plugins/grideditor.accordion.js +16 -0
  22. package/dist/plugins/grideditor.accordion.min.js +1 -1
  23. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  24. package/dist/plugins/grideditor.card.esm.js +4 -0
  25. package/dist/plugins/grideditor.card.js +4 -0
  26. package/dist/plugins/grideditor.card.min.js +1 -1
  27. package/dist/plugins/grideditor.card.min.js.map +3 -3
  28. package/dist/plugins/grideditor.carousel.esm.js +7 -0
  29. package/dist/plugins/grideditor.carousel.js +7 -0
  30. package/dist/plugins/grideditor.carousel.min.js +1 -1
  31. package/dist/plugins/grideditor.carousel.min.js.map +3 -3
  32. package/dist/plugins/grideditor.ckeditor.esm.js +9 -0
  33. package/dist/plugins/grideditor.ckeditor.js +9 -0
  34. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  35. package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
  36. package/dist/plugins/grideditor.clipboard.esm.js +47 -25
  37. package/dist/plugins/grideditor.clipboard.js +47 -25
  38. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  39. package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
  40. package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
  41. package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
  42. package/dist/plugins/grideditor.elements.esm.js +3 -0
  43. package/dist/plugins/grideditor.elements.js +3 -0
  44. package/dist/plugins/grideditor.elements.min.js +1 -1
  45. package/dist/plugins/grideditor.elements.min.js.map +3 -3
  46. package/dist/plugins/grideditor.gutters.min.js.map +1 -1
  47. package/dist/plugins/grideditor.history.esm.js +2 -7
  48. package/dist/plugins/grideditor.history.js +2 -7
  49. package/dist/plugins/grideditor.history.min.js +1 -1
  50. package/dist/plugins/grideditor.history.min.js.map +3 -3
  51. package/dist/plugins/grideditor.inline-style.min.js.map +1 -1
  52. package/dist/plugins/grideditor.offcanvas.esm.js +4 -0
  53. package/dist/plugins/grideditor.offcanvas.js +4 -0
  54. package/dist/plugins/grideditor.offcanvas.min.js +1 -1
  55. package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
  56. package/dist/plugins/grideditor.order.min.js +1 -1
  57. package/dist/plugins/grideditor.order.min.js.map +1 -1
  58. package/dist/plugins/grideditor.popup.esm.js +4 -0
  59. package/dist/plugins/grideditor.popup.js +4 -0
  60. package/dist/plugins/grideditor.popup.min.js +1 -1
  61. package/dist/plugins/grideditor.popup.min.js.map +3 -3
  62. package/dist/plugins/grideditor.sections.esm.js +9 -0
  63. package/dist/plugins/grideditor.sections.js +9 -0
  64. package/dist/plugins/grideditor.sections.min.js +1 -1
  65. package/dist/plugins/grideditor.sections.min.js.map +3 -3
  66. package/dist/plugins/grideditor.summernote.esm.js +9 -0
  67. package/dist/plugins/grideditor.summernote.js +9 -0
  68. package/dist/plugins/grideditor.summernote.min.js +1 -1
  69. package/dist/plugins/grideditor.summernote.min.js.map +3 -3
  70. package/dist/plugins/grideditor.tabs.esm.js +7 -0
  71. package/dist/plugins/grideditor.tabs.js +7 -0
  72. package/dist/plugins/grideditor.tabs.min.js +1 -1
  73. package/dist/plugins/grideditor.tabs.min.js.map +3 -3
  74. package/dist/plugins/grideditor.tinymce.esm.js +9 -0
  75. package/dist/plugins/grideditor.tinymce.js +9 -0
  76. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  77. package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
  78. package/docs/events.md +14 -12
  79. package/docs/locale-keys.md +1 -0
  80. package/docs/plugins.md +11 -8
  81. package/example/clipboard.html +20 -14
  82. package/package.json +1 -1
  83. package/src/js/dom.js +6 -0
  84. package/src/js/grideditor.jquery.js +0 -2
  85. package/src/js/grideditor.js +233 -114
  86. package/src/js/locales/grideditor.es.js +1 -0
  87. package/src/js/plugins/grideditor.accordion.js +9 -0
  88. package/src/js/plugins/grideditor.card.js +5 -0
  89. package/src/js/plugins/grideditor.carousel.js +5 -0
  90. package/src/js/plugins/grideditor.clipboard.js +70 -33
  91. package/src/js/plugins/grideditor.history.js +6 -9
  92. package/src/js/plugins/grideditor.offcanvas.js +5 -0
  93. package/src/js/plugins/grideditor.popup.js +5 -0
  94. package/src/js/plugins/grideditor.tabs.js +5 -0
  95. package/src/less/grideditor.less +5 -4
  96. package/types/grideditor.d.ts +13 -20
@@ -28,6 +28,11 @@ GridEditor.containers.card = function(ge) {
28
28
  return {
29
29
  labelKey: 'container.add_card',
30
30
 
31
+ // Where rows go: the card's body
32
+ regionOf: function(container) {
33
+ return dom.one(container, '.card-body');
34
+ },
35
+
31
36
  /**
32
37
  * A card is a header, a body and an optional footer. `header: false`
33
38
  * leaves the title out, `footer: true` or a string adds one; both are
@@ -665,6 +665,11 @@ GridEditor.containers.carousel = function(ge) {
665
665
  labelKey: 'container.add_carousel',
666
666
  addPaneKey: 'container.add_carousel_item',
667
667
  paneKind: 'carousel-item',
668
+
669
+ // Where rows go: the slide showing, or the slide itself
670
+ regionOf: function(container, item) {
671
+ return item || currentOf(container);
672
+ },
668
673
  paneClass: 'ge-carousel-item',
669
674
  paneLabelKey: 'panel.kind_carousel_item',
670
675
 
@@ -15,19 +15,25 @@
15
15
  * pasted in another tab or another editor of the same site. A browser that
16
16
  * will not give the page its storage keeps it in memory, for this page only.
17
17
  *
18
+ * Cut is a copy and a removal in one: its tool in the same drawers, and Ctrl+X.
19
+ * It never asks, and is all or nothing: a before-delete that turns the
20
+ * removal away leaves the clipboard as it was. The target goes to what held
21
+ * the node, so a paste right after puts it back.
22
+ *
18
23
  * A paste is an add like any other - before-add-* and after-add-*, with
19
24
  * `source: 'paste'` - so a host can turn one away.
20
25
  *
21
- * With active_target (which the sidebar turns on), Ctrl+C copies the node
22
- * selected, or the target, and Ctrl+V pastes into the target, or the node
23
- * selected. `clipboard: { shortcuts: false }` turns them off. They go through
24
- * the same store as the tools, never the system clipboard.
26
+ * With active_target (which the sidebar turns on), Ctrl+C copies the target,
27
+ * Ctrl+X cuts it and Ctrl+V pastes into it, as the toolbar adds to it.
28
+ * `clipboard: { shortcuts: false }` turns them off. They go through the same
29
+ * store as the tools, never the system clipboard.
25
30
  */
26
31
  import { GridEditor } from '../grideditor.js';
27
32
  import * as dom from '../dom.js';
28
33
 
29
34
  Object.assign(GridEditor.locales.en, {
30
35
  'tool.copy': 'Copy',
36
+ 'tool.cut': 'Cut',
31
37
  'tool.paste': 'Paste',
32
38
  'clipboard.paste_row': 'Paste row',
33
39
  'clipboard.paste_section': 'Paste section',
@@ -102,12 +108,12 @@ function track(e) {
102
108
  document.addEventListener('pointerdown', track, true);
103
109
  document.addEventListener('focusin', track, true);
104
110
 
105
- /** 'c', 'v' or null, from the letter typed or, on a layout without Latin letters, the key's place. */
111
+ /** 'c', 'x', 'v' or null, from the letter typed or, on a layout without Latin letters, the key's place. */
106
112
  function shortcutKey(e) {
107
113
  var key = (e.key || '').toLowerCase();
108
- if (!/^[a-z]$/.test(key)) { key = { KeyC: 'c', KeyV: 'v' }[e.code] || ''; }
114
+ if (!/^[a-z]$/.test(key)) { key = { KeyC: 'c', KeyX: 'x', KeyV: 'v' }[e.code] || ''; }
109
115
 
110
- return key === 'c' || key === 'v' ? key : null;
116
+ return key === 'c' || key === 'x' || key === 'v' ? key : null;
111
117
  }
112
118
 
113
119
  function typing() {
@@ -162,18 +168,21 @@ GridEditor.features.clipboard = function(ge) {
162
168
  }
163
169
  if (wanted === undefined) { return target; }
164
170
  if (wanted && !target) {
165
- ge.warn('clipboard.shortcuts needs active_target, or settings_panel "sidebar": without it, Ctrl+C and Ctrl+V do nothing');
171
+ ge.warn('clipboard.shortcuts needs active_target, or settings_panel "sidebar": without it, Ctrl+C, Ctrl+X and Ctrl+V do nothing');
166
172
  return false;
167
173
  }
168
174
 
169
175
  return wanted;
170
176
  }
171
177
 
172
- function copy(node, kind, source) {
173
- var html = ge.nodeHtml(node);
178
+ /** What is copied, kept, and said: by a copy, or by a cut on its way to removing the node. */
179
+ function keep(node, kind, source, removing) {
180
+ write({ version: VERSION, category: categoryOf(kind), kind: kind, html: ge.nodeHtml(node) });
181
+ ge.emit('after-copy', ge.payloadFor(kind, node, { source: source || 'tool', cut: removing }));
182
+ }
174
183
 
175
- write({ version: VERSION, category: categoryOf(kind), kind: kind, html: html });
176
- ge.emit('after-copy', ge.payloadFor(kind, node, { source: source || 'tool' }));
184
+ function copy(node, kind, source) {
185
+ keep(node, kind, source, false);
177
186
 
178
187
  // The canvas came back with new drawers: the one to flash is the
179
188
  // node's new copy tool
@@ -189,6 +198,30 @@ GridEditor.features.clipboard = function(ge) {
189
198
  }, 1200);
190
199
  }
191
200
 
201
+ /**
202
+ * Copy the node and remove it, as its delete tool does but without the
203
+ * question: all or nothing, so a before-delete that turns it away leaves
204
+ * the clipboard as it was. The target, if it was this node or in it, goes
205
+ * to what held it before the node leaves, so a paste right after goes
206
+ * there.
207
+ */
208
+ function cut(node, kind, source) {
209
+ return ge.removeNode(node, {
210
+ source: 'cut',
211
+ confirm: false,
212
+ before: function() {
213
+ keep(node, kind, source, true);
214
+
215
+ var target = ge.getActiveTarget();
216
+ if (source !== 'tool' && !(target && node.contains(target))) { return; }
217
+
218
+ var parent = node.parentElement;
219
+ while (parent && parent !== ge.canvas && !ge.detailsOf(parent)) { parent = parent.parentElement; }
220
+ ge.setActiveTarget(parent && parent !== ge.canvas ? parent : null);
221
+ },
222
+ });
223
+ }
224
+
192
225
  function paste(target, categories) {
193
226
  var clip = read();
194
227
  if (!fits(clip, categories)) { return; }
@@ -197,29 +230,16 @@ GridEditor.features.clipboard = function(ge) {
197
230
  }
198
231
 
199
232
  /**
200
- * Ctrl+V: into the target as the toolbar's paste button would - a
201
- * section, which only the canvas takes, after the block the target is in
202
- * - and what that button has none for as the target's paste tool would.
203
- * With no target, as the selected node's paste tool. What does not fit
204
- * is not pasted anywhere else.
233
+ * Ctrl+V: into the target, where the toolbar would add it - at the end
234
+ * of what the target holds, in the row or column it lacks, a section on
235
+ * the canvas after the block the target is in. What the target cannot
236
+ * take is not pasted anywhere else.
205
237
  */
206
238
  function pasteByShortcut() {
207
239
  var clip = read();
208
- var target = ge.getActiveTarget();
209
- var node = target || ge.getSelected();
210
- if (!clip || !node) { return false; }
211
-
212
- var placement = { appendTo: node, source: 'paste' };
213
- if (target && clip.category === 'section') {
214
- if (!available(clip)) { return false; }
215
- var top = target;
216
- while (top.parentElement && top.parentElement !== ge.canvas) { top = top.parentElement; }
217
- placement = { insertAfter: top, source: 'paste' };
218
- } else if (!fits(clip, TARGETS[ge.kindOf(node)] || [])) {
219
- return false;
220
- }
240
+ if (!clip || !ge.getActiveTarget() || !available(clip)) { return false; }
221
241
 
222
- var made = ge.place(ge.freshNode(clip.html), clip.kind, placement);
242
+ var made = ge.placeInTarget(ge.freshNode(clip.html), clip.kind, 'paste');
223
243
  if (made && made.scrollIntoView) { made.scrollIntoView({ behavior: 'smooth' }); }
224
244
 
225
245
  return true;
@@ -228,7 +248,7 @@ GridEditor.features.clipboard = function(ge) {
228
248
  function copyByShortcut() {
229
249
  if (textSelected()) { return false; }
230
250
 
231
- var node = ge.getSelected() || ge.getActiveTarget();
251
+ var node = ge.getActiveTarget();
232
252
  var kind = node && ge.kindOf(node);
233
253
  if (!kind || !categoryOf(kind)) { return false; }
234
254
 
@@ -236,13 +256,24 @@ GridEditor.features.clipboard = function(ge) {
236
256
  return true;
237
257
  }
238
258
 
259
+ function cutByShortcut() {
260
+ if (textSelected()) { return false; }
261
+
262
+ var node = ge.getActiveTarget();
263
+ var kind = node && ge.kindOf(node);
264
+ if (!kind || !categoryOf(kind)) { return false; }
265
+
266
+ return cut(node, kind, 'shortcut');
267
+ }
268
+
239
269
  function onKeydown(e) {
240
270
  if (lastEditor !== ge || e.repeat || e.shiftKey || e.altKey || !(e.ctrlKey || e.metaKey)) { return; }
241
271
  var key = shortcutKey(e);
242
272
  if (!key || !dom.hasClass(ge.canvas, 'ge-editing') || typing() || ge.panelOpen()) { return; }
243
273
 
244
274
  // Left alone, it is the browser's: a copy of the text, a paste in a field
245
- if (key === 'c' ? copyByShortcut() : pasteByShortcut()) { e.preventDefault(); }
275
+ var acted = { c: copyByShortcut, x: cutByShortcut, v: pasteByShortcut }[key]();
276
+ if (acted) { e.preventDefault(); }
246
277
  }
247
278
 
248
279
  function listenForShortcuts(on) {
@@ -298,6 +329,12 @@ GridEditor.features.clipboard = function(ge) {
298
329
  ge.createTool(drawer, ge.t('tool.copy'), 'ge-copy', 'bi bi-copy', function() {
299
330
  copy(node, kind);
300
331
  });
332
+ ge.createTool(drawer, ge.t('tool.cut'), 'ge-cut', 'bi bi-scissors', function(e) {
333
+ // The click that picks the node it is in would pick it as
334
+ // the target again, after it has gone to what held it
335
+ e.stopPropagation();
336
+ cut(node, kind, 'tool');
337
+ });
301
338
  }
302
339
 
303
340
  var categories = TARGETS[kind];
@@ -12,8 +12,8 @@
12
12
  *
13
13
  * A step is the canvas's markup as ge.snapshotHtml() gives it, kept `delay`
14
14
  * ms after the last change: a drag or a burst of typing is one step. Going
15
- * to one puts its markup back with ge.setHtml(), and the node that was
16
- * selected, and the target, are chosen again by where they were.
15
+ * to one puts its markup back with ge.setHtml(), and the target is chosen
16
+ * again by where it was.
17
17
  *
18
18
  * Typing in a text is the text editor's own to undo while it has the focus:
19
19
  * the keys are left alone then, and what was typed becomes a step when it
@@ -35,8 +35,8 @@ var DEFAULT_DELAY = 500;
35
35
  /** What the editor puts in a node that is not the node's own: a position counts without it. */
36
36
  var FURNITURE = '.ge-tools-drawer, .ge-drop-marker';
37
37
 
38
- /** What a drag or a resize leaves on the canvas while it lasts. */
39
- var BUSY = '.ge-drag-chosen, .ge-drag-placeholder, .ge-drag-helper, .ge-resizing';
38
+ /** What a drag, a resize or a node animating out leaves on the canvas while it lasts. */
39
+ var BUSY = '.ge-drag-chosen, .ge-drag-placeholder, .ge-drag-helper, .ge-resizing, .ge-leaving';
40
40
 
41
41
  /** The editors listening for the keys, and the one used last, which a key press goes to. */
42
42
  var listeningEditors = [];
@@ -133,7 +133,7 @@ GridEditor.features.history = function(ge) {
133
133
  return dom.hasClass(ge.canvas, 'ge-editing');
134
134
  }
135
135
 
136
- /** A drag or a resize is going on: the canvas is not at a step but between two. */
136
+ /** A drag, a resize or a removal is going on: the canvas is not at a step but between two. */
137
137
  function busy() {
138
138
  return dom.hasClass(ge.canvas, 'ge-dropping') || !!dom.one(ge.canvas, BUSY);
139
139
  }
@@ -227,7 +227,6 @@ GridEditor.features.history = function(ge) {
227
227
  var to = index + step;
228
228
  if (to < 0 || to >= stack.length) { return false; }
229
229
 
230
- var selected = pathOf(ge.getSelected());
231
230
  var target = pathOf(ge.getActiveTarget());
232
231
 
233
232
  stopObserving();
@@ -236,9 +235,7 @@ GridEditor.features.history = function(ge) {
236
235
  // The step as the canvas reads it back, so that is what is compared with
237
236
  stack[index] = ge.snapshotHtml();
238
237
 
239
- var node = resolve(selected);
240
- if (node) { ge.setSelected(node); }
241
- node = resolve(target);
238
+ var node = resolve(target);
242
239
  if (node) { ge.setActiveTarget(node); }
243
240
 
244
241
  observe();
@@ -317,6 +317,11 @@ GridEditor.containers.offcanvas = function(ge) {
317
317
  labelKey: 'container.add_offcanvas',
318
318
  paneKind: 'offcanvas',
319
319
 
320
+ // Where rows go: the offcanvas's body
321
+ regionOf: function(container) {
322
+ return dom.one(container, '.offcanvas-body');
323
+ },
324
+
320
325
  // The ids a copy of an offcanvas has to rename together
321
326
  references: ['data-ge-offcanvas-id', 'data-ge-offcanvas-target'],
322
327
 
@@ -27,6 +27,11 @@ GridEditor.containers.popup = function(ge) {
27
27
  labelKey: 'container.add_popup',
28
28
  paneKind: 'popup',
29
29
 
30
+ // Where rows go: the popup's body
31
+ regionOf: function(container) {
32
+ return dom.one(container, '.modal-body');
33
+ },
34
+
30
35
  // The ids a copy of a popup has to rename together
31
36
  references: ['data-ge-popup-id', 'data-ge-popup-target'],
32
37
 
@@ -368,6 +368,11 @@ GridEditor.containers.tabs = function(ge) {
368
368
  addPaneKey: 'container.add_tab',
369
369
  paneKind: 'tab',
370
370
 
371
+ // Where rows go: the pane showing, or the pane of the tab
372
+ regionOf: function(container, tab) {
373
+ return tab ? paneOf(container, tab) : dom.one(container, ':scope > .tab-content > .tab-pane.active');
374
+ },
375
+
371
376
  create: function(options) {
372
377
  var container = dom.element('div', { 'data-ge-container': 'tabs' });
373
378
  var labels = options.labels || [];
@@ -680,13 +680,14 @@ html.ge-sidebar-open {
680
680
  outline-offset: 1px;
681
681
  }
682
682
 
683
- /* Where the toolbar's buttons add, with active_target. A node that is both
684
- shows both: this one a little further out */
685
- .ge-canvas.ge-editing .ge-active-target {
683
+ /* The target, with active_target: where the toolbar's buttons add and what
684
+ the sidebar shows. A node that also has its panel open shows both: this
685
+ one a little further out */
686
+ .ge-canvas.ge-editing .ge-selected {
686
687
  outline: 2px dashed var(--bs-success, #198754);
687
688
  outline-offset: -2px;
688
689
  }
689
- .ge-canvas.ge-editing .ge-active-target.ge-settings-target {
690
+ .ge-canvas.ge-editing .ge-selected.ge-settings-target {
690
691
  box-shadow: 0 0 0 4px var(--bs-success, #198754);
691
692
  }
692
693
 
@@ -190,7 +190,7 @@ export interface GridEditorOptions {
190
190
  drawer_overflow?: 'menu' | 'wrap';
191
191
  /** The add buttons in categories - rows, content, and a plugin's own - one shown at a time, chosen with tabs. Default false. */
192
192
  toolbar_groups?: boolean;
193
- /** A click in a column or a section makes it where the toolbar's buttons add. Default false, and true with settings_panel 'sidebar', which throws if it is given false. */
193
+ /** A click on any node with settings - a row, a column, a container, a text - makes it the target: where the toolbar's buttons add, and what the sidebar shows. Default false, and true with settings_panel 'sidebar', which throws if it is given false. */
194
194
  active_target?: boolean;
195
195
  /** The plugins to use, of any kind; null is every one loaded. */
196
196
  plugins?: string[] | null;
@@ -209,7 +209,7 @@ export interface GridEditorOptions {
209
209
  elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
210
210
  /** The autosave plugin: what is edited, kept in the browser's storage as it changes. */
211
211
  autosave?: AutosaveOptions;
212
- /** The clipboard plugin. `shortcuts`: Ctrl+C and Ctrl+V on the node selected or the target; default active_target. */
212
+ /** The clipboard plugin. `shortcuts`: Ctrl+C and Ctrl+V on the active target; default active_target. */
213
213
  clipboard?: { shortcuts?: boolean };
214
214
  /** The history plugin: undo and redo. */
215
215
  history?: HistoryOptions;
@@ -230,7 +230,7 @@ export interface GridEditorOptions {
230
230
  locale_strings?: Record<string, string>;
231
231
  callbacks?: Partial<GridEditorCallbacks>;
232
232
  confirm_delete?: boolean;
233
- /** Where a node's settings open. 'sidebar' is a panel that stays on the right while editing, showing the selected node's; one editor per page has it. It turns active_target on, and the constructor throws a TypeError if active_target is false. */
233
+ /** Where a node's settings open. 'sidebar' is a panel that stays on the right while editing, showing the active target's; one editor per page has it. It turns active_target on, and the constructor throws a TypeError if active_target is false. */
234
234
  settings_panel?: 'offcanvas' | 'popover' | 'modal' | 'inline' | 'sidebar';
235
235
  /** The 'sidebar' panel. */
236
236
  sidebar?: SidebarSettings;
@@ -331,11 +331,16 @@ export interface Payload {
331
331
  parent: HTMLElement | null;
332
332
  canvas: HTMLElement;
333
333
  breakpoint: View;
334
- source: 'api' | 'tool' | 'dragdrop' | 'paste' | 'panel' | 'shortcut' | string;
334
+ source: 'api' | 'tool' | 'dragdrop' | 'paste' | 'cut' | 'panel' | 'shortcut' | string;
335
335
  /** A pane inside a container. */
336
336
  container?: HTMLElement;
337
337
  }
338
338
 
339
+ /** A node was copied, or cut: with the clipboard plugin, `source` is 'tool' or 'shortcut', and `cut` says whether the node is leaving. */
340
+ export interface CopyPayload extends Payload {
341
+ cut: boolean;
342
+ }
343
+
339
344
  export interface MovePayload extends Payload {
340
345
  from: Position;
341
346
  to?: Position;
@@ -389,7 +394,7 @@ export interface ViewChangePayload {
389
394
  to: View;
390
395
  }
391
396
 
392
- /** The active target changed: the column or region the toolbar adds to, or null for the canvas. */
397
+ /** The active target changed: the node the toolbar adds to and the sidebar shows - any with settings - or null for the canvas. */
393
398
  export interface TargetChangePayload {
394
399
  canvas: HTMLElement;
395
400
  target: HTMLElement | null;
@@ -402,13 +407,6 @@ export interface PreviewChangePayload {
402
407
  previewing: boolean;
403
408
  }
404
409
 
405
- /** The selection changed, with settings_panel 'sidebar': the node whose settings the sidebar shows, or null. */
406
- export interface SelectionChangePayload {
407
- canvas: HTMLElement;
408
- node: HTMLElement | null;
409
- from: HTMLElement | null;
410
- }
411
-
412
410
  /** The events, by name, with their payloads. Adding fires a specific name and the generic one. */
413
411
  export interface GridEditorEventMap {
414
412
  'grideditor:before-add': Payload;
@@ -445,13 +443,12 @@ export interface GridEditorEventMap {
445
443
  'grideditor:after-convert': ConvertPayload;
446
444
  'grideditor:before-edit-html': EditHtmlPayload;
447
445
  'grideditor:after-edit-html': EditHtmlPayload;
448
- 'grideditor:after-copy': Payload;
446
+ 'grideditor:after-copy': CopyPayload;
449
447
  'grideditor:popup-orphan': PopupOrphanPayload;
450
448
  'grideditor:offcanvas-orphan': OffcanvasOrphanPayload;
451
449
  'grideditor:view-change': ViewChangePayload;
452
450
  'grideditor:preview-change': PreviewChangePayload;
453
451
  'grideditor:target-change': TargetChangePayload;
454
- 'grideditor:selection-change': SelectionChangePayload;
455
452
  'grideditor:after-autosave': AutosavePayload;
456
453
  'grideditor:after-restore-draft': RestoreDraftPayload;
457
454
  'grideditor:autosave-error': AutosaveErrorPayload;
@@ -562,14 +559,10 @@ export declare class GridEditor {
562
559
  /** Take the editor off: the markup stays, everything else goes. */
563
560
  destroy(): this;
564
561
  changeView(view: View): this;
565
- /** The column or region the toolbar adds to, or null. Null without active_target, which settings_panel 'sidebar' turns on. */
562
+ /** The node the toolbar adds to, and the sidebar shows, or null: any node with settings, a row, a column, a container, a text. Null without active_target, which settings_panel 'sidebar' turns on. */
566
563
  getActiveTarget(): HTMLElement | null;
567
- /** Make a column or region, or the first a selector matches, where the toolbar adds; null for none. */
564
+ /** Make a node with settings, or the first a selector matches, the one the toolbar adds to; null for none. */
568
565
  setActiveTarget(target: HTMLElement | string | null): this;
569
- /** The node whose settings the sidebar shows, or null. Null unless settings_panel is 'sidebar'. */
570
- getSelected(): HTMLElement | null;
571
- /** Select a node with settings, or the first a selector matches, or null for none. Does nothing unless settings_panel is 'sidebar'. */
572
- setSelected(node: HTMLElement | string | null): this;
573
566
  getView(): View;
574
567
  setLocale(code: string): this;
575
568
  createRow(layout?: RowLayout, options?: Placement): HTMLElement | null;