@themarioga/grid-editor 4.1.0 → 5.1.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +131 -10
  3. package/UPGRADING.md +55 -0
  4. package/dist/grideditor.css +466 -0
  5. package/dist/grideditor.min.css +1 -1
  6. package/dist/grideditor.min.css.map +1 -1
  7. package/dist/jquery.grideditor.bundle.min.js +2 -2
  8. package/dist/jquery.grideditor.js +741 -126
  9. package/dist/jquery.grideditor.min.js +1 -1
  10. package/dist/jquery.grideditor.min.js.map +1 -1
  11. package/dist/locales/grideditor.es.js +30 -0
  12. package/dist/locales/grideditor.es.min.js +1 -1
  13. package/dist/locales/grideditor.es.min.js.map +1 -1
  14. package/dist/plugins/grideditor.clipboard.js +274 -0
  15. package/dist/plugins/grideditor.clipboard.min.js +2 -0
  16. package/dist/plugins/grideditor.clipboard.min.js.map +1 -0
  17. package/dist/plugins/grideditor.float.js +56 -0
  18. package/dist/plugins/grideditor.float.min.js +2 -0
  19. package/dist/plugins/grideditor.float.min.js.map +1 -0
  20. package/dist/plugins/grideditor.sections.js +199 -0
  21. package/dist/plugins/grideditor.sections.min.js +2 -0
  22. package/dist/plugins/grideditor.sections.min.js.map +1 -0
  23. package/dist/plugins/grideditor.textalign.js +60 -0
  24. package/dist/plugins/grideditor.textalign.min.js +2 -0
  25. package/dist/plugins/grideditor.textalign.min.js.map +1 -0
  26. package/docs/events.md +17 -3
  27. package/docs/locale-keys.md +49 -1
  28. package/docs/plugins.md +45 -3
  29. package/example/autocols.html +137 -0
  30. package/example/breakpoints.html +7 -5
  31. package/example/clipboard.html +99 -0
  32. package/example/index.html +24 -2
  33. package/example/utilities.html +22 -1
  34. package/example/wrap_content.html +66 -16
  35. package/package.json +1 -1
  36. package/src/js/jquery.grideditor.js +742 -127
  37. package/src/js/locales/grideditor.es.js +30 -0
  38. package/src/js/plugins/grideditor.clipboard.js +274 -0
  39. package/src/js/plugins/grideditor.float.js +56 -0
  40. package/src/js/plugins/grideditor.sections.js +199 -0
  41. package/src/js/plugins/grideditor.textalign.js +60 -0
  42. package/src/less/grideditor.less +138 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,86 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
 
8
+ ## [5.1.0] - 2026-09-23
9
+ ### Added
10
+ - The `clipboard` plugin: copy and paste. Rows, columns, sections, containers
11
+ and elements get a *Copy* tool; a *Paste* tool shows wherever what is copied
12
+ can go, and the toolbar gets *Paste row* and *Paste section* buttons. What is
13
+ copied is kept in `localStorage`, so it reaches other editors, reloads and
14
+ other tabs. A pasted copy takes new ids where the page already has them, and
15
+ its Bootstrap wiring follows. Pastes go through the add events with
16
+ `source: 'paste'`; a copy fires `grideditor:after-copy`. See
17
+ [example/clipboard.html](example/clipboard.html).
18
+ - For plugins: a feature plugin can declare `drawerTools`, a toolbar item can
19
+ have an `iconClass` and a `source`, `ge.place` takes a `source`, and the
20
+ handle has `ge.nodeHtml(node)` and `ge.toolbarItems(name)`.
21
+ - `getPlainHtml`: the markup `getHtml` returns without grid-editor's own
22
+ marking, for a page that publishes it. The `ge-*` classes, the `column`
23
+ class and the `data-ge-*` attributes are taken off, and a div left with
24
+ nothing on it (each content area, a bare element or container wrapper) is
25
+ replaced by its children. It is a one-way export; save `getHtml` to edit
26
+ again.
27
+
28
+ ### Fixed
29
+ - With `content_types: []`, content areas were given a
30
+ `ge-content-type-undefined` class. They now name no type.
31
+ - The drawers of sections and of tabs and accordions had their add tool
32
+ (*Add row*, *Add tab*, *Add item*) before the delete one, the other way
33
+ round from rows and columns. They now have delete first, then add.
34
+
35
+ ## [5.0.0] - 2026-09-23
36
+ ### Changed
37
+ - **The all view writes one class.** A size or an offset set in the all view
38
+ is written as the class with no breakpoint (`col-4`, `offset-2`), and the
39
+ breakpoints' own sizes or offsets are taken off, as the utilities have done
40
+ since 4.1. Up to 4.x it wrote all six breakpoints. The resize and indent
41
+ payloads carry `cleared`, with what was taken off.
42
+ - Resize payloads' `from` and `to` can be `'equal'` or `'auto'`, `from` is
43
+ `null` for a column its row sizes, and `source` can be `panel`.
44
+ - `valid_col_sizes` defaults to `[1, … 12, 'equal', 'auto']`.
45
+ - `ge.viewTiers()` returns the one breakpoint a view writes: `xs` in the all
46
+ view.
47
+
48
+ See [UPGRADING.md](UPGRADING.md) for what these mean for a host.
49
+
50
+ ### Added
51
+ - Equal and auto column sizes: Bootstrap's `col` and `col-auto`, at every
52
+ breakpoint. The editor recognises them, previews them in each view, offers
53
+ them in the add column picker and in `new_row_layouts`, `createRow` and
54
+ `createColumn`, and the width tools turn them into a number starting from
55
+ the width the column has. A column with only `col` used to be no column at
56
+ all, and a `col-auto` one was given a `col-12` that overrode it.
57
+ - A *Width* field in each column's Responsive section, with every size.
58
+ - Columns per row: a *Columns per row* field in each row's panel writes
59
+ `row-cols-{bp}-{1–6,auto}`. Columns with no size of their own share the
60
+ line out and are left without a `col-12`; the preview, the budget and the
61
+ tools settle row-cols against each column's own size as Bootstrap's css
62
+ does, and the row says in a corner how many it puts per line. Layouts,
63
+ `createRow` and `createColumn` take rows with row-cols, and `row_cols: false`
64
+ takes the field away.
65
+ - The `sections` plugin: Bootstrap's `.container`, `.container-fluid` and
66
+ `.container-{bp}` as sections on the canvas, grouping rows. Each gets a
67
+ drawer with a width field, the toolbar a *Section* button, and the API
68
+ `createSection`. Rows drag in and out of sections, sections drag along the
69
+ canvas, and a breakpoint view gives each the max-width its container has
70
+ there.
71
+ - Feature plugins can add blocks, regions and toolbar buttons (`blocks`,
72
+ `regions`, `accepts`, `toolbar`), and the handle gains `rowFromLayout`.
73
+ - The `textalign` utility plugin: `text-{bp}-start`, `-center` and `-end` on
74
+ rows, columns, elements and containers. With no class applying in a view, the
75
+ preview shows what the node inherits from its parent or the host's css.
76
+ - The `float` utility plugin: `float-{bp}-start`, `-end` and `-none` on
77
+ elements, with the text of the content area flowing round them.
78
+ - `ge.bareStyle(node, family, property)` on the plugin handle: a property's
79
+ value with the family's classes out of the way, for previews whose "no
80
+ class" is not a constant.
81
+ - `example/autocols.html`.
82
+
83
+ ### Fixed
84
+ - The toolbar's layout icons nested each column inside the one before, since
85
+ jQuery 4 stopped expanding `<div/>`: the icon of `[6, 6]` drew one block.
86
+ - A column's drawer no longer counts towards an auto column's width.
87
+
8
88
  ## [4.1.0] - 2026-09-22
9
89
  ### Added
10
90
  - Utility plugins, a third kind beside containers and features:
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Grid Editor
2
2
  ===========
3
3
 
4
- Grid Editor is a visual javascript editor for the [bootstrap 5 grid system](https://getbootstrap.com/docs/5.3/layout/grid/), written as a [jQuery](http://jquery.com/) plugin. You can create, drag, resize and delete rows and columns, indent them, and give each of bootstrap's six breakpoints its own layout — or edit them all at once, with a mouse or with a finger. It also edits tabs, accordions, popups and cards, and any markup you mark as an element, and it tells your application about every change it makes.
4
+ Grid Editor is a visual javascript editor for the [bootstrap 5 grid system](https://getbootstrap.com/docs/5.3/layout/grid/), written as a [jQuery](http://jquery.com/) plugin. You can create, drag, resize and delete rows and columns — sized in units, equal (`col`) or to their content (`col-auto`), or shared out by their row (`row-cols-*`) — indent them, group them in sections (`.container`), copy and paste them, and give each of bootstrap's six breakpoints its own layout — or edit them all at once, with a mouse or with a finger. Bootstrap's responsive utilities — visibility, order, alignment, gutters, spacing, text alignment and float — are edited per breakpoint too. It also edits tabs, accordions, popups and cards, and any markup you mark as an element, and it tells your application about every change it makes.
5
5
 
6
6
  This is a fork of [Friendly-Pixel/grid-editor](https://github.com/Friendly-Pixel/grid-editor)
7
7
  by Simon Epskamp, carrying it on from 2.x. It is published as
@@ -30,10 +30,12 @@ from any web server, or from GitHub Pages, with no build step.
30
30
  | [example/plugins.html](example/plugins.html) | The plugin model, with one written in the page itself | [live](https://themarioga.github.io/grid-editor/example/plugins.html) |
31
31
  | [example/containers.html](example/containers.html) | Tabs, accordions, popups and cards, two levels deep | [live](https://themarioga.github.io/grid-editor/example/containers.html) |
32
32
  | [example/elements.html](example/elements.html) | Element level controls, including an element with no visual output | [live](https://themarioga.github.io/grid-editor/example/elements.html) |
33
+ | [example/autocols.html](example/autocols.html) | Equal and auto columns, columns per row, and sections | [live](https://themarioga.github.io/grid-editor/example/autocols.html) |
33
34
  | [example/utilities.html](example/utilities.html) | Bootstrap's responsive utilities, edited per breakpoint | [live](https://themarioga.github.io/grid-editor/example/utilities.html) |
34
35
  | [example/locale.html](example/locale.html) | The interface in Spanish, with a language switcher | [live](https://themarioga.github.io/grid-editor/example/locale.html) |
35
36
  | [example/ckeditor.html](example/ckeditor.html) | CKEditor instead of tinyMCE | [live](https://themarioga.github.io/grid-editor/example/ckeditor.html) |
36
37
  | [example/summernote.html](example/summernote.html) | Summernote instead of tinyMCE | [live](https://themarioga.github.io/grid-editor/example/summernote.html) |
38
+ | [example/clipboard.html](example/clipboard.html) | Copy and paste, within an editor, between two, and between tabs | [live](https://themarioga.github.io/grid-editor/example/clipboard.html) |
37
39
  | [example/wrap_content.html](example/wrap_content.html) | Non-bootstrap markup wrapped into the grid | [live](https://themarioga.github.io/grid-editor/example/wrap_content.html) |
38
40
  | [example/autosave.html](example/autosave.html) | Saving the html as the user edits | [live](https://themarioga.github.io/grid-editor/example/autosave.html) |
39
41
 
@@ -75,8 +77,25 @@ $('#myGrid').gridEditor({
75
77
  });
76
78
  // Call this to get the result after the user has done some editing:
77
79
  var html = $('#myGrid').gridEditor('getHtml');
80
+
81
+ // Or, for a page that only publishes the result and never edits it again:
82
+ var published = $('#myGrid').gridEditor('getPlainHtml');
78
83
  ```
79
84
 
85
+ `getHtml` keeps a little of the editor's own marking: the `column` class, the
86
+ `div.ge-content` around each column's content, and the `ge-*` classes and
87
+ `data-ge-*` attributes that say which rich text editor a content area uses and
88
+ which parts are elements, tabs, accordions or popups. That marking is how the
89
+ editor reads its markup back, so **save `getHtml`** for anything that will be
90
+ edited again.
91
+
92
+ `getPlainHtml` is the same markup with that marking taken off, and each
93
+ `div.ge-content` replaced by what it holds. Bootstrap's own classes and
94
+ attributes stay, so tabs, accordions and popups still work in a page that
95
+ never loads grid-editor. It is a one-way export: loaded back into the editor,
96
+ the rows, columns and text come back, but containers and elements are plain
97
+ markup and the content areas lose their rich text editor.
98
+
80
99
  Methods
81
100
  -------
82
101
 
@@ -87,16 +106,18 @@ $('#myGrid').gridEditor('method', argument);
87
106
  | Method | Arguments | Returns | What it does |
88
107
  | --- | --- | --- | --- |
89
108
  | `getHtml` | — | `String` | The clean html: no drawers, no editor classes, no inline styles |
109
+ | `getPlainHtml` | — | `String` | `getHtml` without grid-editor's marking (`ge-*`, `column`, `data-ge-*`), for publishing. It cannot be edited again as it was |
90
110
  | `init` | — | `this` | Run the editing pass over the canvas again. Safe to call after you inject markup |
91
111
  | `deinit` | — | `this` | Strip the editing furniture, leave the markup |
92
112
  | `reset` | — | `this` | `deinit()` then `init()` |
93
113
  | `destroy` | — | `this` | Deinit, drop the controls, unbind, forget the instance |
94
114
  | `remove` | — | `this` | Deprecated alias of `destroy` |
95
- | `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once |
115
+ | `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once, with one class |
96
116
  | `getView` | — | `String` | The view the editor is in |
97
117
  | `setLocale` | `code` | `this` | Switch language and re-render the controls |
98
- | `createRow` | `layout?`, `options?` | `jQuery` | A row, optionally with columns: `createRow([8, 4])` |
99
- | `createColumn` | `size`, `options?` | `jQuery` | A column. `options`: `offset`, `content` |
118
+ | `createRow` | `layout?`, `options?` | `jQuery` | A row, optionally with columns: `createRow([8, 4])`, `createRow(['auto', 'equal'])`, `createRow({ row_cols: { xs: 1, md: 3 }, columns: 6 })` |
119
+ | `createColumn` | `size`, `options?` | `jQuery` | A column: units, `'equal'` or `'auto'`; no size into a row with row-cols takes the row's share. `options`: `offset`, `content` |
120
+ | `createSection` | `options?` | `jQuery` | A section, with the sections plugin. `options`: `width` (`'fixed'`, `'fluid'` or a breakpoint), `rows` (layouts), and a placement |
100
121
  | `createElement` | `content`, `options?` | `jQuery` | Host markup wrapped as an element. `options`: `type`, `label` |
101
122
  | `createContainer` | `type`, `options?` | `jQuery` | `'tabs'`, `'accordion'` or `'popup'` |
102
123
  | `addTab` | `container`, `options?` | `jQuery` | Appends a tab, returns its pane |
@@ -105,8 +126,9 @@ $('#myGrid').gridEditor('method', argument);
105
126
  | `setUtility` | `node`, `family`, `value`, `view?` | `Boolean` | Write it through the events; `null` is inherit. `false` if canceled or nothing changed |
106
127
 
107
128
  A method called on an element with no editor on it is a no-op that returns the
108
- set, so host code does not have to check first. `getHtml` is the exception: it
109
- returns the element's html either way.
129
+ set, so host code does not have to check first. `getHtml` and `getPlainHtml`
130
+ are the exception: they return the element's html either way, and
131
+ `getPlainHtml` cleans it.
110
132
 
111
133
  The `create*` methods hand back the node they made rather than the jQuery set,
112
134
  because you need the node. It comes back **detached**: place it and call
@@ -184,14 +206,44 @@ Options
184
206
 
185
207
  ### General options
186
208
 
187
- __`new_row_layouts`:__ Set the column layouts that appear in the "new row" buttons at the top of the editor.
209
+ __`new_row_layouts`:__ Set the column layouts that appear in the "new row" buttons at the top of the editor. A size is a number of units, `'equal'` (Bootstrap's `col`, sharing what the row has left) or `'auto'` (`col-auto`, as wide as its content).
188
210
 
189
211
  ```javascript
190
212
  $('#myGrid').gridEditor({
191
- new_row_layouts: [[12], [6,6], [9,3]],
213
+ new_row_layouts: [[12], [6,6], [9,3], ['auto', 'equal'], { row_cols: { xs: 1, md: 3 }, columns: 6 }],
192
214
  });
193
215
  ```
194
216
 
217
+ A layout can also be a row with columns per row: `{ row_cols: { xs: 1, md: 3 }, columns: 6 }` makes a `row-cols-1 row-cols-md-3` row of six columns with no size of their own.
218
+
219
+ ### Column sizes
220
+
221
+ A column's size at each breakpoint is a number of units, equal or auto:
222
+
223
+ | Size | Class | On the page |
224
+ | --- | --- | --- |
225
+ | `1`–`12` | `col-4`, `col-md-4` | That many twelfths of the row |
226
+ | `'equal'` | `col`, `col-md` | An equal share of what the row has left |
227
+ | `'auto'` | `col-auto`, `col-md-auto` | As wide as its content |
228
+
229
+ The width tools and dragging a column's edge work in units, so they turn an
230
+ equal or auto column into a number, starting from the width it has on the
231
+ canvas. Every size is in the *Width* field of a column's settings panel, in its
232
+ Responsive section, and a change made there is a resize like any other.
233
+
234
+ **Columns per row.** A row's *Columns per row* field writes Bootstrap's
235
+ `row-cols-{bp}-{1–6,auto}`, which gives each column with no size of its own an
236
+ equal share of a line. A column added to such a row takes its share, and the
237
+ width tools take a column out of the share with a size of its own. Which one
238
+ sizes a column at a breakpoint is settled as in Bootstrap's css: the class from
239
+ the wider breakpoint wins, and at one breakpoint `col` loses to `row-cols`,
240
+ which loses to `col-auto` and `col-N`. `row_cols: false` takes the field away.
241
+
242
+ In a breakpoint view a size or an offset is written for that breakpoint. In the
243
+ all view it is written once, as the class with no breakpoint (`col-4`,
244
+ `offset-2`), and the breakpoints' own sizes or offsets are taken off: one value
245
+ for every size. Up to 4.x the all view wrote all six breakpoints instead.
246
+
195
247
  The settings button on a row, a column, a container, a tab, an accordion item
196
248
  or an element opens a panel with two fields: the node's `id`, and its css
197
249
  classes. The classes field shows what your markup put
@@ -272,7 +324,7 @@ $('#myGrid').gridEditor({
272
324
  });
273
325
  ```
274
326
 
275
- __`valid_col_sizes`:__ Specify the column widths that can be selected using the +/- buttons
327
+ __`valid_col_sizes`:__ The column sizes the +/- buttons step through, and that the add column picker and the width field offer. Default `[1, 2, … 12, 'equal', 'auto']`; leave `'equal'` and `'auto'` out and they are not offered, though a column that has one still shows it.
276
328
 
277
329
  ```javascript
278
330
  $('#myGrid').gridEditor({
@@ -331,7 +383,7 @@ $('#myGrid').gridEditor({
331
383
  });
332
384
  ```
333
385
 
334
- __`default_view`:__ The view the editor starts in. Default `'all'`, which writes every breakpoint at once — what a layout that needs no per-device tuning wants.
386
+ __`default_view`:__ The view the editor starts in. Default `'all'`, which writes one class for every breakpoint at once — what a layout that needs no per-device tuning wants.
335
387
 
336
388
  __`resize`:__ Resizing a column by dragging its edge. Defaults:
337
389
 
@@ -392,6 +444,8 @@ a plugin in a file of its own:
392
444
  <script src="grid-editor/dist/plugins/grideditor.alignment.min.js"></script>
393
445
  <script src="grid-editor/dist/plugins/grideditor.gutters.min.js"></script>
394
446
  <script src="grid-editor/dist/plugins/grideditor.spacing.min.js"></script>
447
+ <script src="grid-editor/dist/plugins/grideditor.textalign.min.js"></script>
448
+ <script src="grid-editor/dist/plugins/grideditor.float.min.js"></script> <!-- after grideditor.elements -->
395
449
  ```
396
450
 
397
451
  | Plugin | Classes | On |
@@ -401,6 +455,8 @@ a plugin in a file of its own:
401
455
  | `alignment` | `justify-content-{bp}-*`, `align-items-{bp}-*`; `align-self-{bp}-*` | rows; columns |
402
456
  | `gutters` | `g-{bp}-{0–5}`, `gx-{bp}-*`, `gy-{bp}-*` | rows |
403
457
  | `spacing` | `{p,m}{,x,y,t,b,s,e}-{bp}-{0–5}`, and `auto` for margin | rows, columns, elements, containers |
458
+ | `textalign` | `text-{bp}-start`, `-center`, `-end` | rows, columns, elements, containers |
459
+ | `float` | `float-{bp}-start`, `-end`, `-none` | elements |
404
460
 
405
461
  A plugin puts a field in the *Responsive* section of each drawer's settings
406
462
  panel, and some add a tool to the drawer. In a breakpoint view a change is
@@ -430,6 +486,71 @@ $('#myGrid').gridEditor({
430
486
  See [example/utilities.html](example/utilities.html), and
431
487
  [docs/plugins.md](docs/plugins.md#utility-plugins) for writing one.
432
488
 
489
+ ### Sections
490
+
491
+ Bootstrap's `.container`, `.container-fluid` and `.container-{bp}` on the
492
+ canvas, each grouping rows at a width of its own. A plugin, since many pages
493
+ put the whole canvas in a `.container` already:
494
+
495
+ ```html
496
+ <script src="grid-editor/dist/plugins/grideditor.sections.min.js"></script>
497
+ ```
498
+
499
+ A container that is a child of the canvas is a section, and gets a drawer:
500
+ move, settings - with a *Width* field for the seven kinds of container - add
501
+ row and delete. The toolbar gets a *Section* button. Rows drag in and out of
502
+ sections, and sections drag along the canvas but not into a column. In a
503
+ breakpoint view each section is as wide as its container would be at that
504
+ breakpoint. They are called sections, not containers, because a container is
505
+ what the tabs, accordion, popup and card plugins make.
506
+
507
+ ```javascript
508
+ $('#myGrid').gridEditor('createSection', { width: 'md', rows: [[6, 6]], appendTo: '#myGrid' });
509
+ ```
510
+
511
+ __`sections`:__ `{ widths: ['fixed', 'sm', 'md', 'lg', 'xl', 'xxl', 'fluid'] }`, the widths the field offers.
512
+
513
+ ### Copy and paste
514
+
515
+ A plugin:
516
+
517
+ ```html
518
+ <script src="grid-editor/dist/plugins/grideditor.clipboard.min.js"></script>
519
+ ```
520
+
521
+ Every row, column, section, container and element gets a *Copy* tool in its
522
+ drawer. While something is copied, a *Paste* tool shows wherever it can go, and
523
+ nowhere else:
524
+
525
+ | Copied | Pasted into |
526
+ | --- | --- |
527
+ | a row | a column, a section, or the canvas from the toolbar's *Paste row* |
528
+ | a column | a row |
529
+ | a section | the canvas, from the toolbar's *Paste section* |
530
+ | a container (tabs, accordion, popup, card) | a column |
531
+ | an element | a column's content area |
532
+
533
+ A paste goes at the end of where it was pasted; the toolbar's buttons can also
534
+ be dragged to where the copy should land. Tabs and accordion items are not
535
+ copied on their own: copy their container.
536
+
537
+ What is copied is kept in `localStorage`, so it can be pasted in another
538
+ editor on the page, after a reload, or in another tab of the same site. A
539
+ browser that denies the page its storage keeps it in memory, for the page. An
540
+ editor that does not load the plugin a copy needs - a section without the
541
+ sections plugin, tabs without the tabs plugin - offers no paste for it.
542
+
543
+ The copy is what `getHtml` would give for that node. When it is pasted, any id
544
+ it carries that the page already has is renamed - `ge-tab-…` ids get new
545
+ generated ones, the host's own get a suffix, `hero` becoming `hero-2` - and
546
+ whatever inside the copy pointed at the old id (`data-bs-target`,
547
+ `data-bs-parent`, `href="#…"`, `aria-*`, a popup's trigger) points at the new
548
+ one. So the tabs of a copy open the copy's panes, not the original's.
549
+
550
+ A paste is an add like any other: `before-add-*` and `after-add-*` with
551
+ `source: 'paste'`, and canceling the first turns it away. A copy fires
552
+ `grideditor:after-copy`.
553
+
433
554
  ### Containers
434
555
 
435
556
  Tabs, accordions, popups and cards. A tabs, accordion or popup container holds
package/UPGRADING.md CHANGED
@@ -1,3 +1,58 @@
1
+ Upgrading from grid-editor `4.*` to `5.*`
2
+ =========================================
3
+
4
+ One change makes it a major: **the all view writes one class.** Everything
5
+ else in 5.0 is new, and a page that uses none of it edits as it did.
6
+
7
+ * __A size or an offset set in the all view is the class with no breakpoint.__
8
+ Up to 4.x the all view wrote all six breakpoints; 5.0 writes the base class
9
+ and takes the breakpoints' own sizes or offsets off, as the utilities have
10
+ done since 4.1. The markup means the same on the page and is shorter:
11
+
12
+ ```html
13
+ <!-- 4.x, after "narrower" on a col-lg-6 column in the all view -->
14
+ <div class="col-5 col-sm-5 col-md-5 col-lg-5 col-xl-5 col-xxl-5">
15
+
16
+ <!-- 5.0, the same click -->
17
+ <div class="col-5">
18
+ ```
19
+
20
+ Reading has not changed: markup with the six classes written out is read as
21
+ before, and the first change made in the all view simplifies it. What to do:
22
+ nothing, unless you compare or post-process the html the editor saves and
23
+ expect six classes. A breakpoint view still writes its own breakpoint alone.
24
+
25
+ * __Resize and indent payloads carry `cleared` in the all view__, with what the
26
+ write took off each breakpoint: `[{ breakpoint: 'lg', value: 6 }]`. A
27
+ listener that checks the payload's keys exactly will see one more.
28
+
29
+ * __A resize's `from` and `to` can be `'equal'` or `'auto'`__ - Bootstrap's
30
+ `col` and `col-auto` - and `from` is `null` for a column its row sizes with
31
+ `row-cols`. `source` can be `panel`, for a width chosen in a column's
32
+ settings panel. A listener that does arithmetic on them should check
33
+ `typeof size === 'number'` first. These only happen on columns that use the
34
+ new sizes.
35
+
36
+ * __`valid_col_sizes` has two more values by default__, `'equal'` and `'auto'`,
37
+ which the add column picker and the width field offer. A host that sets its
38
+ own list keeps it; one that wants the 4.x picker sets
39
+ `valid_col_sizes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]`.
40
+
41
+ * __Every column's settings panel has a Width field, and every row's a Columns
42
+ per row field__, in the Responsive section, which is folded until the user
43
+ opens it. `row_cols: false` takes the row field away.
44
+
45
+ * __Columns with `col`, `col-auto`, or in a row with `row-cols-*` are no longer
46
+ given a `col-12`.__ In 4.x a column with only `col` was not a column at all,
47
+ and one with `col-auto` got a `col-12` that overrode it; both now edit as
48
+ Bootstrap renders them. A page that relied on the `col-12` gets the layout
49
+ its classes describe instead.
50
+
51
+ New and opt-in, so nothing to do: the `sections` plugin for Bootstrap's
52
+ containers, and the feature hooks it is built on (`blocks`, `regions`,
53
+ `accepts`, `toolbar`). See the [CHANGELOG](CHANGELOG.md) for the full list.
54
+
55
+
1
56
  Upgrading from grid-editor `3.*` to `4.*`
2
57
  =========================================
3
58