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

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 (63) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +23 -17
  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 +6 -18
  7. package/dist/grideditor.esm.js +122 -100
  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 +122 -100
  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/plugins/grideditor.accordion.esm.js +7 -0
  17. package/dist/plugins/grideditor.accordion.js +7 -0
  18. package/dist/plugins/grideditor.accordion.min.js +1 -1
  19. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  20. package/dist/plugins/grideditor.card.esm.js +4 -0
  21. package/dist/plugins/grideditor.card.js +4 -0
  22. package/dist/plugins/grideditor.card.min.js +1 -1
  23. package/dist/plugins/grideditor.card.min.js.map +3 -3
  24. package/dist/plugins/grideditor.carousel.esm.js +4 -0
  25. package/dist/plugins/grideditor.carousel.js +4 -0
  26. package/dist/plugins/grideditor.carousel.min.js +1 -1
  27. package/dist/plugins/grideditor.carousel.min.js.map +2 -2
  28. package/dist/plugins/grideditor.clipboard.esm.js +3 -18
  29. package/dist/plugins/grideditor.clipboard.js +3 -18
  30. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  31. package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
  32. package/dist/plugins/grideditor.history.esm.js +1 -6
  33. package/dist/plugins/grideditor.history.js +1 -6
  34. package/dist/plugins/grideditor.history.min.js +1 -1
  35. package/dist/plugins/grideditor.history.min.js.map +3 -3
  36. package/dist/plugins/grideditor.offcanvas.esm.js +4 -0
  37. package/dist/plugins/grideditor.offcanvas.js +4 -0
  38. package/dist/plugins/grideditor.offcanvas.min.js +1 -1
  39. package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
  40. package/dist/plugins/grideditor.popup.esm.js +4 -0
  41. package/dist/plugins/grideditor.popup.js +4 -0
  42. package/dist/plugins/grideditor.popup.min.js +1 -1
  43. package/dist/plugins/grideditor.popup.min.js.map +3 -3
  44. package/dist/plugins/grideditor.tabs.esm.js +4 -0
  45. package/dist/plugins/grideditor.tabs.js +4 -0
  46. package/dist/plugins/grideditor.tabs.min.js +1 -1
  47. package/dist/plugins/grideditor.tabs.min.js.map +2 -2
  48. package/docs/events.md +8 -11
  49. package/docs/plugins.md +10 -8
  50. package/example/clipboard.html +13 -10
  51. package/package.json +1 -1
  52. package/src/js/grideditor.jquery.js +0 -2
  53. package/src/js/grideditor.js +177 -110
  54. package/src/js/plugins/grideditor.accordion.js +9 -0
  55. package/src/js/plugins/grideditor.card.js +5 -0
  56. package/src/js/plugins/grideditor.carousel.js +5 -0
  57. package/src/js/plugins/grideditor.clipboard.js +11 -24
  58. package/src/js/plugins/grideditor.history.js +3 -6
  59. package/src/js/plugins/grideditor.offcanvas.js +5 -0
  60. package/src/js/plugins/grideditor.popup.js +5 -0
  61. package/src/js/plugins/grideditor.tabs.js +5 -0
  62. package/src/less/grideditor.less +5 -4
  63. package/types/grideditor.d.ts +6 -18
package/docs/events.md CHANGED
@@ -93,8 +93,7 @@ about every insertion can bind `grideditor:before-add` and switch on
93
93
  | `grideditor:after-utility` | — | no | after the class is written and the preview redrawn, only if something changed |
94
94
  | `grideditor:view-change` | — | no | after the view changes, only if it actually changed |
95
95
  | `grideditor:preview-change` | — | no | after the preview button is pressed or let go; not while it is only hovered |
96
- | `grideditor:target-change` | — | no | with `active_target`, after the column or section the toolbar adds to changes, only if it actually changed |
97
- | `grideditor:selection-change` | — | no | with `settings_panel: 'sidebar'`, after the node whose settings the sidebar shows changes, only if it actually changed |
96
+ | `grideditor:target-change` | — | no | with `active_target`, after the node the toolbar adds to and the sidebar shows changes - any node with settings - only if it actually changed |
98
97
  | `grideditor:after-copy` | — | no | with the clipboard plugin, after a node is copied: `source: 'tool'` from its Copy tool, `'shortcut'` from Ctrl+C |
99
98
  | `grideditor:after-autosave` | — | no | with the autosave plugin, after a draft is written |
100
99
  | `grideditor:after-restore-draft` | — | no | with the autosave plugin, after the user chose to restore a draft and the canvas is it |
@@ -184,15 +183,13 @@ go - by a click, or by the editor itself when the source view opens, when a
184
183
  plugin replaces the canvas with `setHtml` (an undo does) and on `destroy`.
185
184
 
186
185
  `target-change` carries no node either: its payload is `canvas`, `target` - the
187
- column or section the toolbar adds to now, or `null` for the end of the canvas
188
- - and `from`, the one before. What a toolbar button then adds fires its add
189
- events as any click does, with `source: 'tool'` (or `'paste'`) and the target,
190
- or the canvas for a section, as the `parent`.
191
-
192
- `selection-change` carries no node of its own either: its payload is `canvas`,
193
- `node` - the node whose settings the sidebar shows now, or `null` for none -
194
- and `from`, the one before. A node deleted while selected, or replaced by
195
- `setHtml`, is a change to `null`. A handler's answer is ignored.
186
+ node the toolbar adds to now - any node with settings - or `null` for the end
187
+ of the canvas - and `from`, the one before. A node deleted while it is the
188
+ target, or replaced by `setHtml`, is a change to `null`. What a toolbar button
189
+ then adds fires its add events as any click does, with `source: 'tool'` (or
190
+ `'paste'`) and the place it went in - the target, its pane, or the row or
191
+ column it holds - or the canvas for a section, as the `parent`. A row or
192
+ column made around it fires none of its own.
196
193
 
197
194
  `source` matters to a host that both drives the editor from its own palette and
198
195
  listens for what the user does: `api` is your own call coming back to you,
package/docs/plugins.md CHANGED
@@ -69,6 +69,8 @@ GridEditor.containers.gallery = function(ge) {
69
69
  paneClass: 'ge-picture', // optional: the class mark gives its panes, which is how
70
70
  // the editor knows one is a picture
71
71
  paneLabelKey: 'panel.kind_picture', // optional: what a pane's settings panel calls it
72
+ regionOf: function(container, pane) { … }, // optional: where rows go when it is the active target:
73
+ // the pane's own (or the one showing, with no pane), or null
72
74
 
73
75
  create: function(options) { … }, // returns the container
74
76
  addPane: addPictureTo, // returns the new pane
@@ -188,9 +190,9 @@ element, and where there may be several, an array.
188
190
  | `ge.setHtml(html)` | The canvas made of other markup, and edited again: the source view closed if it is open, `deinit`, the markup in, `init`. No add or delete events: it is replaced as a whole. A `<script>` in it does not run in the editor |
189
191
  | `ge.confirm(message, options, answer)` | A question in the editor's confirm modal, the one deleting asks in. `options`: `title`, `ok`, `cancel` - the texts, the locale's by default - and `danger`, a red ok button. `answer(true)` for ok, `answer(false)` for cancel, the close button or Escape, `answer(null)` when the modal is taken away unanswered: `setLocale`, `destroy`, or another question. The browser's `confirm` without Bootstrap's javascript |
190
192
  | `ge.refreshToolbar()` | The toolbar built again, from what the feature plugins' `toolbar`s hold now: for a plugin whose buttons come and go. The category shown with `toolbar_groups`, the preview and the source view stay as they are. Does nothing before the toolbar is first built, and after `destroy` |
191
- | `ge.getSelected()` | The node the sidebar shows, as the public method gives it: `null` without the `'sidebar'` panel |
192
- | `ge.getActiveTarget()` | The column or section the toolbar adds to, as the public method gives it: `null` without `active_target` |
193
- | `ge.setSelected(node)` / `ge.setActiveTarget(node)` | Choose the node the sidebar shows, or the column or section the toolbar adds to: the public methods without their warnings. `true` when it took, `false` for a node that is not one, or without the `'sidebar'` panel or `active_target`. A plugin that puts the choice back after it remade the canvas does not know the node is still one |
193
+ | `ge.getActiveTarget()` | The node the toolbar adds to and the sidebar shows - any node with settings - as the public method gives it: `null` without `active_target` |
194
+ | `ge.placeInTarget(node, kind, source)` | Add a node you made to the active target as the toolbar adds what it makes: at the end of what the target holds, in the row or column it lacks, a section on the canvas after the block the target is in. The add events fire with `kind` and `source`. The node added, or `null` with no target or when a handler canceled |
195
+ | `ge.setActiveTarget(node)` | Choose the node the toolbar adds to: the public method without its warnings. `true` when it took, `false` for a node that is not one with settings, or without `active_target`. A plugin that puts the choice back after it remade the canvas does not know the node is still one |
194
196
  | `ge.panelOpen()` | Whether a settings panel is open in a popover, an offcanvas or a modal, or one is unfolded inline in a drawer, or the editor's dialog or delete confirmation is up. The sidebar does not count: it is always there |
195
197
  | `ge.contains(node)` | Whether a node is this editor's: in its canvas, its toolbar, its settings panels (the sidebar too, when it has it), its dialog or its confirmation |
196
198
  | `ge.toolbarItems(name)` | An array of the toolbar buttons the feature plugin `name` declared, for showing and hiding them |
@@ -349,7 +351,7 @@ node's kind as `{kind}` - or the label. `body` stays the panel's either way,
349
351
  so `ge.detailsOf(node)` finds what is in it.
350
352
 
351
353
  With `settings_panel: 'sidebar'` the panel has room, as the offcanvas does:
352
- the sections are in it, and `body` is in the sidebar while its node is selected.
354
+ the sections are in it, and `body` is in the sidebar while its node is the target.
353
355
 
354
356
  A field made with `ge.utilityField` in a section follows the view and the
355
357
  classes field as the Responsive section's do, wherever the section is at the
@@ -362,16 +364,16 @@ with `ge.hostStyle`: in a breakpoint view the node's `style` holds the
362
364
  preview's `!important` values too, and they come off on `deinit` with
363
365
  whatever was written under them.
364
366
 
365
- ### What the sidebar shows with nothing selected
367
+ ### What the sidebar shows with no target
366
368
 
367
369
  **`sidebarEmpty(ge)`**, which any kind of plugin can have, returns what the
368
- `'sidebar'` settings panel shows while nothing is selected -
370
+ `'sidebar'` settings panel shows while there is no active target -
369
371
  `{ titleKey, body }`, a locale key for the title and an element - or null. It
370
- is called each time the sidebar is left with nothing selected. The host's own
372
+ is called each time the sidebar is left with no target. The host's own
371
373
  `sidebar.empty` goes first; then the first plugin, in the order they were
372
374
  registered, that returns something; with none, the editor's message. A result
373
375
  without a `body` element counts as null. `body` is taken out of the sidebar,
374
- not destroyed, when a node is selected, so keep it and give it back.
376
+ not destroyed, when a node becomes the target, so keep it and give it back.
375
377
 
376
378
  ### Settings of your own, saved on the node
377
379
 
@@ -34,9 +34,10 @@
34
34
  // tinyMCE 7 is GPL-2.0-or-later: 'gpl' accepts that licence.
35
35
  // A commercial licence passes its own key here instead.
36
36
  tinymce: { config: { license_key: 'gpl' } },
37
- // A click in a column or a section makes it the target, which
38
- // turns on Ctrl+C and Ctrl+V. clipboard: { shortcuts: false }
39
- // would leave the keys to the browser
37
+ // A click on a node - a row, a column, a container, a text...
38
+ // - makes it the target, which turns on Ctrl+C and Ctrl+V.
39
+ // clipboard: { shortcuts: false } would leave the keys to
40
+ // the browser
40
41
  active_target: true,
41
42
  };
42
43
 
@@ -81,16 +82,18 @@
81
82
  drag it to where the copy should land.
82
83
  </p>
83
84
  <p class="text-body-secondary">
84
- With the keyboard: click a column or a section - its background or
85
- its drawer, not a text, which opens the text for writing - and it
85
+ With the keyboard: click a node - a row, a column, a container, an
86
+ element, or a text - on its background or its drawer, and it
86
87
  becomes the target, with a dashed outline. <kbd>Ctrl</kbd>+<kbd>C</kbd>
87
88
  (<kbd>⌘</kbd>+<kbd>C</kbd> on a Mac) copies it, and
88
- <kbd>Ctrl</kbd>+<kbd>V</kbd> pastes what is copied into it, where
89
- it fits: a row, a text, a container or an element at the end of a
90
- column, a row into a section, a section after the block the target
89
+ <kbd>Ctrl</kbd>+<kbd>V</kbd> pastes what is copied into it, at its
90
+ end and in the level it lacks: a row pasted into a row goes in a
91
+ new column of it, a column pasted into a column goes in a new row,
92
+ and a container or a text pasted into a container goes in the tab
93
+ or the item it shows. A section goes after the block the target
91
94
  is in. While you are writing in a text, or have text selected, the
92
- keys copy and paste the text as usual. Escape, or a click on the
93
- canvas outside any column, clears the target.
95
+ keys copy and paste the text as usual. Escape, or a click outside
96
+ the editor or on the canvas outside any node, clears the target.
94
97
  </p>
95
98
  <p class="text-body-secondary">
96
99
  What is copied is kept in the browser, so it can be pasted in the
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "version": "9.0.0-beta.5",
35
+ "version": "9.0.0-beta.6",
36
36
  "main": "dist/grideditor.js",
37
37
  "module": "dist/grideditor.esm.js",
38
38
  "types": "dist/grideditor.d.ts",
@@ -69,8 +69,6 @@ function install() {
69
69
  setUtility: { value: true },
70
70
  getActiveTarget: { value: true },
71
71
  setActiveTarget: {},
72
- getSelected: { value: true },
73
- setSelected: {},
74
72
  };
75
73
 
76
74
  /** The *_tools settings, whose handlers 6.x bound with jQuery. */