@themarioga/grid-editor 9.0.0-beta.6 → 9.0.0-beta.8

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 (103) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +54 -27
  3. package/UPGRADING.md +1 -1
  4. package/dist/grideditor.bundle.min.js +2 -2
  5. package/dist/grideditor.css +24 -3
  6. package/dist/grideditor.d.ts +27 -2
  7. package/dist/grideditor.esm.js +64 -7
  8. package/dist/grideditor.js +64 -7
  9. package/dist/grideditor.min.css +1 -1
  10. package/dist/grideditor.min.css.map +1 -1
  11. package/dist/grideditor.min.js +1 -1
  12. package/dist/grideditor.min.js.map +3 -3
  13. package/dist/locales/grideditor.es.esm.js +2 -0
  14. package/dist/locales/grideditor.es.js +2 -0
  15. package/dist/locales/grideditor.es.min.js +1 -1
  16. package/dist/locales/grideditor.es.min.js.map +2 -2
  17. package/dist/plugins/grideditor.accordion.esm.js +9 -0
  18. package/dist/plugins/grideditor.accordion.js +9 -0
  19. package/dist/plugins/grideditor.accordion.min.js +1 -1
  20. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  21. package/dist/plugins/grideditor.card.min.js +1 -1
  22. package/dist/plugins/grideditor.card.min.js.map +1 -1
  23. package/dist/plugins/grideditor.carousel.esm.js +3 -0
  24. package/dist/plugins/grideditor.carousel.js +3 -0
  25. package/dist/plugins/grideditor.carousel.min.js +1 -1
  26. package/dist/plugins/grideditor.carousel.min.js.map +3 -3
  27. package/dist/plugins/grideditor.ckeditor.esm.js +9 -0
  28. package/dist/plugins/grideditor.ckeditor.js +9 -0
  29. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  30. package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
  31. package/dist/plugins/grideditor.clipboard.esm.js +44 -7
  32. package/dist/plugins/grideditor.clipboard.js +44 -7
  33. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  34. package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
  35. package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
  36. package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
  37. package/dist/plugins/grideditor.elements.esm.js +3 -0
  38. package/dist/plugins/grideditor.elements.js +3 -0
  39. package/dist/plugins/grideditor.elements.min.js +1 -1
  40. package/dist/plugins/grideditor.elements.min.js.map +3 -3
  41. package/dist/plugins/grideditor.gutters.min.js.map +1 -1
  42. package/dist/plugins/grideditor.history.esm.js +1 -1
  43. package/dist/plugins/grideditor.history.js +1 -1
  44. package/dist/plugins/grideditor.history.min.js +1 -1
  45. package/dist/plugins/grideditor.history.min.js.map +2 -2
  46. package/dist/plugins/grideditor.inline-style.esm.js +66 -3
  47. package/dist/plugins/grideditor.inline-style.js +66 -3
  48. package/dist/plugins/grideditor.inline-style.min.js +4 -4
  49. package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
  50. package/dist/plugins/grideditor.offcanvas.min.js.map +1 -1
  51. package/dist/plugins/grideditor.order.min.js +1 -1
  52. package/dist/plugins/grideditor.order.min.js.map +1 -1
  53. package/dist/plugins/grideditor.popup.min.js.map +1 -1
  54. package/dist/plugins/grideditor.sections.esm.js +9 -0
  55. package/dist/plugins/grideditor.sections.js +9 -0
  56. package/dist/plugins/grideditor.sections.min.js +1 -1
  57. package/dist/plugins/grideditor.sections.min.js.map +3 -3
  58. package/dist/plugins/grideditor.summernote.esm.js +9 -0
  59. package/dist/plugins/grideditor.summernote.js +9 -0
  60. package/dist/plugins/grideditor.summernote.min.js +1 -1
  61. package/dist/plugins/grideditor.summernote.min.js.map +3 -3
  62. package/dist/plugins/grideditor.tabs.esm.js +3 -0
  63. package/dist/plugins/grideditor.tabs.js +3 -0
  64. package/dist/plugins/grideditor.tabs.min.js +1 -1
  65. package/dist/plugins/grideditor.tabs.min.js.map +3 -3
  66. package/dist/plugins/grideditor.tinymce.esm.js +9 -0
  67. package/dist/plugins/grideditor.tinymce.js +9 -0
  68. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  69. package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
  70. package/docs/events.md +6 -1
  71. package/docs/locale-keys.md +2 -0
  72. package/docs/plugins.md +9 -7
  73. package/example/adapter.html +11 -1
  74. package/example/clipboard.html +7 -4
  75. package/example/{autocols.html → columns.html} +61 -20
  76. package/example/containers.html +13 -2
  77. package/example/{attributes.html → custom-plugins.html} +130 -12
  78. package/example/elements.html +13 -2
  79. package/example/history.html +6 -3
  80. package/example/index.html +30 -81
  81. package/example/playground.html +840 -0
  82. package/example/style.html +291 -0
  83. package/example/text-editors.html +320 -0
  84. package/package.json +1 -1
  85. package/src/js/dom.js +6 -0
  86. package/src/js/grideditor.js +69 -7
  87. package/src/js/inline-style/accordion.js +4 -3
  88. package/src/js/inline-style/fields.js +56 -3
  89. package/src/js/inline-style/options.js +12 -0
  90. package/src/js/locales/grideditor.es.js +2 -0
  91. package/src/js/plugins/grideditor.clipboard.js +61 -11
  92. package/src/js/plugins/grideditor.history.js +3 -3
  93. package/src/js/plugins/grideditor.inline-style.js +10 -0
  94. package/src/js/text/grideditor.text.js +1 -1
  95. package/src/less/grideditor.less +26 -3
  96. package/types/grideditor.d.ts +27 -2
  97. package/example/breakpoints.html +0 -100
  98. package/example/ckeditor.html +0 -110
  99. package/example/custom_editor.html +0 -212
  100. package/example/inline-style.html +0 -163
  101. package/example/plugins.html +0 -251
  102. package/example/summernote.html +0 -114
  103. package/example/utilities.html +0 -200
@@ -1,251 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
-
6
- <!-- CSS dependencies -->
7
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
-
10
- <!-- Javascript dependencies -->
11
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
12
-
13
- <!-- Grid editor CSS -->
14
- <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
15
-
16
- <!-- The editor, and the plugins this page offers. Loading a file is what
17
- makes its feature available; nothing here is in the main bundle. -->
18
- <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
19
- <script src="../dist/grideditor.min.js"></script>
20
- <script src="../dist/plugins/grideditor.tabs.min.js"></script>
21
- <script src="../dist/plugins/grideditor.accordion.min.js"></script>
22
- <script src="../dist/plugins/grideditor.popup.min.js"></script>
23
- <script src="../dist/plugins/grideditor.card.min.js"></script>
24
- <script src="../dist/plugins/grideditor.elements.min.js"></script>
25
-
26
- <!-- And one written here, to show what a plugin of your own takes. It is
27
- a container type: a bootstrap alert whose body is an editable region. -->
28
- <script id="callout-plugin">
29
- (function() {
30
-
31
- // A plugin brings its own strings
32
- Object.assign(GridEditor.locales.en, {
33
- 'container.add_callout': 'Callout',
34
- 'container.callout_title': 'Heads up',
35
- });
36
-
37
- // Registered under the type it builds, and called once per editor
38
- // with the handle it works through. The handle hands out elements.
39
- GridEditor.containers.callout = function(ge) {
40
-
41
- return {
42
- // The toolbar button's label
43
- labelKey: 'container.add_callout',
44
-
45
- // A detached container. data-ge-container is what the
46
- // editor recognises: never a class, so restyling is free.
47
- create: function(options) {
48
- var label = document.createElement('span');
49
- label.className = 'ge-pane-label';
50
- label.textContent = options.title || ge.t('container.callout_title');
51
-
52
- var heading = document.createElement('h4');
53
- heading.className = 'alert-heading';
54
- heading.appendChild(label);
55
-
56
- var callout = document.createElement('div');
57
- callout.className = 'alert alert-primary';
58
- callout.setAttribute('role', 'alert');
59
- callout.appendChild(heading);
60
- callout.appendChild(ge.defaultRegion());
61
-
62
- var container = document.createElement('div');
63
- container.setAttribute('data-ge-container', 'callout');
64
- container.appendChild(callout);
65
- return container;
66
- },
67
-
68
- // Editing furniture on, and off again. Anything mark()
69
- // adds, unmark() has to take away: what is left is what
70
- // getHtml hands back.
71
- mark: function(container) {
72
- ge.makeLabelEditable(ge.labelIn(container.querySelector('.alert-heading')));
73
- },
74
-
75
- unmark: function(container) {
76
- ge.unwrapLabels(container);
77
- },
78
-
79
- // The same, on a copy of the canvas, for
80
- // getHtml({ keepEditing: true }): unmark only touches
81
- // markup, so it does for each callout on the copy
82
- cleanMarkup: function(root) {
83
- var definition = this;
84
- root.querySelectorAll('[data-ge-container="callout"]').forEach(function(container) {
85
- definition.unmark(container);
86
- });
87
- },
88
- };
89
- };
90
-
91
- })();
92
- </script>
93
-
94
- <script>
95
- document.addEventListener('DOMContentLoaded', function() {
96
- // Show the plugin written above as the page's own source
97
- document.getElementById('callout-source').textContent =
98
- document.getElementById('callout-plugin').textContent.trim().replace(/^ {8}/gm, '');
99
-
100
- function activePlugins() {
101
- return Array.prototype.map.call(document.querySelectorAll('.plugin-choice:checked'), function(box) {
102
- return box.value;
103
- });
104
- }
105
-
106
- function start() {
107
- var running = GridEditor.get('#myGrid');
108
- if (running) { running.destroy(); }
109
-
110
- new GridEditor('#myGrid', {
111
- new_row_layouts: [[12], [6, 6]],
112
- content_types: [],
113
-
114
- // Which of the loaded plugins to use. Leave it out and
115
- // every one the page loaded is used.
116
- plugins: activePlugins(),
117
- });
118
-
119
- document.getElementById('in-use').textContent = activePlugins().join(', ') || 'none';
120
- document.getElementById('registered').textContent =
121
- Object.keys(GridEditor.containers).concat(
122
- Object.keys(GridEditor.features)).sort().join(', ');
123
- }
124
-
125
- document.querySelectorAll('.plugin-choice').forEach(function(box) {
126
- box.addEventListener('change', start);
127
- });
128
- document.getElementById('output').addEventListener('click', function() {
129
- document.getElementById('html').textContent = GridEditor.get('#myGrid').getHtml();
130
- });
131
-
132
- start();
133
- });
134
- </script>
135
-
136
- <title>Grid Editor plugins example</title>
137
- </head>
138
- <body>
139
- <!-- Back to the demo index -->
140
- <div class="container pt-3">
141
- <a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
142
- </div>
143
-
144
-
145
- <div class="container">
146
-
147
- <div class="row my-3">
148
- <div class="col-lg-8">
149
- <h1 class="h4">Plugins</h1>
150
- <p class="form-text">
151
- Tabs, accordions, popups, cards and the element level
152
- controls are not in the main bundle: each is a file loaded
153
- beside the editor, and loading it is what turns the feature
154
- on. This page loads all five, plus a sixth written in its
155
- own <code>&lt;script&gt;</code> below.
156
- </p>
157
- <p class="form-text">
158
- Tick and untick to change the <code>plugins</code> setting
159
- and re-initialize the editor. A container plugin puts a
160
- button in the toolbar; <strong>elements</strong> has no
161
- button &mdash; its effect is that the marked markup in the
162
- first row becomes a movable element.
163
- </p>
164
-
165
- <div class="mb-2">
166
- <div class="form-check form-check-inline">
167
- <input class="form-check-input plugin-choice" type="checkbox" value="tabs" id="p-tabs" checked>
168
- <label class="form-check-label" for="p-tabs">tabs</label>
169
- </div>
170
- <div class="form-check form-check-inline">
171
- <input class="form-check-input plugin-choice" type="checkbox" value="accordion" id="p-accordion" checked>
172
- <label class="form-check-label" for="p-accordion">accordion</label>
173
- </div>
174
- <div class="form-check form-check-inline">
175
- <input class="form-check-input plugin-choice" type="checkbox" value="popup" id="p-popup" checked>
176
- <label class="form-check-label" for="p-popup">popup</label>
177
- </div>
178
- <div class="form-check form-check-inline">
179
- <input class="form-check-input plugin-choice" type="checkbox" value="elements" id="p-elements" checked>
180
- <label class="form-check-label" for="p-elements">elements</label>
181
- </div>
182
- <div class="form-check form-check-inline">
183
- <input class="form-check-input plugin-choice" type="checkbox" value="card" id="p-card" checked>
184
- <label class="form-check-label" for="p-card">card</label>
185
- </div>
186
- <div class="form-check form-check-inline">
187
- <input class="form-check-input plugin-choice" type="checkbox" value="callout" id="p-callout" checked>
188
- <label class="form-check-label" for="p-callout">callout (written on this page)</label>
189
- </div>
190
- </div>
191
-
192
- <p class="form-text">
193
- Loaded: <code id="registered"></code><br>
194
- In use: <code id="in-use"></code>
195
- </p>
196
-
197
- <button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
198
- <pre id="html" class="form-text"></pre>
199
- </div>
200
- </div>
201
-
202
- <div id="myGrid">
203
-
204
- <div class="row">
205
- <div class="col-lg-12">
206
- <div class="ge-content">
207
- <p>Ordinary text in a content area.</p>
208
- </div>
209
-
210
- <blockquote data-ge-element="quote" data-ge-label="Pull quote">
211
- <p>A node the host marked: an element when the elements plugin is on,
212
- ordinary markup - text - when it is off.</p>
213
- </blockquote>
214
- </div>
215
- </div>
216
-
217
- <div class="row">
218
- <div class="col-lg-12">
219
- <div data-ge-container="card">
220
- <div class="card">
221
- <div class="card-header">A card, from the card plugin</div>
222
- <div class="card-body">
223
- <div class="row"><div class="col-lg-12">
224
- <div class="ge-content"><p>Its body is an ordinary region: rows, columns and elements nest in it.</p></div>
225
- </div></div>
226
- </div>
227
- </div>
228
- </div>
229
- </div>
230
- </div>
231
-
232
- </div> <!-- /#myGrid -->
233
-
234
- <div class="row my-4">
235
- <div class="col-lg-10">
236
- <h2 class="h5">The callout plugin, in full</h2>
237
- <p class="form-text">
238
- Thirty lines, and it moves, deletes, nests, takes an id and
239
- classes, and round-trips through <code>getHtml</code> like
240
- anything else &mdash; the shipped <code>card</code> plugin is
241
- barely longer. See <a href="../docs/plugins.md">docs/plugins.md</a>
242
- for the whole contract.
243
- </p>
244
- <pre class="border rounded p-3 bg-light"><code id="callout-source"></code></pre>
245
- </div>
246
- </div>
247
-
248
- </div> <!-- /.container -->
249
-
250
- </body>
251
- </html>
@@ -1,114 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
-
6
- <!-- CSS dependencies -->
7
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
-
10
- <!-- Javascript dependencies. jQuery is summernote's: the editor itself
11
- does not need it, and this page loads no jQuery adapter -->
12
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
13
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
14
-
15
- <!-- Summernote CSS -->
16
- <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.9.1/summernote-bs5.min.css" />
17
- <!-- Summernote js -->
18
- <script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.9.1/summernote-bs5.min.js"></script>
19
-
20
- <!-- Grid editor CSS -->
21
- <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
22
- <!-- Grid editor javascript -->
23
- <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
24
- <script src="../dist/grideditor.min.js"></script>
25
- <!-- The text editor is a plugin of its own, loaded after the editor -->
26
- <script src="../dist/plugins/grideditor.summernote.min.js"></script>
27
-
28
- <script>
29
- document.addEventListener('DOMContentLoaded', function() {
30
- // Initialize grid editor
31
- var editor = new GridEditor('#myGrid', {
32
- new_row_layouts: [[12], [6, 6], [9, 3], [3, 9]],
33
- content_types: ['summernote'],
34
- summernote: {
35
- config: {
36
- callbacks: {
37
- onInit: function() {
38
- var element = this;
39
- console.log('init done', element);
40
- }
41
- }
42
- }
43
- }
44
- });
45
-
46
- // Get resulting html
47
- var html = editor.getHtml();
48
- console.log(html);
49
- });
50
- </script>
51
-
52
- <title>Grid Editor example</title>
53
- </head>
54
- <body>
55
- <!-- Back to the demo index -->
56
- <div class="container pt-3">
57
- <a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
58
- </div>
59
-
60
-
61
- <div class="container">
62
- <div id="myGrid">
63
-
64
- <div class="row">
65
- <div class="col-md-12">
66
- <h1>Lorem ipsum dolor sit amet, consectetur</h1>
67
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit exercitationem eaque aperiam rem quia quibusdam dolor ducimus quo similique eos pariatur nostrum aliquam nam eius, doloremque quis voluptatum unde. Porro voluptates aspernatur voluptate ipsam, magni vero. Accusamus, iusto tempore id!</p>
68
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quae laboriosam, excepturi quas.</p>
69
- </div>
70
- </div>
71
-
72
- <div class="row">
73
- <div class="col-md-4">
74
- <h2>Lorem ipsum dolor</h2>
75
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea facilis vel aliquam aspernatur dolor placeat totam saepe perferendis. Odio quia vel sed eveniet cupiditate, illum doloremque sint veniam eum? Corporis?</p>
76
- </div>
77
- <div class="col-md-4">
78
- <h2>Pariatur reprehenderit</h2>
79
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo adipisci ipsa, consequuntur cum, sunt dolores veniam. Enim inventore in dolore deserunt vitae sequi nemo!</p>
80
- </div>
81
- <div class="col-md-4">
82
- <h2>Pariatur reprehenderit</h2>
83
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea excepturi ducimus numquam aut error corporis aspernatur ipsum quos eius culpa!</p>
84
- </div>
85
- </div>
86
-
87
- <div class="row">
88
- <div class="col-md-8">
89
- <h2>Lorem ipsum dolor.</h2>
90
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro distinctio atque molestiae optio, consequuntur? Iusto ratione cumque dolor aut dolore!</p>
91
-
92
- <div class="row">
93
- <div class="col-md-6">
94
- <hr>
95
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis facilis molestias voluptatum laudantium fuga ratione tempora rem dolor dicta rerum vero ut, suscipit ex qui amet quam vel cupiditate quaerat minus assumenda reiciendis, similique omnis delectus! Autem, repudiandae cumque eaque?</p>
96
- </div>
97
- <div class="col-md-6">
98
- <hr>
99
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet molestiae quaerat illum, consequuntur iusto aspernatur quam provident? Possimus!</p>
100
- </div>
101
- </div>
102
- </div>
103
-
104
- <div class="col-md-4">
105
- <h2>Lusto ratione</h2>
106
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis fugit quasi officiis id laudantium error aut ut aperiam dicta saepe non vel, cupiditate illum ipsam velit deleniti natus incidunt impedit molestias dolore quos dolores enim. Aliquid ipsam eaque consequuntur quaerat, suscipit a in. Praesentium repudiandae quibusdam recusandae sequi eligendi quos, dignissimos, officiis officia minima necessitatibus eaque consequatur in id adipisci qui minus voluptatum quae debitis, quas maxime iure. Tempore vero unde quia reiciendis ad beatae voluptate omnis, ipsa expedita ab, quasi, neque. Doloribus, pariatur. Aut hic voluptate.</p>
107
- </div>
108
- </div>
109
-
110
- </div> <!-- /#myGrid -->
111
- </div> <!-- /.container -->
112
-
113
- </body>
114
- </html>
@@ -1,200 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
-
6
- <!-- CSS dependencies -->
7
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
-
10
- <!-- Javascript dependencies -->
11
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
12
-
13
- <!-- Grid editor CSS -->
14
- <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
15
-
16
- <!-- The editor, and the utility plugins. Each is a file of its own, and
17
- loading it is what puts its fields in the settings panels. The
18
- inline-style plugin carries display, flex, spacing, text alignment, sticky and
19
- float, and edits them in its Style accordion - a row's justify and
20
- align among them, in Flex; order, a column's align-self and gutters
21
- are the grid's, and stay in the Responsive section. -->
22
- <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
23
- <script src="../dist/grideditor.min.js"></script>
24
- <script src="../dist/plugins/grideditor.order.min.js"></script>
25
- <script src="../dist/plugins/grideditor.alignment.min.js"></script>
26
- <script src="../dist/plugins/grideditor.gutters.min.js"></script>
27
- <!-- Float works on elements, so the elements plugin comes first -->
28
- <script src="../dist/plugins/grideditor.elements.min.js"></script>
29
- <script src="../dist/plugins/grideditor.inline-style.min.js"></script>
30
-
31
- <script>
32
- document.addEventListener('DOMContentLoaded', function() {
33
- var grid = document.getElementById('myGrid');
34
- var editor;
35
-
36
- function start(panel) {
37
- editor = new GridEditor(grid, {
38
- new_row_layouts: [[12], [6,6], [4,4,4], [8,4]],
39
- content_types: [],
40
-
41
- // Utilities are edited per breakpoint, so this page starts in
42
- // one. Switch to "All sizes" to see the page as it will render.
43
- default_view: 'xs',
44
-
45
- // Where a node's settings open: 'offcanvas', the default,
46
- // 'popover', 'modal', 'inline' in its drawer, or 'sidebar',
47
- // a panel that stays and shows what is clicked
48
- settings_panel: panel,
49
- });
50
- }
51
- start(document.getElementById('panel').value);
52
-
53
- // The same canvas, started again with its settings elsewhere
54
- document.getElementById('panel').addEventListener('change', function() {
55
- var html = editor.getHtml();
56
- editor.destroy();
57
- grid.innerHTML = html;
58
- start(this.value);
59
- });
60
-
61
- // Every change to a utility is announced, like any other operation
62
- grid.addEventListener('grideditor:after-utility', function(e) {
63
- var payload = e.detail;
64
- document.getElementById('last').textContent = payload.family + ' at ' + payload.breakpoint + ': ' +
65
- (payload.from === null ? 'default' : payload.from) + ' → ' +
66
- (payload.to === null ? 'inherit' : payload.to);
67
- });
68
-
69
- document.getElementById('output').addEventListener('click', function() {
70
- document.getElementById('html').textContent = editor.getHtml();
71
- });
72
- });
73
- </script>
74
-
75
- <title>Grid Editor utilities example</title>
76
- </head>
77
- <body>
78
- <!-- Back to the demo index -->
79
- <div class="container pt-3">
80
- <a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
81
- </div>
82
-
83
-
84
- <div class="container">
85
-
86
- <div class="row my-3">
87
- <div class="col-lg-8">
88
- <h1 class="h4">Responsive utilities</h1>
89
- <p class="form-text">
90
- Bootstrap's responsive utility classes, edited per
91
- breakpoint. Pick a breakpoint in the dropdown and every
92
- change is written for that breakpoint alone; in
93
- <strong>All sizes</strong> it is written once, for every
94
- size. Each drawer's gear has a <strong>Style</strong>
95
- accordion, whose sections hold display, flex, spacing, text
96
- alignment, sticky and float, and a <strong>Responsive</strong>
97
- section for the grid's utilities. Every field says what
98
- the breakpoint inherits and from where.
99
- </p>
100
- <div class="d-flex align-items-center gap-2 mb-3">
101
- <label class="form-label mb-0" for="panel">A gear opens its settings in</label>
102
- <select class="form-select form-select-sm w-auto" id="panel">
103
- <option value="offcanvas">a side panel (offcanvas)</option>
104
- <option value="popover">a popover</option>
105
- <option value="modal">a modal</option>
106
- <option value="inline">the drawer itself (inline)</option>
107
- <option value="sidebar">a sidebar that stays (click an element)</option>
108
- </select>
109
- </div>
110
- <p class="form-text">
111
- <strong>Display:</strong> a field in the Display section,
112
- and the eye in a drawer, which hides the
113
- node in the view being edited. It stays on the canvas,
114
- faded, so you can show it again; in All sizes a badge says
115
- at which breakpoints it is hidden. The sidebar below is
116
- hidden on phones and tablets.
117
- </p>
118
- <p class="form-text">
119
- <strong>Order:</strong> the arrows in a column's drawer
120
- move it earlier or later in the view being edited,
121
- without moving the markup. In the second row, "Second"
122
- comes first on phones only.
123
- </p>
124
- <p class="form-text">
125
- <strong>Alignment:</strong> a row justifies and aligns its
126
- columns with fields in the Style accordion's Flex section,
127
- and a column aligns itself with a field in Responsive. The
128
- third row centres its narrow column from small desktop up.
129
- </p>
130
- <p class="form-text">
131
- <strong>Gutters:</strong> fields in a row's panel. A row
132
- with gutter classes is drawn with its real gutters; the
133
- second row has none on phones and wide ones from small
134
- desktop up.
135
- </p>
136
- <p class="form-text">
137
- <strong>Spacing:</strong> a padding and a margin group in
138
- the Style accordion's Spacing section, each a side and a
139
- value. The centred column
140
- below gets more padding from small desktop up.
141
- </p>
142
- <p class="form-text">
143
- <strong>Text alignment:</strong> a field in the Text section.
144
- The centred column's text is centred from small desktop
145
- up. <strong>Float:</strong> a field in an element's Position section;
146
- the quote in the last row floats to the end from tablet up,
147
- with the text flowing round it.
148
- </p>
149
- <p class="form-text">Last change: <span id="last">none yet</span></p>
150
- <button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
151
- <pre id="html" class="form-text"></pre>
152
- </div>
153
- </div>
154
-
155
- <div id="myGrid">
156
-
157
- <div class="row">
158
- <div class="col-12 col-md-8">
159
- <h2 class="h5">Main content</h2>
160
- <p>Full width on phones and tablets, two thirds from small desktop up.</p>
161
- </div>
162
- <div class="col-12 col-md-4 d-none d-md-block">
163
- <h2 class="h5">Sidebar</h2>
164
- <p>Only from small desktop up: <code>d-none d-md-block</code>.</p>
165
- </div>
166
- </div>
167
-
168
- <div class="row g-0 g-md-5">
169
- <div class="col-6">
170
- <h2 class="h5">First</h2>
171
- <p>Change the views and the utilities of these two.</p>
172
- </div>
173
- <div class="col-6 order-first order-sm-0">
174
- <h2 class="h5">Second</h2>
175
- <p>First on phones, with <code>order-first order-sm-0</code>.</p>
176
- </div>
177
- </div>
178
-
179
- <div class="row justify-content-md-center">
180
- <div class="col-12 col-md-6 py-2 py-md-4 text-md-center">
181
- <h2 class="h5">Centred</h2>
182
- <p>Its row has <code>justify-content-md-center</code>, and it has <code>py-2 py-md-4</code>.</p>
183
- </div>
184
- </div>
185
-
186
- <div class="row">
187
- <div class="col-12">
188
- <blockquote data-ge-element="quote" data-ge-label="Pull quote" class="float-sm-end ms-sm-3 p-3 border-start border-4">
189
- A floated element, <code>float-sm-end</code>.
190
- </blockquote>
191
- <p>The text after it flows round the quote from tablet up, and runs under it on phones, where it does not float. Switch between Phone and Tablet in the dropdown to see it move, or choose another float in the element's panel.</p>
192
- <p>A second paragraph, so there is enough text to flow.</p>
193
- </div>
194
- </div>
195
-
196
- </div> <!-- /#myGrid -->
197
- </div> <!-- /.container -->
198
-
199
- </body>
200
- </html>