@themarioga/grid-editor 4.0.0 → 5.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/CHANGELOG.md +95 -0
- package/README.md +121 -9
- package/UPGRADING.md +55 -0
- package/dist/grideditor.css +609 -0
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/jquery.grideditor.bundle.min.js +2 -2
- package/dist/jquery.grideditor.js +1189 -118
- package/dist/jquery.grideditor.min.js +1 -1
- package/dist/jquery.grideditor.min.js.map +1 -1
- package/dist/locales/grideditor.es.js +58 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +1 -1
- package/dist/plugins/grideditor.alignment.js +81 -0
- package/dist/plugins/grideditor.alignment.min.js +2 -0
- package/dist/plugins/grideditor.alignment.min.js.map +1 -0
- package/dist/plugins/grideditor.float.js +56 -0
- package/dist/plugins/grideditor.float.min.js +2 -0
- package/dist/plugins/grideditor.float.min.js.map +1 -0
- package/dist/plugins/grideditor.gutters.js +145 -0
- package/dist/plugins/grideditor.gutters.min.js +2 -0
- package/dist/plugins/grideditor.gutters.min.js.map +1 -0
- package/dist/plugins/grideditor.order.js +206 -0
- package/dist/plugins/grideditor.order.min.js +2 -0
- package/dist/plugins/grideditor.order.min.js.map +1 -0
- package/dist/plugins/grideditor.sections.js +199 -0
- package/dist/plugins/grideditor.sections.min.js +2 -0
- package/dist/plugins/grideditor.sections.min.js.map +1 -0
- package/dist/plugins/grideditor.spacing.js +299 -0
- package/dist/plugins/grideditor.spacing.min.js +2 -0
- package/dist/plugins/grideditor.spacing.min.js.map +1 -0
- package/dist/plugins/grideditor.textalign.js +60 -0
- package/dist/plugins/grideditor.textalign.min.js +2 -0
- package/dist/plugins/grideditor.textalign.min.js.map +1 -0
- package/dist/plugins/grideditor.visibility.js +172 -0
- package/dist/plugins/grideditor.visibility.min.js +2 -0
- package/dist/plugins/grideditor.visibility.min.js.map +1 -0
- package/docs/events.md +32 -2
- package/docs/locale-keys.md +88 -1
- package/docs/plugins.md +141 -3
- package/example/autocols.html +137 -0
- package/example/autosave.html +5 -0
- package/example/basic.html +5 -0
- package/example/breakpoints.html +12 -5
- package/example/ckeditor.html +5 -0
- package/example/containers.html +4 -0
- package/example/elements.html +5 -0
- package/example/index.html +38 -1
- package/example/locale.html +5 -0
- package/example/plugins.html +5 -0
- package/example/summernote.html +5 -0
- package/example/utilities.html +166 -0
- package/example/wrap_content.html +5 -0
- package/package.json +1 -1
- package/src/js/jquery.grideditor.js +1190 -119
- package/src/js/locales/grideditor.es.js +58 -0
- package/src/js/plugins/grideditor.alignment.js +81 -0
- package/src/js/plugins/grideditor.float.js +56 -0
- package/src/js/plugins/grideditor.gutters.js +145 -0
- package/src/js/plugins/grideditor.order.js +206 -0
- package/src/js/plugins/grideditor.sections.js +199 -0
- package/src/js/plugins/grideditor.spacing.js +299 -0
- package/src/js/plugins/grideditor.textalign.js +60 -0
- package/src/js/plugins/grideditor.visibility.js +172 -0
- package/src/less/grideditor.less +299 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,101 @@ 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.0.0] - 2026-09-23
|
|
9
|
+
### Changed
|
|
10
|
+
- **The all view writes one class.** A size or an offset set in the all view
|
|
11
|
+
is written as the class with no breakpoint (`col-4`, `offset-2`), and the
|
|
12
|
+
breakpoints' own sizes or offsets are taken off, as the utilities have done
|
|
13
|
+
since 4.1. Up to 4.x it wrote all six breakpoints. The resize and indent
|
|
14
|
+
payloads carry `cleared`, with what was taken off.
|
|
15
|
+
- Resize payloads' `from` and `to` can be `'equal'` or `'auto'`, `from` is
|
|
16
|
+
`null` for a column its row sizes, and `source` can be `panel`.
|
|
17
|
+
- `valid_col_sizes` defaults to `[1, … 12, 'equal', 'auto']`.
|
|
18
|
+
- `ge.viewTiers()` returns the one breakpoint a view writes: `xs` in the all
|
|
19
|
+
view.
|
|
20
|
+
|
|
21
|
+
See [UPGRADING.md](UPGRADING.md) for what these mean for a host.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Equal and auto column sizes: Bootstrap's `col` and `col-auto`, at every
|
|
25
|
+
breakpoint. The editor recognises them, previews them in each view, offers
|
|
26
|
+
them in the add column picker and in `new_row_layouts`, `createRow` and
|
|
27
|
+
`createColumn`, and the width tools turn them into a number starting from
|
|
28
|
+
the width the column has. A column with only `col` used to be no column at
|
|
29
|
+
all, and a `col-auto` one was given a `col-12` that overrode it.
|
|
30
|
+
- A *Width* field in each column's Responsive section, with every size.
|
|
31
|
+
- Columns per row: a *Columns per row* field in each row's panel writes
|
|
32
|
+
`row-cols-{bp}-{1–6,auto}`. Columns with no size of their own share the
|
|
33
|
+
line out and are left without a `col-12`; the preview, the budget and the
|
|
34
|
+
tools settle row-cols against each column's own size as Bootstrap's css
|
|
35
|
+
does, and the row says in a corner how many it puts per line. Layouts,
|
|
36
|
+
`createRow` and `createColumn` take rows with row-cols, and `row_cols: false`
|
|
37
|
+
takes the field away.
|
|
38
|
+
- The `sections` plugin: Bootstrap's `.container`, `.container-fluid` and
|
|
39
|
+
`.container-{bp}` as sections on the canvas, grouping rows. Each gets a
|
|
40
|
+
drawer with a width field, the toolbar a *Section* button, and the API
|
|
41
|
+
`createSection`. Rows drag in and out of sections, sections drag along the
|
|
42
|
+
canvas, and a breakpoint view gives each the max-width its container has
|
|
43
|
+
there.
|
|
44
|
+
- Feature plugins can add blocks, regions and toolbar buttons (`blocks`,
|
|
45
|
+
`regions`, `accepts`, `toolbar`), and the handle gains `rowFromLayout`.
|
|
46
|
+
- The `textalign` utility plugin: `text-{bp}-start`, `-center` and `-end` on
|
|
47
|
+
rows, columns, elements and containers. With no class applying in a view, the
|
|
48
|
+
preview shows what the node inherits from its parent or the host's css.
|
|
49
|
+
- The `float` utility plugin: `float-{bp}-start`, `-end` and `-none` on
|
|
50
|
+
elements, with the text of the content area flowing round them.
|
|
51
|
+
- `ge.bareStyle(node, family, property)` on the plugin handle: a property's
|
|
52
|
+
value with the family's classes out of the way, for previews whose "no
|
|
53
|
+
class" is not a constant.
|
|
54
|
+
- `example/autocols.html`.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
- The toolbar's layout icons nested each column inside the one before, since
|
|
58
|
+
jQuery 4 stopped expanding `<div/>`: the icon of `[6, 6]` drew one block.
|
|
59
|
+
- A column's drawer no longer counts towards an auto column's width.
|
|
60
|
+
|
|
61
|
+
## [4.1.0] - 2026-09-22
|
|
62
|
+
### Added
|
|
63
|
+
- Utility plugins, a third kind beside containers and features:
|
|
64
|
+
`$.fn.gridEditor.utilities`. A plugin declares families of Bootstrap's
|
|
65
|
+
responsive utility classes and the editor reads them through the cascade,
|
|
66
|
+
writes them per breakpoint (the all view writes the class with no infix and
|
|
67
|
+
clears the rest), shows them in a folded *Responsive* section of the settings
|
|
68
|
+
panel, and previews them in each breakpoint view. See docs/plugins.md.
|
|
69
|
+
- `getUtility` and `setUtility` methods, and the `utilities` setting for the
|
|
70
|
+
plugins' options.
|
|
71
|
+
- `before-utility`, `after-utility` and `view-change` events. `view-change` is
|
|
72
|
+
new for every host, not only for utility plugins.
|
|
73
|
+
- The plugin handle gains `kindOf`, `view`, `viewTiers`, `breakpoints`,
|
|
74
|
+
`getUtility` and `setUtility`, and a utility plugin may add tools beside any
|
|
75
|
+
drawer's gear and mark the canvas in `onRefresh`.
|
|
76
|
+
- The `visibility` utility plugin: hide a row, column, element or container at
|
|
77
|
+
some breakpoints with `d-{bp}-none` and show it at others. An eye in each
|
|
78
|
+
drawer toggles the view being edited with as few classes as that takes. A
|
|
79
|
+
hidden node stays on the canvas, faded, and in the all view a badge says at
|
|
80
|
+
which breakpoints it is hidden.
|
|
81
|
+
- The `order` utility plugin: a column's place in its row per breakpoint,
|
|
82
|
+
with `order-{bp}-*`. Two arrows in each column drawer move it one place
|
|
83
|
+
earlier or later in the view being edited without moving the markup, and
|
|
84
|
+
take the classes off again once the row is back in the markup's order. A
|
|
85
|
+
column ordered by class says so in a corner of the canvas.
|
|
86
|
+
- The `alignment` utility plugin: `justify-content-{bp}-*` and
|
|
87
|
+
`align-items-{bp}-*` on rows, `align-self-{bp}-*` on columns, as fields in
|
|
88
|
+
the settings panel.
|
|
89
|
+
- The `gutters` utility plugin: `g-{bp}-*`, `gx-{bp}-*` and `gy-{bp}-*` on
|
|
90
|
+
rows. A row with gutter classes is drawn with its real gutters instead of the
|
|
91
|
+
editor's frame, the preview settles `g` against `gx`/`gy` the way Bootstrap's
|
|
92
|
+
css does, and choosing `g` takes that breakpoint's `gx` and `gy` off.
|
|
93
|
+
`utilities.gutters.scale` follows a page that changed `$spacers`.
|
|
94
|
+
- The `spacing` utility plugin: padding and margin on rows, columns, elements
|
|
95
|
+
and containers, `{p,m}{,x,y,t,b,s,e}-{bp}-*`. The panel has a padding and a
|
|
96
|
+
margin group, each a side and a value, and the preview settles the fourteen
|
|
97
|
+
families the way Bootstrap's css does. `utilities.spacing.values` and
|
|
98
|
+
`.scale` narrow the steps and follow a changed `$spacers`.
|
|
99
|
+
- A utility plugin can build its own panel (`panel`, `ge.utilityField`,
|
|
100
|
+
families with `panel: false`) and preview a node as a whole (`preview`).
|
|
101
|
+
- `example/utilities.html`.
|
|
102
|
+
|
|
8
103
|
## [4.0.0] - 2026-09-22
|
|
9
104
|
### Added
|
|
10
105
|
- Editing from a touchscreen. Sorting, resizing a column and carrying a toolbar
|
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`), 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,6 +30,8 @@ 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) |
|
|
34
|
+
| [example/utilities.html](example/utilities.html) | Bootstrap's responsive utilities, edited per breakpoint | [live](https://themarioga.github.io/grid-editor/example/utilities.html) |
|
|
33
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) |
|
|
34
36
|
| [example/ckeditor.html](example/ckeditor.html) | CKEditor instead of tinyMCE | [live](https://themarioga.github.io/grid-editor/example/ckeditor.html) |
|
|
35
37
|
| [example/summernote.html](example/summernote.html) | Summernote instead of tinyMCE | [live](https://themarioga.github.io/grid-editor/example/summernote.html) |
|
|
@@ -91,15 +93,18 @@ $('#myGrid').gridEditor('method', argument);
|
|
|
91
93
|
| `reset` | — | `this` | `deinit()` then `init()` |
|
|
92
94
|
| `destroy` | — | `this` | Deinit, drop the controls, unbind, forget the instance |
|
|
93
95
|
| `remove` | — | `this` | Deprecated alias of `destroy` |
|
|
94
|
-
| `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once |
|
|
96
|
+
| `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once, with one class |
|
|
95
97
|
| `getView` | — | `String` | The view the editor is in |
|
|
96
98
|
| `setLocale` | `code` | `this` | Switch language and re-render the controls |
|
|
97
|
-
| `createRow` | `layout?`, `options?` | `jQuery` | A row, optionally with columns: `createRow([8, 4])` |
|
|
98
|
-
| `createColumn` | `size`, `options?` | `jQuery` | A column. `options`: `offset`, `content` |
|
|
99
|
+
| `createRow` | `layout?`, `options?` | `jQuery` | A row, optionally with columns: `createRow([8, 4])`, `createRow(['auto', 'equal'])`, `createRow({ row_cols: { xs: 1, md: 3 }, columns: 6 })` |
|
|
100
|
+
| `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` |
|
|
101
|
+
| `createSection` | `options?` | `jQuery` | A section, with the sections plugin. `options`: `width` (`'fixed'`, `'fluid'` or a breakpoint), `rows` (layouts), and a placement |
|
|
99
102
|
| `createElement` | `content`, `options?` | `jQuery` | Host markup wrapped as an element. `options`: `type`, `label` |
|
|
100
103
|
| `createContainer` | `type`, `options?` | `jQuery` | `'tabs'`, `'accordion'` or `'popup'` |
|
|
101
104
|
| `addTab` | `container`, `options?` | `jQuery` | Appends a tab, returns its pane |
|
|
102
105
|
| `addAccordionItem` | `container`, `options?` | `jQuery` | Appends an item, returns its body |
|
|
106
|
+
| `getUtility` | `node`, `family`, `view?` | `String` | A utility plugin's value on a node in a view (the current one by default), or `null` |
|
|
107
|
+
| `setUtility` | `node`, `family`, `value`, `view?` | `Boolean` | Write it through the events; `null` is inherit. `false` if canceled or nothing changed |
|
|
103
108
|
|
|
104
109
|
A method called on an element with no editor on it is a no-op that returns the
|
|
105
110
|
set, so host code does not have to check first. `getHtml` is the exception: it
|
|
@@ -181,14 +186,44 @@ Options
|
|
|
181
186
|
|
|
182
187
|
### General options
|
|
183
188
|
|
|
184
|
-
__`new_row_layouts`:__ Set the column layouts that appear in the "new row" buttons at the top of the editor.
|
|
189
|
+
__`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).
|
|
185
190
|
|
|
186
191
|
```javascript
|
|
187
192
|
$('#myGrid').gridEditor({
|
|
188
|
-
new_row_layouts: [[12], [6,6], [9,3]],
|
|
193
|
+
new_row_layouts: [[12], [6,6], [9,3], ['auto', 'equal'], { row_cols: { xs: 1, md: 3 }, columns: 6 }],
|
|
189
194
|
});
|
|
190
195
|
```
|
|
191
196
|
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
### Column sizes
|
|
200
|
+
|
|
201
|
+
A column's size at each breakpoint is a number of units, equal or auto:
|
|
202
|
+
|
|
203
|
+
| Size | Class | On the page |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| `1`–`12` | `col-4`, `col-md-4` | That many twelfths of the row |
|
|
206
|
+
| `'equal'` | `col`, `col-md` | An equal share of what the row has left |
|
|
207
|
+
| `'auto'` | `col-auto`, `col-md-auto` | As wide as its content |
|
|
208
|
+
|
|
209
|
+
The width tools and dragging a column's edge work in units, so they turn an
|
|
210
|
+
equal or auto column into a number, starting from the width it has on the
|
|
211
|
+
canvas. Every size is in the *Width* field of a column's settings panel, in its
|
|
212
|
+
Responsive section, and a change made there is a resize like any other.
|
|
213
|
+
|
|
214
|
+
**Columns per row.** A row's *Columns per row* field writes Bootstrap's
|
|
215
|
+
`row-cols-{bp}-{1–6,auto}`, which gives each column with no size of its own an
|
|
216
|
+
equal share of a line. A column added to such a row takes its share, and the
|
|
217
|
+
width tools take a column out of the share with a size of its own. Which one
|
|
218
|
+
sizes a column at a breakpoint is settled as in Bootstrap's css: the class from
|
|
219
|
+
the wider breakpoint wins, and at one breakpoint `col` loses to `row-cols`,
|
|
220
|
+
which loses to `col-auto` and `col-N`. `row_cols: false` takes the field away.
|
|
221
|
+
|
|
222
|
+
In a breakpoint view a size or an offset is written for that breakpoint. In the
|
|
223
|
+
all view it is written once, as the class with no breakpoint (`col-4`,
|
|
224
|
+
`offset-2`), and the breakpoints' own sizes or offsets are taken off: one value
|
|
225
|
+
for every size. Up to 4.x the all view wrote all six breakpoints instead.
|
|
226
|
+
|
|
192
227
|
The settings button on a row, a column, a container, a tab, an accordion item
|
|
193
228
|
or an element opens a panel with two fields: the node's `id`, and its css
|
|
194
229
|
classes. The classes field shows what your markup put
|
|
@@ -269,7 +304,7 @@ $('#myGrid').gridEditor({
|
|
|
269
304
|
});
|
|
270
305
|
```
|
|
271
306
|
|
|
272
|
-
__`valid_col_sizes`:__
|
|
307
|
+
__`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.
|
|
273
308
|
|
|
274
309
|
```javascript
|
|
275
310
|
$('#myGrid').gridEditor({
|
|
@@ -328,7 +363,7 @@ $('#myGrid').gridEditor({
|
|
|
328
363
|
});
|
|
329
364
|
```
|
|
330
365
|
|
|
331
|
-
__`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.
|
|
366
|
+
__`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.
|
|
332
367
|
|
|
333
368
|
__`resize`:__ Resizing a column by dragging its edge. Defaults:
|
|
334
369
|
|
|
@@ -378,6 +413,83 @@ __`element_tools`:__ Extra tools on every element drawer, same shape as `row_too
|
|
|
378
413
|
See [example/elements.html](example/elements.html), which also shows the
|
|
379
414
|
pattern for an element with no visual output of its own.
|
|
380
415
|
|
|
416
|
+
### Responsive utilities
|
|
417
|
+
|
|
418
|
+
Bootstrap's responsive utility classes, edited per breakpoint. Each family is
|
|
419
|
+
a plugin in a file of its own:
|
|
420
|
+
|
|
421
|
+
```html
|
|
422
|
+
<script src="grid-editor/dist/plugins/grideditor.visibility.min.js"></script>
|
|
423
|
+
<script src="grid-editor/dist/plugins/grideditor.order.min.js"></script>
|
|
424
|
+
<script src="grid-editor/dist/plugins/grideditor.alignment.min.js"></script>
|
|
425
|
+
<script src="grid-editor/dist/plugins/grideditor.gutters.min.js"></script>
|
|
426
|
+
<script src="grid-editor/dist/plugins/grideditor.spacing.min.js"></script>
|
|
427
|
+
<script src="grid-editor/dist/plugins/grideditor.textalign.min.js"></script>
|
|
428
|
+
<script src="grid-editor/dist/plugins/grideditor.float.min.js"></script> <!-- after grideditor.elements -->
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
| Plugin | Classes | On |
|
|
432
|
+
| --- | --- | --- |
|
|
433
|
+
| `visibility` | `d-{bp}-none`, `d-{bp}-block`, `d-{bp}-flex` | rows, columns, elements, containers |
|
|
434
|
+
| `order` | `order-{bp}-{first,0–5,last}` | columns |
|
|
435
|
+
| `alignment` | `justify-content-{bp}-*`, `align-items-{bp}-*`; `align-self-{bp}-*` | rows; columns |
|
|
436
|
+
| `gutters` | `g-{bp}-{0–5}`, `gx-{bp}-*`, `gy-{bp}-*` | rows |
|
|
437
|
+
| `spacing` | `{p,m}{,x,y,t,b,s,e}-{bp}-{0–5}`, and `auto` for margin | rows, columns, elements, containers |
|
|
438
|
+
| `textalign` | `text-{bp}-start`, `-center`, `-end` | rows, columns, elements, containers |
|
|
439
|
+
| `float` | `float-{bp}-start`, `-end`, `-none` | elements |
|
|
440
|
+
|
|
441
|
+
A plugin puts a field in the *Responsive* section of each drawer's settings
|
|
442
|
+
panel, and some add a tool to the drawer. In a breakpoint view a change is
|
|
443
|
+
written for that breakpoint alone, and the field says what it inherits and from
|
|
444
|
+
where. In the all view it is written once, as the class with no breakpoint, and
|
|
445
|
+
replaces what the breakpoints said. While you edit, the canvas shows what the
|
|
446
|
+
classes mean in the view you are in; `getHtml` returns only the classes.
|
|
447
|
+
|
|
448
|
+
```javascript
|
|
449
|
+
$('#myGrid').gridEditor('setUtility', column, 'visibility', 'none', 'md'); // d-md-none
|
|
450
|
+
$('#myGrid').gridEditor('getUtility', column, 'visibility', 'lg'); // 'none', inherited
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
__`utilities`:__ Options for each plugin, under its name.
|
|
454
|
+
|
|
455
|
+
```javascript
|
|
456
|
+
$('#myGrid').gridEditor({
|
|
457
|
+
utilities: {
|
|
458
|
+
visibility: { drawer: false }, // no eye in the drawers, the field only
|
|
459
|
+
order: { drawer: false }, // no arrows in the column drawers
|
|
460
|
+
gutters: { scale: ['0', '.25rem', '.5rem', '1rem', '1.5rem', '3rem'] }, // if you changed $spacers
|
|
461
|
+
spacing: { values: ['0', '2', '4'], scale: [/* the same */] }, // offer fewer steps
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
See [example/utilities.html](example/utilities.html), and
|
|
467
|
+
[docs/plugins.md](docs/plugins.md#utility-plugins) for writing one.
|
|
468
|
+
|
|
469
|
+
### Sections
|
|
470
|
+
|
|
471
|
+
Bootstrap's `.container`, `.container-fluid` and `.container-{bp}` on the
|
|
472
|
+
canvas, each grouping rows at a width of its own. A plugin, since many pages
|
|
473
|
+
put the whole canvas in a `.container` already:
|
|
474
|
+
|
|
475
|
+
```html
|
|
476
|
+
<script src="grid-editor/dist/plugins/grideditor.sections.min.js"></script>
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
A container that is a child of the canvas is a section, and gets a drawer:
|
|
480
|
+
move, settings - with a *Width* field for the seven kinds of container - add
|
|
481
|
+
row and delete. The toolbar gets a *Section* button. Rows drag in and out of
|
|
482
|
+
sections, and sections drag along the canvas but not into a column. In a
|
|
483
|
+
breakpoint view each section is as wide as its container would be at that
|
|
484
|
+
breakpoint. They are called sections, not containers, because a container is
|
|
485
|
+
what the tabs, accordion, popup and card plugins make.
|
|
486
|
+
|
|
487
|
+
```javascript
|
|
488
|
+
$('#myGrid').gridEditor('createSection', { width: 'md', rows: [[6, 6]], appendTo: '#myGrid' });
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
__`sections`:__ `{ widths: ['fixed', 'sm', 'md', 'lg', 'xl', 'xxl', 'fluid'] }`, the widths the field offers.
|
|
492
|
+
|
|
381
493
|
### Containers
|
|
382
494
|
|
|
383
495
|
Tabs, accordions, popups and cards. A tabs, accordion or popup container holds
|
|
@@ -399,7 +511,7 @@ it available:
|
|
|
399
511
|
The toolbar offers a button per loaded plugin. See [docs/plugins.md](docs/plugins.md)
|
|
400
512
|
for the contract, and for writing one of your own.
|
|
401
513
|
|
|
402
|
-
__`plugins`:__ Which of the loaded plugins to use, containers and
|
|
514
|
+
__`plugins`:__ Which of the loaded plugins to use, containers, features and utilities alike. Every one by default; name them to use fewer than the page loaded.
|
|
403
515
|
|
|
404
516
|
```javascript
|
|
405
517
|
$('#myGrid').gridEditor({ plugins: ['tabs', 'elements'] });
|
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
|
|