@themarioga/grid-editor 8.4.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 +18 -0
- package/README.md +27 -1
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.d.ts +17 -1
- package/dist/grideditor.esm.js +13 -3
- package/dist/grideditor.js +13 -3
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +2 -2
- package/dist/locales/grideditor.es.esm.js +1 -0
- package/dist/locales/grideditor.es.js +1 -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 -1
- package/dist/plugins/grideditor.ckeditor.js +1 -1
- 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.summernote.esm.js +1 -1
- package/dist/plugins/grideditor.summernote.js +1 -1
- 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 -1
- package/dist/plugins/grideditor.tinymce.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +2 -2
- package/docs/locale-keys.md +2 -1
- package/docs/plugins.md +6 -5
- package/package.json +1 -1
- package/src/js/grideditor.js +6 -0
- package/src/js/locales/grideditor.es.js +1 -0
- package/src/js/plugins/grideditor.elements.js +94 -1
- package/src/js/text/grideditor.text.js +1 -1
- package/types/grideditor.d.ts +17 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ 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
|
+
|
|
8
26
|
## [8.4.0] - 2026-10-01
|
|
9
27
|
|
|
10
28
|
### Added
|
package/README.md
CHANGED
|
@@ -379,7 +379,7 @@ new GridEditor('#myGrid', {
|
|
|
379
379
|
});
|
|
380
380
|
```
|
|
381
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,
|
|
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
383
|
|
|
384
384
|
```javascript
|
|
385
385
|
new GridEditor('#myGrid', {
|
|
@@ -592,6 +592,32 @@ new GridEditor('#myGrid', {
|
|
|
592
592
|
enabled: 'auto', // on when the page has any; true or false to decide yourself
|
|
593
593
|
selector: '[data-ge-element]', // what counts as an element
|
|
594
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
|
+
],
|
|
595
621
|
},
|
|
596
622
|
});
|
|
597
623
|
```
|