@themarioga/grid-editor 4.1.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 +53 -0
- package/README.md +68 -8
- package/UPGRADING.md +55 -0
- package/dist/grideditor.css +461 -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 +634 -109
- package/dist/jquery.grideditor.min.js +1 -1
- package/dist/jquery.grideditor.min.js.map +1 -1
- package/dist/locales/grideditor.es.js +26 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +1 -1
- 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.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.textalign.js +60 -0
- package/dist/plugins/grideditor.textalign.min.js +2 -0
- package/dist/plugins/grideditor.textalign.min.js.map +1 -0
- package/docs/events.md +13 -2
- package/docs/locale-keys.md +36 -1
- package/docs/plugins.md +35 -2
- package/example/autocols.html +137 -0
- package/example/breakpoints.html +7 -5
- package/example/index.html +16 -2
- package/example/utilities.html +22 -1
- package/package.json +1 -1
- package/src/js/jquery.grideditor.js +635 -110
- package/src/js/locales/grideditor.es.js +26 -0
- package/src/js/plugins/grideditor.float.js +56 -0
- package/src/js/plugins/grideditor.sections.js +199 -0
- package/src/js/plugins/grideditor.textalign.js +60 -0
- package/src/less/grideditor.less +132 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,59 @@ 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
|
+
|
|
8
61
|
## [4.1.0] - 2026-09-22
|
|
9
62
|
### Added
|
|
10
63
|
- 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`), 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,7 @@ 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) |
|
|
@@ -92,11 +93,12 @@ $('#myGrid').gridEditor('method', argument);
|
|
|
92
93
|
| `reset` | — | `this` | `deinit()` then `init()` |
|
|
93
94
|
| `destroy` | — | `this` | Deinit, drop the controls, unbind, forget the instance |
|
|
94
95
|
| `remove` | — | `this` | Deprecated alias of `destroy` |
|
|
95
|
-
| `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 |
|
|
96
97
|
| `getView` | — | `String` | The view the editor is in |
|
|
97
98
|
| `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` |
|
|
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 |
|
|
100
102
|
| `createElement` | `content`, `options?` | `jQuery` | Host markup wrapped as an element. `options`: `type`, `label` |
|
|
101
103
|
| `createContainer` | `type`, `options?` | `jQuery` | `'tabs'`, `'accordion'` or `'popup'` |
|
|
102
104
|
| `addTab` | `container`, `options?` | `jQuery` | Appends a tab, returns its pane |
|
|
@@ -184,14 +186,44 @@ Options
|
|
|
184
186
|
|
|
185
187
|
### General options
|
|
186
188
|
|
|
187
|
-
__`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).
|
|
188
190
|
|
|
189
191
|
```javascript
|
|
190
192
|
$('#myGrid').gridEditor({
|
|
191
|
-
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 }],
|
|
192
194
|
});
|
|
193
195
|
```
|
|
194
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
|
+
|
|
195
227
|
The settings button on a row, a column, a container, a tab, an accordion item
|
|
196
228
|
or an element opens a panel with two fields: the node's `id`, and its css
|
|
197
229
|
classes. The classes field shows what your markup put
|
|
@@ -272,7 +304,7 @@ $('#myGrid').gridEditor({
|
|
|
272
304
|
});
|
|
273
305
|
```
|
|
274
306
|
|
|
275
|
-
__`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.
|
|
276
308
|
|
|
277
309
|
```javascript
|
|
278
310
|
$('#myGrid').gridEditor({
|
|
@@ -331,7 +363,7 @@ $('#myGrid').gridEditor({
|
|
|
331
363
|
});
|
|
332
364
|
```
|
|
333
365
|
|
|
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.
|
|
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.
|
|
335
367
|
|
|
336
368
|
__`resize`:__ Resizing a column by dragging its edge. Defaults:
|
|
337
369
|
|
|
@@ -392,6 +424,8 @@ a plugin in a file of its own:
|
|
|
392
424
|
<script src="grid-editor/dist/plugins/grideditor.alignment.min.js"></script>
|
|
393
425
|
<script src="grid-editor/dist/plugins/grideditor.gutters.min.js"></script>
|
|
394
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 -->
|
|
395
429
|
```
|
|
396
430
|
|
|
397
431
|
| Plugin | Classes | On |
|
|
@@ -401,6 +435,8 @@ a plugin in a file of its own:
|
|
|
401
435
|
| `alignment` | `justify-content-{bp}-*`, `align-items-{bp}-*`; `align-self-{bp}-*` | rows; columns |
|
|
402
436
|
| `gutters` | `g-{bp}-{0–5}`, `gx-{bp}-*`, `gy-{bp}-*` | rows |
|
|
403
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 |
|
|
404
440
|
|
|
405
441
|
A plugin puts a field in the *Responsive* section of each drawer's settings
|
|
406
442
|
panel, and some add a tool to the drawer. In a breakpoint view a change is
|
|
@@ -430,6 +466,30 @@ $('#myGrid').gridEditor({
|
|
|
430
466
|
See [example/utilities.html](example/utilities.html), and
|
|
431
467
|
[docs/plugins.md](docs/plugins.md#utility-plugins) for writing one.
|
|
432
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
|
+
|
|
433
493
|
### Containers
|
|
434
494
|
|
|
435
495
|
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
|
|