@themarioga/grid-editor 3.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 (52) hide show
  1. package/AUTO_SAVE.md +30 -0
  2. package/BUILDING.md +68 -0
  3. package/CHANGELOG.md +362 -0
  4. package/LICENSE +23 -0
  5. package/README.md +521 -0
  6. package/UPGRADING.md +88 -0
  7. package/dist/grideditor.css +3875 -0
  8. package/dist/grideditor.min.css +2 -0
  9. package/dist/grideditor.min.css.map +1 -0
  10. package/dist/jquery.grideditor.js +2996 -0
  11. package/dist/jquery.grideditor.min.js +2 -0
  12. package/dist/jquery.grideditor.min.js.map +1 -0
  13. package/dist/locales/grideditor.es.js +74 -0
  14. package/dist/locales/grideditor.es.min.js +2 -0
  15. package/dist/locales/grideditor.es.min.js.map +1 -0
  16. package/dist/plugins/grideditor.accordion.js +185 -0
  17. package/dist/plugins/grideditor.accordion.min.js +2 -0
  18. package/dist/plugins/grideditor.accordion.min.js.map +1 -0
  19. package/dist/plugins/grideditor.elements.js +141 -0
  20. package/dist/plugins/grideditor.elements.min.js +2 -0
  21. package/dist/plugins/grideditor.elements.min.js.map +1 -0
  22. package/dist/plugins/grideditor.popup.js +143 -0
  23. package/dist/plugins/grideditor.popup.min.js +2 -0
  24. package/dist/plugins/grideditor.popup.min.js.map +1 -0
  25. package/dist/plugins/grideditor.tabs.js +140 -0
  26. package/dist/plugins/grideditor.tabs.min.js +2 -0
  27. package/dist/plugins/grideditor.tabs.min.js.map +1 -0
  28. package/docs/events.md +158 -0
  29. package/docs/locale-keys.md +140 -0
  30. package/docs/plugins.md +163 -0
  31. package/example/autosave.html +89 -0
  32. package/example/basic.html +93 -0
  33. package/example/breakpoints.html +94 -0
  34. package/example/ckeditor.html +104 -0
  35. package/example/containers.html +214 -0
  36. package/example/elements.html +147 -0
  37. package/example/index.html +119 -0
  38. package/example/locale.html +84 -0
  39. package/example/plugins.html +217 -0
  40. package/example/summernote.html +106 -0
  41. package/example/wrap_content.html +44 -0
  42. package/package.json +66 -0
  43. package/src/js/jquery.grideditor.ckeditor.js +77 -0
  44. package/src/js/jquery.grideditor.js +2711 -0
  45. package/src/js/jquery.grideditor.summernote.js +72 -0
  46. package/src/js/jquery.grideditor.tinymce.js +135 -0
  47. package/src/js/locales/grideditor.es.js +74 -0
  48. package/src/js/plugins/grideditor.accordion.js +185 -0
  49. package/src/js/plugins/grideditor.elements.js +141 -0
  50. package/src/js/plugins/grideditor.popup.js +143 -0
  51. package/src/js/plugins/grideditor.tabs.js +140 -0
  52. package/src/less/grideditor.less +594 -0
package/README.md ADDED
@@ -0,0 +1,521 @@
1
+ Grid Editor
2
+ ===========
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. It also edits tabs, accordions and popups, and any markup you mark as an element, and it tells your application about every change it makes.
5
+
6
+ This is a fork of [Friendly-Pixel/grid-editor](https://github.com/Friendly-Pixel/grid-editor)
7
+ by Simon Epskamp, carrying it on from 2.x. It is published as
8
+ `@themarioga/grid-editor`.
9
+
10
+ (Looking for the __bootstrap 3 support__? Use version 0 in the [bootstrap_3 branch](https://github.com/Friendly-Pixel/grid-editor/tree/bootstrap_3))
11
+
12
+ It provides integration plugins for the following rich text editors to edit column content: TinyMCE, summernote and CKEditor.
13
+
14
+ ![Preview](http://i.imgur.com/UF9CCzk.png)
15
+
16
+ Demos
17
+ -----
18
+
19
+ Every page under `example/` is a working editor, and they are static: served
20
+ from any web server, or from GitHub Pages, with no build step.
21
+ [example/index.html](example/index.html) lists them all.
22
+
23
+ | Demo | What it shows |
24
+ | --- | --- |
25
+ | [example/basic.html](example/basic.html) | The editor with tinyMCE in the content areas |
26
+ | [example/breakpoints.html](example/breakpoints.html) | The six breakpoints and the "all sizes" view |
27
+ | [example/plugins.html](example/plugins.html) | The plugin model, with one written in the page itself |
28
+ | [example/containers.html](example/containers.html) | Tabs, accordions and popups, two levels deep |
29
+ | [example/elements.html](example/elements.html) | Element level controls, including an element with no visual output |
30
+ | [example/locale.html](example/locale.html) | The interface in Spanish, with a language switcher |
31
+ | [example/ckeditor.html](example/ckeditor.html) | CKEditor instead of tinyMCE |
32
+ | [example/summernote.html](example/summernote.html) | Summernote instead of tinyMCE |
33
+ | [example/wrap_content.html](example/wrap_content.html) | Non-bootstrap markup wrapped into the grid |
34
+ | [example/autosave.html](example/autosave.html) | Saving the html as the user edits |
35
+
36
+ Installation
37
+ ------------
38
+
39
+ * __Dependencies:__ Grid Editor depends on jQuery, jQuery UI, Bootstrap Icons, and Bootstrap 5, so make sure you have included those in the page.
40
+ * If you want to use the tinyMCE integration, include tinyMCE 6 as well. The tinyMCE jQuery plugin is no longer needed, and no longer exists as of tinyMCE 6.
41
+ * If you want to use the summernote integration, include summernote as well.
42
+ * If you want to use the CKEditor integration... you get the point.
43
+ * From npm:
44
+
45
+ ```
46
+ npm install @themarioga/grid-editor
47
+ ```
48
+
49
+ * Or [download the latest version of Grid Editor](https://github.com/themarioga/grid-editor/archive/master.zip) and include it in your page:
50
+
51
+ ```html
52
+ <!-- Make sure jQuery, jQuery UI, bootstrap icons, and bootstrap 5 are included. TinyMCE is optional. -->
53
+ <link rel="stylesheet" type="text/css" href="grid-editor/dist/grideditor.min.css" />
54
+ <script src="grid-editor/dist/jquery.grideditor.min.js"></script>
55
+ ```
56
+
57
+ Usage
58
+ -----
59
+ ```javascript
60
+ $('#myGrid').gridEditor({
61
+ new_row_layouts: [[12], [6,6], [9,3]],
62
+ });
63
+ // Call this to get the result after the user has done some editing:
64
+ var html = $('#myGrid').gridEditor('getHtml');
65
+ ```
66
+
67
+ Methods
68
+ -------
69
+
70
+ ```javascript
71
+ $('#myGrid').gridEditor('method', argument);
72
+ ```
73
+
74
+ | Method | Arguments | Returns | What it does |
75
+ | --- | --- | --- | --- |
76
+ | `getHtml` | — | `String` | The clean html: no drawers, no editor classes, no inline styles |
77
+ | `init` | — | `this` | Run the editing pass over the canvas again. Safe to call after you inject markup |
78
+ | `deinit` | — | `this` | Strip the editing furniture, leave the markup |
79
+ | `reset` | — | `this` | `deinit()` then `init()` |
80
+ | `destroy` | — | `this` | Deinit, drop the controls, unbind, forget the instance |
81
+ | `remove` | — | `this` | Deprecated alias of `destroy` |
82
+ | `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once |
83
+ | `getView` | — | `String` | The view the editor is in |
84
+ | `setLocale` | `code` | `this` | Switch language and re-render the controls |
85
+ | `createRow` | `layout?`, `options?` | `jQuery` | A row, optionally with columns: `createRow([8, 4])` |
86
+ | `createColumn` | `size`, `options?` | `jQuery` | A column. `options`: `offset`, `content` |
87
+ | `createElement` | `content`, `options?` | `jQuery` | Host markup wrapped as an element. `options`: `type`, `label` |
88
+ | `createContainer` | `type`, `options?` | `jQuery` | `'tabs'`, `'accordion'` or `'popup'` |
89
+ | `addTab` | `container`, `options?` | `jQuery` | Appends a tab, returns its pane |
90
+ | `addAccordionItem` | `container`, `options?` | `jQuery` | Appends an item, returns its body |
91
+
92
+ A method called on an element with no editor on it is a no-op that returns the
93
+ set, so host code does not have to check first. `getHtml` is the exception: it
94
+ returns the element's html either way.
95
+
96
+ The `create*` methods hand back the node they made rather than the jQuery set,
97
+ because you need the node. It comes back **detached**: place it and call
98
+ `reset()`, or pass a parent and let grid-editor do both.
99
+
100
+ ```javascript
101
+ // place it yourself
102
+ var row = $('#myGrid').gridEditor('createRow', [8, 4]);
103
+ row.appendTo('#myGrid');
104
+ $('#myGrid').gridEditor('reset');
105
+
106
+ // or say where it goes: appendTo, prependTo, insertAfter, insertBefore
107
+ $('#myGrid').gridEditor('createRow', [8, 4], { appendTo: '#myGrid' });
108
+ ```
109
+
110
+ If you are calling several methods in a row, take the instance handle instead
111
+ of dispatching each one. It exposes the same methods, plus the canvas and a
112
+ read-only copy of the settings:
113
+
114
+ ```javascript
115
+ var ge = $('#myGrid').data('grideditor');
116
+ ge.createRow([12], { appendTo: ge.canvas });
117
+ ge.changeView('lg');
118
+ ```
119
+
120
+ Events
121
+ ------
122
+
123
+ Every operation is announced before and after it happens, as a jQuery event on
124
+ the canvas and as a callback. A `before-*` can be canceled.
125
+
126
+ ```javascript
127
+ $('#myGrid').on('grideditor:before-delete', function(e, payload) {
128
+ if (payload.node.hasClass('locked')) { e.preventDefault(); }
129
+ });
130
+
131
+ $('#myGrid').gridEditor({
132
+ callbacks: {
133
+ after_move: function(payload) { console.log(payload.from, payload.to); },
134
+ },
135
+ });
136
+ ```
137
+
138
+ The full catalogue, the payload and what canceling each operation does is in
139
+ [docs/events.md](docs/events.md).
140
+
141
+ Languages
142
+ ---------
143
+
144
+ The interface ships in English and Spanish. English is built into the plugin;
145
+ every other language is a file you load after it.
146
+
147
+ | Code | Language | File |
148
+ | --- | --- | --- |
149
+ | `en` | English | built in, and the fallback for every other locale |
150
+ | `es` | Spanish | `dist/locales/grideditor.es.js` |
151
+
152
+ ```html
153
+ <script src="grid-editor/dist/jquery.grideditor.min.js"></script>
154
+ <script src="grid-editor/dist/locales/grideditor.es.js"></script>
155
+ <script>$('#myGrid').gridEditor({ locale: 'es' });</script>
156
+ ```
157
+
158
+ Override single strings without a locale file with `locale_strings`, and switch
159
+ language at runtime with `setLocale('es')`. The keys are listed in
160
+ [docs/locale-keys.md](docs/locale-keys.md).
161
+
162
+ To contribute a language, copy `src/js/locales/grideditor.es.js`, change the
163
+ code and the strings, run `npm run build`, and open a pull request. A locale
164
+ file that omits keys is fine: the missing ones fall back to English.
165
+
166
+
167
+ Options
168
+ -------
169
+
170
+ ### General options
171
+
172
+ __`new_row_layouts`:__ Set the column layouts that appear in the "new row" buttons at the top of the editor.
173
+
174
+ ```javascript
175
+ $('#myGrid').gridEditor({
176
+ new_row_layouts: [[12], [6,6], [9,3]],
177
+ });
178
+ ```
179
+
180
+ The settings button on a row, a column, a container, a tab, an accordion item
181
+ or an element opens a panel with two fields: the node's `id`, and its css
182
+ classes. The classes field shows what your markup put
183
+ there and nothing else — the grid classes, and everything else the editor
184
+ writes, are not yours to lose and are not shown.
185
+
186
+ __`row_classes`:__ Preset classes the user can toggle from that panel, as
187
+ buttons beside the two fields. Empty by default; the classes field covers the
188
+ general case, and this is for the handful a host wants one click away.
189
+
190
+ ```javascript
191
+ $('#myGrid').gridEditor({
192
+ row_classes: [{ label: 'Dark', cssClass: 'my-app-dark' }],
193
+ });
194
+ ```
195
+
196
+ __`col_classes`:__ The same as `row_classes`, but for columns. `container_classes`, `pane_classes` and `element_classes` do the same for a container, for a tab or accordion item, and for an element.
197
+
198
+ __`row_tools`:__ Add extra tool buttons to the row toolbar.
199
+
200
+ ```javascript
201
+ $('#myGrid').gridEditor({
202
+ row_tools: [{
203
+ title: 'Set background image',
204
+ iconClass: 'glyphicon-picture',
205
+ on: {
206
+ click: function() {
207
+ $(this).closest('.row').css('background-image', 'url(http://placekitten.com/g/300/300)');
208
+ }
209
+ }
210
+ }]
211
+ });
212
+ ```
213
+
214
+ __`col_tools`:__ The same as row_tools, but for columns.
215
+
216
+ __`drag_handle`:__ What a drag starts from. `'tool'`, the default, gives every drawer a move tool and only that tool drags. `'drawer'` makes the whole drawer the handle and drops the move tool, since it would then only say "drag from here". The tools inside a draggable drawer still answer to a click, and dragging from one starts no move.
217
+
218
+ ```javascript
219
+ $('#myGrid').gridEditor({
220
+ drag_handle: 'drawer',
221
+ });
222
+ ```
223
+
224
+ __`toolbar_drag`:__ Whether the toolbar's buttons are a palette: drag one onto the canvas and the row or container it stands for is created where you drop it, with a line showing where that is. `'auto'`, the default, turns it on when `drag_handle` is `'drawer'`, since that is the same idea applied to the toolbar; `true` and `false` decide it outright. Clicking a button still adds at the end either way.
225
+
226
+ ```javascript
227
+ $('#myGrid').gridEditor({
228
+ drag_handle: 'drawer',
229
+ toolbar_drag: 'auto',
230
+ });
231
+ ```
232
+
233
+ __`custom_filter`:__ Allows the execution of a custom function before initialization and after de-initialization. Accepts a functions or a function name as string.
234
+ Gives the `canvas` element and `isInit` (true/false) as parameter.
235
+
236
+ ```javascript
237
+ $('#myGrid').gridEditor({
238
+ 'custom_filter': 'functionname',
239
+ });
240
+
241
+ function functionname(canvas, isInit) {
242
+ if(isInit) {
243
+ // do magic on init
244
+ } else {
245
+ // do magic on de-init
246
+ }
247
+ }
248
+ ```
249
+
250
+ or
251
+
252
+ ```javascript
253
+ $('#myGrid').gridEditor({
254
+ 'custom_filter': function(canvas, isInit) {
255
+ //...
256
+ },
257
+ });
258
+ ```
259
+
260
+ __`valid_col_sizes`:__ Specify the column widths that can be selected using the +/- buttons
261
+
262
+ ```javascript
263
+ $('#myGrid').gridEditor({
264
+ 'valid_col_sizes': [2, 5, 8, 10],
265
+ });
266
+ ```
267
+
268
+ __`valid_col_offsets`:__ The same, for the indent buttons. Default `[0, 1, … 11]`.
269
+
270
+ __`add_column`:__ What the add column tool in a row's drawer does. A click adds a column of `size`; holding the tool for `delay` milliseconds — with the pointer or with a finger — offers the widths in `valid_col_sizes` instead, marking the ones that no longer fit the row. Defaults:
271
+
272
+ ```javascript
273
+ $('#myGrid').gridEditor({
274
+ add_column: {
275
+ size: 12, // what a click adds
276
+ picker: true, // false turns the hold gesture off
277
+ delay: 600,
278
+ },
279
+ });
280
+ ```
281
+
282
+ __`callbacks`:__ A `before_*`/`after_*` function per operation, the same notifications as the events. Returning `false` from a `before_*` cancels it. See [docs/events.md](docs/events.md).
283
+
284
+ ```javascript
285
+ $('#myGrid').gridEditor({
286
+ callbacks: {
287
+ before_delete: function(payload) { return !payload.node.hasClass('locked'); },
288
+ after_add_row: function(payload) { console.log('row added', payload.node); },
289
+ },
290
+ });
291
+ ```
292
+
293
+ __`confirm_delete`:__ Whether to ask before deleting a row, column, element or container. Default `true`. The question is asked in a Bootstrap modal the editor builds outside your canvas, in the interface language; a page that loaded Bootstrap's css but not its javascript gets the browser's own confirm instead. Set it to `false` if you cancel `before-delete` and ask in your own way.
294
+
295
+ __`sortable_options`:__ Merged into every jQuery UI sortable, for hosts that need `cancel`, `tolerance` or a custom `connectWith`.
296
+
297
+ ### Breakpoints and sizing
298
+
299
+ __`layout_modes`:__ Which views the toolbar dropdown offers. Default `['all', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl']`. Offer fewer to keep the feel of 2.x:
300
+
301
+ ```javascript
302
+ $('#myGrid').gridEditor({
303
+ layout_modes: ['all', 'lg', 'sm', 'xs'],
304
+ });
305
+ ```
306
+
307
+ __`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.
308
+
309
+ __`resize`:__ Resizing a column by dragging its edge. Defaults:
310
+
311
+ ```javascript
312
+ $('#myGrid').gridEditor({
313
+ resize: {
314
+ enabled: true,
315
+ handles: 'e', // as jQuery UI names them; 'w' for a right to left page
316
+ balance: 'next', // the following column absorbs the change; false lets the row wrap
317
+ },
318
+ });
319
+ ```
320
+
321
+ __`resizable_options`:__ Merged into every jQuery UI resizable.
322
+
323
+ ### Elements
324
+
325
+ An element is a node inside a content area that the editor treats as one
326
+ movable, deletable thing instead of as rich text. It is a plugin, like the
327
+ containers:
328
+
329
+ ```html
330
+ <script src="grid-editor/dist/plugins/grideditor.elements.min.js"></script>
331
+ ```
332
+
333
+ You mark the elements themselves:
334
+
335
+ ```html
336
+ <div class="ge-content">
337
+ <blockquote data-ge-element="quote" data-ge-label="Pull quote">…your markup…</blockquote>
338
+ </div>
339
+ ```
340
+
341
+ __`elements`:__ Defaults:
342
+
343
+ ```javascript
344
+ $('#myGrid').gridEditor({
345
+ elements: {
346
+ enabled: 'auto', // on when the page has any; true or false to decide yourself
347
+ selector: '[data-ge-element]', // what counts as an element
348
+ auto: false, // true treats every child of a content area as one
349
+ },
350
+ });
351
+ ```
352
+
353
+ __`element_tools`:__ Extra tools on every element drawer, same shape as `row_tools`.
354
+
355
+ See [example/elements.html](example/elements.html), which also shows the
356
+ pattern for an element with no visual output of its own.
357
+
358
+ ### Containers
359
+
360
+ Tabs, accordions and popups. Each holds panes, and a pane is an ordinary
361
+ region: rows, columns, content areas and elements nest inside one exactly as
362
+ they do at the top level.
363
+
364
+ Each type is a plugin, in a file of its own, and loading the file is what makes
365
+ it available:
366
+
367
+ ```html
368
+ <script src="grid-editor/dist/jquery.grideditor.min.js"></script>
369
+ <script src="grid-editor/dist/plugins/grideditor.tabs.min.js"></script>
370
+ <script src="grid-editor/dist/plugins/grideditor.accordion.min.js"></script>
371
+ <script src="grid-editor/dist/plugins/grideditor.popup.min.js"></script>
372
+ ```
373
+
374
+ The toolbar offers a button per loaded plugin. See [docs/plugins.md](docs/plugins.md)
375
+ for the contract, and for writing one of your own.
376
+
377
+ __`plugins`:__ Which of the loaded plugins to use, containers and features alike. Every one by default; name them to use fewer than the page loaded.
378
+
379
+ ```javascript
380
+ $('#myGrid').gridEditor({ plugins: ['tabs', 'elements'] });
381
+ ```
382
+
383
+ __`container_tools`, `tab_tools`, `accordion_tools`:__ Extra tools on the container drawer and on each pane's drawer, same shape as `row_tools`.
384
+
385
+ ```javascript
386
+ var tabs = $('#myGrid').gridEditor('createContainer', 'tabs', {
387
+ tabs: 2,
388
+ labels: ['Overview', 'Details'],
389
+ appendTo: $('#myGrid .column').first(),
390
+ });
391
+ $('#myGrid').gridEditor('addTab', tabs, { label: 'Third', activate: true });
392
+
393
+ $('#myGrid').gridEditor('createContainer', 'accordion', { items: 3, stay_open: true });
394
+ $('#myGrid').gridEditor('createContainer', 'popup', { title: 'Terms', trigger_label: 'Read them', size: 'lg' });
395
+ ```
396
+
397
+ An accordion opens and closes from its headers while editing, and what you
398
+ leave open is what the authored page opens with. The editor answers the click
399
+ itself rather than letting Bootstrap's collapse run over the canvas, so
400
+ `stay_open` behaves the same in the editor as on the page.
401
+
402
+ A popup is a Bootstrap modal plus its trigger. While editing it is rendered
403
+ unfolded in place, so its body is an ordinary region and Bootstrap's modal JS
404
+ is never involved; `getHtml` gives you a closed modal that Bootstrap opens from
405
+ the trigger. Any node in the canvas carrying
406
+ `data-ge-popup-target="<popup id>"` is a trigger too — grid-editor leaves your
407
+ markup alone and writes Bootstrap's attributes onto it in the output.
408
+
409
+ See [example/containers.html](example/containers.html).
410
+
411
+ ### Localization
412
+
413
+ __`locale`:__ The code of a locale in `$.fn.gridEditor.locales`. Default `'en'`.
414
+
415
+ __`locale_strings`:__ Overrides for individual keys, without a locale file.
416
+
417
+ ```javascript
418
+ $('#myGrid').gridEditor({
419
+ locale: 'es',
420
+ locale_strings: { 'tool.move': 'Arrastrar' },
421
+ });
422
+ ```
423
+
424
+ __`source_textarea`:__ Allows to set an already existing textarea as input for grid editor.
425
+
426
+ ```javascript
427
+ $('#myGrid').gridEditor({
428
+ source_textarea: 'textarea.myTextarea',
429
+ });
430
+ ```
431
+
432
+ You will have write back the content to the textarea before saving, for example in this way:
433
+
434
+ ```javascript
435
+ $('form.myForm').on('submit', function() {
436
+ var html = $('#myGrid').gridEditor('getHtml');
437
+ $('textarea.myTextarea').val(html);
438
+ });
439
+ ```
440
+
441
+ ### Rich text editor options
442
+
443
+ Grid editor comes bundles with support for the following rich text editors (RTEs):
444
+ * [TinyMCE](http://www.tinymce.com/) - [(example)](example/basic.html)
445
+ * [summernote](http://summernote.org/) - [(example)](example/summernote.html)
446
+ * [CKEditor](http://ckeditor.com/) - [(example)](example/ckeditor.html)
447
+
448
+ __`content_types`:__ Specify the RTE to use. Valid values: `['tinymce']`, `['summernote']`, `['ckeditor']`. Default value: `['tinymce']`.
449
+
450
+ ```javascript
451
+ $('#myGrid').gridEditor({
452
+ content_types: ['summernote'],
453
+ });
454
+ ```
455
+
456
+ __`ckeditor.config`:__ Specify ckeditor config, when using the `ckeditor` `content_types`.
457
+ See the [CKEditor documentation](http://docs.ckeditor.com/).
458
+ Also check out the [ckeditor example](example/ckeditor.html).
459
+
460
+ ```javascript
461
+ $('#myGrid').gridEditor({
462
+ ckeditor: {
463
+ config: { language: 'fr' }
464
+ }
465
+ });
466
+ ```
467
+
468
+ __`summernote.config`:__ Specify summernote config, when using the `summernote` `content_types`.
469
+ See the [summernote documentation](http://summernote.org/deep-dive/).
470
+ Also check out the [summernote example](example/summernote.html).
471
+
472
+ ```javascript
473
+ $('#myGrid').gridEditor({
474
+ summernote: {
475
+ config: { shortcuts: false }
476
+ }
477
+ });
478
+ ```
479
+
480
+ __`tinymce.config`:__ Specify tinyMCE config, when using the `tinymce` `content_types`.
481
+ See the [tinyMCE documentation](https://www.tiny.cloud/docs/tinymce/6/).
482
+ Also check out the [tinymce example](example/basic.html).
483
+
484
+ ```javascript
485
+ $('#myGrid').gridEditor({
486
+ tinymce: {
487
+ config: { paste_as_text: true }
488
+ }
489
+ });
490
+ ```
491
+
492
+ Grid editor passes `promotion: false`, so tinyMCE's "Upgrade" badge does not
493
+ appear in the menubar of an inline editor sitting in someone's page. Pass
494
+ `promotion: true` in your own config to get it back.
495
+
496
+
497
+ Upgrading
498
+ ---------
499
+
500
+ See [UPGRADING.md](UPGRADING.md) for what changes between major versions,
501
+ including 2.x to 3.x.
502
+
503
+ Building
504
+ --------
505
+
506
+ If you want to make your own changes to the source, see [BUILDING.md](BUILDING.md)
507
+
508
+
509
+ Contributing
510
+ --------
511
+ If you want to help out, please first read [CONTRIBUTING.md](CONTRIBUTING.md)
512
+
513
+
514
+ Attribution
515
+ -----------
516
+
517
+ Grid Editor was written by [Simon Epskamp](https://github.com/Friendly-Pixel) at
518
+ Frontwise, and lives at [Friendly-Pixel/grid-editor](https://github.com/Friendly-Pixel/grid-editor).
519
+ Everything from 3.x on is this fork; the MIT license, and the credit, are his.
520
+
521
+ It was heavily inspired by [Neokoenig's grid manager](https://github.com/neokoenig/jQuery-gridmanager)
package/UPGRADING.md ADDED
@@ -0,0 +1,88 @@
1
+ Upgrading from grid-editor `2.*` to `3.*`
2
+ =========================================
3
+
4
+ Both are for bootstrap 5, and most of 3.x is additive: the settings you pass
5
+ today keep working, `getHtml` still returns your markup, and the rich text
6
+ editor integrations are unchanged. Four things do change.
7
+
8
+ * __Layout modes went from three to seven.__ `changeView` takes a breakpoint
9
+ key now — `'xs'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'xxl'` or `'all'` — and
10
+ `getView` gives one back. The 2.x numeric indexes still work (`0` desktop,
11
+ `1` tablet, `2` phone) and log a deprecation warning once. The dropdown has
12
+ seven entries; pass `layout_modes: ['all', 'lg', 'sm', 'xs']` for something
13
+ closer to the old feel.
14
+ * __The editor starts in the `all` view__, where a size or indent change is
15
+ written to every breakpoint at once. Pass `default_view: 'lg'` for the old
16
+ behaviour of editing one tier at a time.
17
+ * __The canvas layout classes are named after the breakpoints.__
18
+ `ge-layout-desktop`, `ge-layout-tablet` and `ge-layout-phone` are now
19
+ `ge-layout-lg`, `ge-layout-sm` and `ge-layout-xs`, with `ge-layout-md`,
20
+ `-xl`, `-xxl` and `-all` alongside them. If you styled against those class
21
+ names, rename them.
22
+ * __Columns are no longer seeded with a class per breakpoint.__ 2.x wrote
23
+ `col-lg-*`, `col-sm-*` and `col-*` onto every column whether or not you
24
+ asked; 3.x leaves a column that carries any size class exactly as authored,
25
+ and gives a column with none a single `col-12`. Your existing markup is
26
+ unaffected — it already has those classes — but new columns are leaner, and
27
+ a column sized only for `lg` now renders as bootstrap renders it below `lg`.
28
+
29
+ * __Tabs, accordions, popups and the element level controls are plugin
30
+ files.__ They are not in the main bundle: load
31
+ `dist/plugins/grideditor.tabs.js` and its neighbours beside the editor for
32
+ the ones your pages use. Nothing to change for a 2.x page, which had none of
33
+ them; a page that wants them loads two files instead of one.
34
+
35
+ * __`row_classes` and `col_classes` are empty by default.__ 2.x shipped a
36
+ single `Example class` toggle in every settings panel; if you were relying on
37
+ it, pass the classes you actually want. The panel now has a css class field
38
+ of its own, so a host needs the preset buttons only for the classes it wants
39
+ one click away.
40
+
41
+ Deprecated, and still working:
42
+
43
+ * `remove` is now `destroy`. `remove` remains as an alias and warns once per
44
+ instance.
45
+
46
+ New, and worth knowing about before you write glue code for it:
47
+
48
+ * `callbacks` and the `grideditor:*` events, so your application is told about
49
+ every add, delete, move, resize and indent, and can cancel any of them. This
50
+ replaces reaching into the editor's DOM to find out what happened. See
51
+ [docs/events.md](/docs/events.md).
52
+ * `confirm_delete`, which replaces the hardcoded "Delete row?" confirm, and
53
+ `locale`/`locale_strings`/`setLocale` for the interface language.
54
+ * Column offsets, drag resize, element level controls, and tabs, accordions
55
+ and popups. All off unless you use them; the containers and elements are
56
+ detected from `data-ge-container` and `data-ge-element`, which your existing
57
+ markup does not have.
58
+
59
+ Upgrading from grid-editor `1.*` to `2.*`
60
+ =========================================
61
+
62
+ Grid-editor `1.*` is for bootstrap __4__, `2.*` for bootstrap __5__.
63
+
64
+ The grid classes grid-editor generates (`col-lg-*`, `col-sm-*`, `col-*`) are
65
+ valid in both bootstrap 4 and 5, so __no changes to your generated HTML are
66
+ needed__. What changes is what you load on the page:
67
+
68
+ * Load __bootstrap 5__ instead of bootstrap 4. The layout mode dropdown now
69
+ uses `data-bs-toggle` instead of `data-toggle`, which only bootstrap 5
70
+ understands.
71
+ * Load [bootstrap icons](https://icons.getbootstrap.com/) instead of font
72
+ awesome. Every built-in tool icon moved from a `fa fa-*` class to its
73
+ `bi bi-*` equivalent.
74
+ * If you pass custom `row_tools` or `col_tools`, their default `iconClass` is
75
+ now `bi bi-wrench`. Any `iconClass` you pass explicitly as `fa fa-*` must be
76
+ changed to a bootstrap icons class.
77
+ * If you use `content_types: ['tinymce']`, load __tinyMCE 6__ and stop loading
78
+ the `jquery.tinymce.js` integration plugin. TinyMCE dropped that plugin after
79
+ 5.x, so the integration now calls `tinymce.init()` directly. A
80
+ `tinymce.config.oninit` callback keeps working, and `init_instance_callback`
81
+ is honoured as well.
82
+
83
+ Upgrading from grid-editor `0.*` to `1.*`
84
+ =========================================
85
+
86
+ Grid-editor `0.*` is for bootstrap __3__, `1.*` for bootstrap __4__.
87
+ Since the breakpoints for the gridsystem have changed from 3 to 4, all the HTML that was generated using grid-editor `0.*` must be adjusted.
88
+ Change all the classes in the HTML from `col-md` to `col-lg`. No other changes to the HTML are needed.