@themarioga/grid-editor 8.3.0 → 8.5.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 +40 -0
- package/README.md +43 -1
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +49 -0
- package/dist/grideditor.d.ts +21 -1
- package/dist/grideditor.esm.js +211 -9
- package/dist/grideditor.js +211 -9
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +4 -0
- package/dist/locales/grideditor.es.js +4 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.ckeditor.esm.js +1 -0
- package/dist/plugins/grideditor.ckeditor.js +1 -0
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +2 -2
- package/dist/plugins/grideditor.elements.esm.js +72 -1
- package/dist/plugins/grideditor.elements.js +72 -1
- package/dist/plugins/grideditor.elements.min.js +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +3 -3
- package/dist/plugins/grideditor.sections.esm.js +1 -0
- package/dist/plugins/grideditor.sections.js +1 -0
- package/dist/plugins/grideditor.sections.min.js +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.summernote.esm.js +1 -0
- package/dist/plugins/grideditor.summernote.js +1 -0
- package/dist/plugins/grideditor.summernote.min.js +1 -1
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tinymce.esm.js +1 -0
- package/dist/plugins/grideditor.tinymce.js +1 -0
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +2 -2
- package/docs/locale-keys.md +5 -1
- package/docs/plugins.md +24 -1
- package/package.json +1 -1
- package/src/js/grideditor.js +252 -8
- package/src/js/locales/grideditor.es.js +4 -0
- package/src/js/plugins/grideditor.elements.js +94 -1
- package/src/js/plugins/grideditor.sections.js +1 -0
- package/src/js/text/grideditor.text.js +1 -0
- package/src/less/grideditor.less +58 -0
- package/types/grideditor.d.ts +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,46 @@ 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
|
+
## [8.5.0] - 2026-10-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `elements.types`: the elements the toolbar offers, a button each. A type
|
|
12
|
+
has its `type`, its `html` - a string, or a function called for each one
|
|
13
|
+
made - a `label` or `labelKey`, an `iconClass` and a `group`. A button
|
|
14
|
+
makes the html's root, marked with `data-ge-element` and `data-ge-label`
|
|
15
|
+
the way a host marks its own elements, or a `div` around html with no
|
|
16
|
+
single root. Declaring a type turns `enabled: 'auto'` on.
|
|
17
|
+
- `toolbar_groups`: a third core category, *Elements*, after *Content*. The
|
|
18
|
+
element buttons go there unless they name another `group`.
|
|
19
|
+
- A feature plugin's `toolbar` item whose `create()` returns `null` adds
|
|
20
|
+
nothing, rather than failing.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- `toolbar_groups`: the *Text* buttons are in *Elements* now, not in
|
|
24
|
+
*Content*, which keeps the containers and the sections.
|
|
25
|
+
|
|
26
|
+
## [8.4.0] - 2026-10-01
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- `drawer_overflow`: the drawers of rows, columns, containers, elements and
|
|
30
|
+
sections keep their tools to one line. The tools that don't fit are hidden
|
|
31
|
+
from the end, behind a `⋯` tool that unfolds the drawer to show them all,
|
|
32
|
+
and come back when there is room. `'wrap'` keeps the old behaviour.
|
|
33
|
+
- `toolbar_groups`: with `true`, the toolbar's add buttons are sorted into
|
|
34
|
+
categories, with tabs at the start of the toolbar choosing which one shows:
|
|
35
|
+
*Rows* and *Content* from the core, and a plugin's own. A `toolbar` item or
|
|
36
|
+
a container names its category with `group`; one that names none has its
|
|
37
|
+
plugin's. The label is the `group.<name>` locale string. Off by default.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- `active_target`: a click again on the target's own background or on its
|
|
41
|
+
drawer, away from its tools, clears it. A click on what it holds - a text,
|
|
42
|
+
a tool, a nested column - works as before.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
- `toolbar_overflow`: squeezed, the toolbar's buttons wrapped their labels
|
|
46
|
+
onto a second line instead of going behind the more button.
|
|
47
|
+
|
|
8
48
|
## [8.3.0] - 2026-10-01
|
|
9
49
|
|
|
10
50
|
### Added
|
package/README.md
CHANGED
|
@@ -371,7 +371,23 @@ new GridEditor('#myGrid', {
|
|
|
371
371
|
});
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
__`
|
|
374
|
+
__`drawer_overflow`:__ The same for the drawers of rows, columns, containers, elements and sections. `'menu'`, the default, keeps a drawer's tools to one line: the ones that don't fit are hidden from the end, behind a `⋯` tool that unfolds the drawer to show them all, and they come back when there is room. They stay in their drawer, so whatever finds a tool there still does. A text's drawer and a pane's are left alone. `'wrap'` lets the drawers wrap onto more lines, as they did before 8.4.
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
new GridEditor('#myGrid', {
|
|
378
|
+
drawer_overflow: 'wrap',
|
|
379
|
+
});
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
__`toolbar_groups`:__ Whether the toolbar's add buttons are sorted into categories, with tabs at the start of the toolbar choosing which one shows. Default `false`. With `true` the core's categories are *Rows*, the add row buttons, *Content*, the containers and the sections, and *Elements*, the texts and the elements of `elements.types`; a plugin's buttons go in the category they name with `group` (see [docs/plugins.md](docs/plugins.md)), or in one of their own. The tab chosen is kept while the editor lives, through `setLocale` too. With a single category there is nothing to choose and no tabs. The buttons on the right - the view, source and preview, paste - are never grouped. The more button of `toolbar_overflow` holds what doesn't fit of the category shown; the tabs themselves never go behind it, so with a great many categories they can run out of room.
|
|
383
|
+
|
|
384
|
+
```javascript
|
|
385
|
+
new GridEditor('#myGrid', {
|
|
386
|
+
toolbar_groups: true,
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
__`active_target`:__ Whether a click in a column or a section makes it where the toolbar's buttons add. Default `false`, and the toolbar adds at the end of the canvas. With `true`, the column or section clicked last - marked with a dashed outline - gets what a button makes at its end, as if the button had been dropped there: a text or a container goes into a column as it is, and into a section in a row of its own; a row goes into a column as a nested row; a section, which only the canvas takes, goes to the canvas just after the block the target is in. The toolbar's paste button pastes there too. Escape, a click in the canvas on no column or section, a click again on the target's own background or drawer (not on a tool or on what it holds), or deleting the target clears it, and the toolbar adds at the end of the canvas again; dragging a button still drops it where it is let go.
|
|
375
391
|
|
|
376
392
|
```javascript
|
|
377
393
|
const ge = new GridEditor('#myGrid', { active_target: true });
|
|
@@ -576,6 +592,32 @@ new GridEditor('#myGrid', {
|
|
|
576
592
|
enabled: 'auto', // on when the page has any; true or false to decide yourself
|
|
577
593
|
selector: '[data-ge-element]', // what counts as an element
|
|
578
594
|
auto: false, // true treats every loose node of a column as one
|
|
595
|
+
types: [], // the elements the toolbar offers, see below
|
|
596
|
+
},
|
|
597
|
+
});
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
__`elements.types`:__ The elements the toolbar offers, a button each, in this order. A click makes one in a row and column of its own at the end of the canvas - or at the end of the active target, with `active_target` - and a drag drops it in the column it lands in, as a text or a container. Declaring a type turns `enabled: 'auto'` on, so the buttons are there on a page with no elements yet; `enabled: false` takes them away too.
|
|
601
|
+
|
|
602
|
+
| Field | | |
|
|
603
|
+
| --- | --- | --- |
|
|
604
|
+
| `type` | required | what it is: its `data-ge-element` |
|
|
605
|
+
| `html` | required | its markup: html, or a function called for each one made, which returns html or a node |
|
|
606
|
+
| `label` / `labelKey` | | the button's label, as it is or as a locale key, which wins and follows `setLocale`. Without either, the `type` |
|
|
607
|
+
| `iconClass` | | the button shows the icon alone, with the label as its title |
|
|
608
|
+
| `group` | | its `toolbar_groups` category. Default `elements` |
|
|
609
|
+
|
|
610
|
+
What a button makes is the html's root, marked the way you mark your own elements - `data-ge-element`, and `data-ge-label` with the label unless the html has one - so `getHtml` gives it back as you would have written it. Html with more than one root, or none, is wrapped in a `div`. A `<script>` in html given as a string does not run. A type with no `type` or no `html` is left off the toolbar, and one whose function throws or gives nothing adds nothing; both with a warning in the console, as is a type whose markup does not match your `elements.selector`.
|
|
611
|
+
|
|
612
|
+
```javascript
|
|
613
|
+
new GridEditor('#myGrid', {
|
|
614
|
+
elements: {
|
|
615
|
+
types: [
|
|
616
|
+
{ type: 'quote', label: 'Pull quote', iconClass: 'bi bi-quote',
|
|
617
|
+
html: '<blockquote class="my-quote"><p>Quote</p></blockquote>' },
|
|
618
|
+
{ type: 'figure', labelKey: 'element.figure', group: 'media',
|
|
619
|
+
html: function() { return '<figure id="fig-' + Date.now() + '"><img src="…"></figure>'; } },
|
|
620
|
+
],
|
|
579
621
|
},
|
|
580
622
|
});
|
|
581
623
|
```
|