@themarioga/grid-editor 9.0.0-beta.3 → 9.0.0-beta.5
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 +35 -0
- package/README.md +30 -8
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +187 -0
- package/dist/grideditor.d.ts +44 -0
- package/dist/grideditor.esm.js +35 -23
- package/dist/grideditor.js +35 -23
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +20 -0
- package/dist/locales/grideditor.es.js +20 -0
- package/dist/locales/grideditor.es.min.js +2 -2
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.offcanvas.esm.js +728 -0
- package/dist/plugins/grideditor.offcanvas.js +733 -0
- package/dist/plugins/grideditor.offcanvas.min.js +1 -0
- package/dist/plugins/grideditor.offcanvas.min.js.map +7 -0
- package/dist/plugins/grideditor.popup.esm.js +267 -37
- package/dist/plugins/grideditor.popup.js +267 -37
- package/dist/plugins/grideditor.popup.min.js +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +4 -4
- package/docs/events.md +10 -3
- package/docs/locale-keys.md +21 -1
- package/docs/plugins.md +21 -4
- package/example/containers.html +22 -4
- package/example/index.html +1 -1
- package/package.json +1 -1
- package/src/js/grideditor.js +41 -23
- package/src/js/locales/grideditor.es.js +20 -0
- package/src/js/plugins/grideditor.offcanvas.js +423 -0
- package/src/js/plugins/grideditor.popup.js +10 -70
- package/src/js/triggers/triggers.js +321 -0
- package/src/less/grideditor.less +60 -0
- package/types/grideditor.d.ts +44 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the popup and the offcanvas plugins share: the host's triggers.
|
|
3
|
+
*
|
|
4
|
+
* A trigger is markup the host owns - a button, a link - anywhere in the
|
|
5
|
+
* canvas, that points at a container by id. While editing it must not reach
|
|
6
|
+
* Bootstrap, and one that points at nothing is warned about. With the
|
|
7
|
+
* preview button pressed it does reach it, and opens the container as the
|
|
8
|
+
* page will, until the button is let go. Not a public
|
|
9
|
+
* API: the build puts a copy of this file in each plugin that imports it,
|
|
10
|
+
* so it keeps nothing of its own between plugins.
|
|
11
|
+
*/
|
|
12
|
+
import * as dom from '../dom.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The trigger handling of one kind of container.
|
|
16
|
+
*
|
|
17
|
+
* `kind` names the container (`popup`), its classes (`ge-popup-trigger`,
|
|
18
|
+
* `ge-popup-orphan`) and the event for a trigger left pointing at nothing
|
|
19
|
+
* (`popup-orphan`). `idAttribute` is the attribute a container has its id in,
|
|
20
|
+
* `targetAttribute` the one a trigger names it with, and `toggle` is
|
|
21
|
+
* Bootstrap's `data-bs-toggle` for it, written on the way out.
|
|
22
|
+
*
|
|
23
|
+
* Gives back `onInit`, `onDeinit` and `onPreviewChange`, for the plugin to
|
|
24
|
+
* hand the editor as its own, and `write(root)`, what onDeinit does to the
|
|
25
|
+
* canvas, for cleanMarkup to do to a copy.
|
|
26
|
+
*/
|
|
27
|
+
export function triggersFor(ge, kind, idAttribute, targetAttribute, toggle) {
|
|
28
|
+
var triggerClass = 'ge-' + kind + '-trigger';
|
|
29
|
+
var orphanClass = 'ge-' + kind + '-orphan';
|
|
30
|
+
var listening = null;
|
|
31
|
+
|
|
32
|
+
// What Bootstrap changes on a container as it opens and closes it
|
|
33
|
+
var STATE_ATTRIBUTES = ['style', 'aria-hidden', 'aria-modal', 'role'];
|
|
34
|
+
var STATE_CLASSES = ['show', 'showing', 'hiding'];
|
|
35
|
+
// Each container's element as the preview found it: what it goes back to
|
|
36
|
+
var before = new Map();
|
|
37
|
+
// The dismisses the preview gave back to Bootstrap, to take away again
|
|
38
|
+
var dismisses = [];
|
|
39
|
+
// What a getHtml in the middle of a preview took off, for onInit to put back
|
|
40
|
+
var saved = new Map();
|
|
41
|
+
// Where Bootstrap is with each container it has been asked to open:
|
|
42
|
+
// opening, open or closing, as its events tell. Not there once closed
|
|
43
|
+
var phases = new Map();
|
|
44
|
+
var watching = null;
|
|
45
|
+
// Let go of while Bootstrap was still closing them: what they go back to once it is done
|
|
46
|
+
var pending = new Map();
|
|
47
|
+
var PHASES = { show: 'opening', shown: 'open', hide: 'closing' };
|
|
48
|
+
|
|
49
|
+
function idOf(container) {
|
|
50
|
+
return container.getAttribute(idAttribute);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The modal, the panel: the element in a container with the container's id. */
|
|
54
|
+
function targetOf(container) {
|
|
55
|
+
var id = idOf(container);
|
|
56
|
+
|
|
57
|
+
return dom.all(container, '[id]').filter(function(node) { return node.id === id; })[0] || null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function targets() {
|
|
61
|
+
return dom.all(ge.canvas, '[' + idAttribute + ']').map(targetOf).filter(Boolean);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Whether a container with this id is on the canvas. */
|
|
65
|
+
function exists(id, root) {
|
|
66
|
+
return dom.all(root || ge.canvas, '[' + idAttribute + ']').some(function(container) {
|
|
67
|
+
return idOf(container) === id;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function wire() {
|
|
72
|
+
dom.all(ge.canvas, '[' + targetAttribute + ']').forEach(function(trigger) {
|
|
73
|
+
dom.addClass(trigger, triggerClass);
|
|
74
|
+
var wanted = trigger.getAttribute(targetAttribute);
|
|
75
|
+
|
|
76
|
+
// Bootstrap's own attributes are written at getHtml time, not
|
|
77
|
+
// while editing, so a click here cannot open a real container
|
|
78
|
+
trigger.removeAttribute('data-bs-toggle');
|
|
79
|
+
trigger.removeAttribute('data-bs-target');
|
|
80
|
+
|
|
81
|
+
if (exists(wanted)) {
|
|
82
|
+
dom.removeClass(trigger, orphanClass);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var column = trigger.closest('.column');
|
|
87
|
+
var nearby = column ? dom.all(column, '[' + idAttribute + ']') : [];
|
|
88
|
+
|
|
89
|
+
if (nearby.length === 1) {
|
|
90
|
+
trigger.setAttribute(targetAttribute, idOf(nearby[0]));
|
|
91
|
+
dom.removeClass(trigger, orphanClass);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
dom.addClass(trigger, orphanClass);
|
|
96
|
+
|
|
97
|
+
ge.operate(function() {
|
|
98
|
+
ge.emit(kind + '-orphan', ge.payloadFor(kind, trigger, {
|
|
99
|
+
parent: trigger.parentElement,
|
|
100
|
+
source: 'api',
|
|
101
|
+
missing: wanted,
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Bootstrap's own attributes on the triggers that point at something. */
|
|
108
|
+
function arm(root) {
|
|
109
|
+
dom.all(root, '[' + targetAttribute + ']').forEach(function(trigger) {
|
|
110
|
+
var wanted = trigger.getAttribute(targetAttribute);
|
|
111
|
+
if (!exists(wanted, root)) { return; }
|
|
112
|
+
|
|
113
|
+
trigger.setAttribute('data-bs-toggle', toggle);
|
|
114
|
+
trigger.setAttribute('data-bs-target', '#' + wanted);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function disarm() {
|
|
119
|
+
dom.all(ge.canvas, '[' + targetAttribute + ']').forEach(function(trigger) {
|
|
120
|
+
trigger.removeAttribute('data-bs-toggle');
|
|
121
|
+
trigger.removeAttribute('data-bs-target');
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function write(root) {
|
|
126
|
+
root = root || ge.canvas;
|
|
127
|
+
|
|
128
|
+
// The warning marking is editing furniture, whether or not
|
|
129
|
+
// the trigger can be wired up
|
|
130
|
+
dom.all(root, '[' + targetAttribute + ']').forEach(function(trigger) {
|
|
131
|
+
dom.removeClass(trigger, orphanClass);
|
|
132
|
+
dom.dropEmptyClass(trigger);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
arm(root);
|
|
136
|
+
|
|
137
|
+
// A container the preview opened is read as the preview found it,
|
|
138
|
+
// whether the preview goes on or Bootstrap is still closing it
|
|
139
|
+
var quiet = new Map();
|
|
140
|
+
before.forEach(function(state, target) { quiet.set(target.id, state); });
|
|
141
|
+
pending.forEach(function(state, target) { quiet.set(target.id, state); });
|
|
142
|
+
if (!quiet.size) { return; }
|
|
143
|
+
|
|
144
|
+
dom.all(root, '[id]').forEach(function(node) {
|
|
145
|
+
if (quiet.has(node.id)) { putState(node, quiet.get(node.id)); }
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** What Bootstrap may change on a container, as it is now. */
|
|
150
|
+
function stateOf(target) {
|
|
151
|
+
var state = { classes: STATE_CLASSES.filter(function(name) { return dom.hasClass(target, name); }) };
|
|
152
|
+
STATE_ATTRIBUTES.forEach(function(name) { state[name] = target.getAttribute(name); });
|
|
153
|
+
return state;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function putState(target, state) {
|
|
157
|
+
STATE_CLASSES.forEach(function(name) { dom.toggleClass(target, name, state.classes.indexOf(name) !== -1); });
|
|
158
|
+
STATE_ATTRIBUTES.forEach(function(name) {
|
|
159
|
+
// Read first: a style Bootstrap last wrote through the element's
|
|
160
|
+
// style object is only written to the attribute when it is read,
|
|
161
|
+
// and would otherwise come back, empty, after it is taken off
|
|
162
|
+
target.getAttribute(name);
|
|
163
|
+
|
|
164
|
+
if (state[name] === null) {
|
|
165
|
+
target.removeAttribute(name);
|
|
166
|
+
} else {
|
|
167
|
+
target.setAttribute(name, state[name]);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The preview pressed: the triggers reach Bootstrap, and so do the
|
|
174
|
+
* container's own close buttons, which editing keeps from it.
|
|
175
|
+
*/
|
|
176
|
+
function startPreview() {
|
|
177
|
+
// Again after a getHtml, whose init took them away once more
|
|
178
|
+
dismisses = [];
|
|
179
|
+
targets().forEach(function(target) {
|
|
180
|
+
if (!before.has(target)) { before.set(target, stateOf(target)); }
|
|
181
|
+
|
|
182
|
+
dom.all(target, '[data-ge-bs-dismiss="' + toggle + '"]').forEach(function(dismiss) {
|
|
183
|
+
ge.resumeToggles(dismiss);
|
|
184
|
+
dismisses.push(dismiss);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
arm(ge.canvas);
|
|
188
|
+
|
|
189
|
+
if (watching) { watching.abort(); }
|
|
190
|
+
watching = new AbortController();
|
|
191
|
+
['show', 'shown', 'hide', 'hidden'].forEach(function(name) {
|
|
192
|
+
ge.canvas.addEventListener(name + '.bs.' + toggle, function(e) {
|
|
193
|
+
if (!before.has(e.target)) { return; }
|
|
194
|
+
|
|
195
|
+
if (name === 'hidden') {
|
|
196
|
+
phases.delete(e.target);
|
|
197
|
+
} else {
|
|
198
|
+
phases.set(e.target, PHASES[name]);
|
|
199
|
+
}
|
|
200
|
+
}, { signal: watching.signal });
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Bootstrap's component for this kind, when the page has it on window. */
|
|
205
|
+
function component() {
|
|
206
|
+
var bootstrap = window.bootstrap;
|
|
207
|
+
var name = toggle.charAt(0).toUpperCase() + toggle.slice(1);
|
|
208
|
+
|
|
209
|
+
return bootstrap && bootstrap[name] && bootstrap[name].getInstance ? bootstrap[name] : null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Ask Bootstrap to close a container: through its instance, or, for a
|
|
214
|
+
* page with no window.bootstrap - an app that imports it - through its
|
|
215
|
+
* own close button, which its data api still listens for.
|
|
216
|
+
*/
|
|
217
|
+
function closer(target) {
|
|
218
|
+
var Component = component();
|
|
219
|
+
var instance = Component ? Component.getInstance(target) : null;
|
|
220
|
+
if (instance) { return function() { instance.hide(); }; }
|
|
221
|
+
|
|
222
|
+
var dismiss = dom.one(target, '[data-bs-dismiss="' + toggle + '"], [data-ge-bs-dismiss="' + toggle + '"]');
|
|
223
|
+
if (!dismiss) { return null; }
|
|
224
|
+
|
|
225
|
+
return function() {
|
|
226
|
+
ge.resumeToggles(dismiss);
|
|
227
|
+
dismiss.click();
|
|
228
|
+
ge.suspendToggles(dismiss);
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The preview let go: an open container is closed, by Bootstrap so its
|
|
234
|
+
* backdrop and the page's scroll go back too, and each is left as the
|
|
235
|
+
* preview found it once Bootstrap is done with it. One still opening is
|
|
236
|
+
* closed when it has opened, as Bootstrap will not close it before.
|
|
237
|
+
*/
|
|
238
|
+
function endPreview() {
|
|
239
|
+
if (watching) { watching.abort(); }
|
|
240
|
+
watching = null;
|
|
241
|
+
|
|
242
|
+
before.forEach(function(state, target) {
|
|
243
|
+
var phase = phases.get(target);
|
|
244
|
+
var close = phase && phase !== 'closing' ? closer(target) : null;
|
|
245
|
+
var restore = function() {
|
|
246
|
+
pending.delete(target);
|
|
247
|
+
putState(target, state);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
if (!phase || (phase !== 'closing' && !close)) {
|
|
251
|
+
restore();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
pending.set(target, state);
|
|
256
|
+
target.addEventListener('hidden.bs.' + toggle, restore, { once: true });
|
|
257
|
+
if (phase === 'opening') {
|
|
258
|
+
target.addEventListener('shown.bs.' + toggle, close, { once: true });
|
|
259
|
+
} else if (phase === 'open') {
|
|
260
|
+
close();
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
before = new Map();
|
|
264
|
+
phases = new Map();
|
|
265
|
+
|
|
266
|
+
dismisses.forEach(function(dismiss) { ge.suspendToggles(dismiss); });
|
|
267
|
+
dismisses = [];
|
|
268
|
+
disarm();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
write: write,
|
|
273
|
+
|
|
274
|
+
// Triggers are markup the host owns, anywhere in the canvas, so they
|
|
275
|
+
// are looked at whenever the canvas is initialized rather than only
|
|
276
|
+
// when a container is touched
|
|
277
|
+
onInit: function() {
|
|
278
|
+
wire();
|
|
279
|
+
|
|
280
|
+
if (listening) { listening.abort(); }
|
|
281
|
+
listening = new AbortController();
|
|
282
|
+
|
|
283
|
+
// A trigger is often a link, and a link still navigates even
|
|
284
|
+
// with its Bootstrap attributes suspended
|
|
285
|
+
dom.delegate(ge.canvas, 'click', '.' + triggerClass + ', [' + targetAttribute + ']', function(e) {
|
|
286
|
+
if (dom.hasClass(ge.canvas, 'ge-editing')) { e.preventDefault(); }
|
|
287
|
+
}, { signal: listening.signal });
|
|
288
|
+
|
|
289
|
+
// A getHtml in the middle of a preview: back to what it was
|
|
290
|
+
if (ge.previewing()) {
|
|
291
|
+
var live = new Map(saved);
|
|
292
|
+
saved = new Map();
|
|
293
|
+
startPreview();
|
|
294
|
+
live.forEach(function(state, target) {
|
|
295
|
+
if (ge.canvas.contains(target)) { putState(target, state); }
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
onDeinit: function() {
|
|
301
|
+
if (listening) { listening.abort(); }
|
|
302
|
+
listening = null;
|
|
303
|
+
|
|
304
|
+
// In the middle of a preview, write reads the markup as the
|
|
305
|
+
// preview found it, not with a container open: onInit puts it back
|
|
306
|
+
if (ge.previewing()) {
|
|
307
|
+
before.forEach(function(state, target) { saved.set(target, stateOf(target)); });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
write();
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
onPreviewChange: function(previewing) {
|
|
314
|
+
if (previewing) {
|
|
315
|
+
startPreview();
|
|
316
|
+
} else {
|
|
317
|
+
endPreview();
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
}
|
package/src/less/grideditor.less
CHANGED
|
@@ -1040,6 +1040,66 @@ html.ge-sidebar-open {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
|
+
/* An offcanvas is rendered unfolded and in place too: a plain block with
|
|
1044
|
+
its body as an ordinary region, whichever edge it comes from on the
|
|
1045
|
+
page. Bootstrap fixes it to the window, hides it and shifts it out
|
|
1046
|
+
until its own JS adds .show, which the editor never asks for, so what
|
|
1047
|
+
it sets is undone here. The responsive classes hide the header and
|
|
1048
|
+
the body's padding from their breakpoint up, where the panel is
|
|
1049
|
+
content: the title still has to be there to edit */
|
|
1050
|
+
@ge-offcanvases: offcanvas, offcanvas-sm, offcanvas-md, offcanvas-lg, offcanvas-xl, offcanvas-xxl;
|
|
1051
|
+
|
|
1052
|
+
.ge-container-offcanvas {
|
|
1053
|
+
each(@ge-offcanvases, {
|
|
1054
|
+
.@{value} {
|
|
1055
|
+
position: static;
|
|
1056
|
+
z-index: auto;
|
|
1057
|
+
visibility: visible;
|
|
1058
|
+
width: auto;
|
|
1059
|
+
height: auto;
|
|
1060
|
+
max-width: none;
|
|
1061
|
+
max-height: none;
|
|
1062
|
+
margin: @editGutter 0;
|
|
1063
|
+
transform: none;
|
|
1064
|
+
transition: none;
|
|
1065
|
+
display: flex;
|
|
1066
|
+
flex-direction: column;
|
|
1067
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
1068
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
1069
|
+
|
|
1070
|
+
.offcanvas-header {
|
|
1071
|
+
display: flex;
|
|
1072
|
+
}
|
|
1073
|
+
.offcanvas-body {
|
|
1074
|
+
display: block;
|
|
1075
|
+
flex-grow: 1;
|
|
1076
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
1077
|
+
overflow: visible;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
/* d-*-none on the trigger is for the page: the editor needs it to select the container */
|
|
1083
|
+
> .ge-offcanvas-trigger {
|
|
1084
|
+
display: inline-block !important;
|
|
1085
|
+
margin-bottom: @editGutter;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/* Folded away, for a page with several offcanvases on it */
|
|
1089
|
+
&.ge-offcanvas-collapsed {
|
|
1090
|
+
each(@ge-offcanvases, {
|
|
1091
|
+
.@{value} {
|
|
1092
|
+
display: none;
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/* A trigger pointing at an offcanvas that is not there any more */
|
|
1099
|
+
.ge-offcanvas-orphan {
|
|
1100
|
+
outline: 2px dashed #d9534f;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1043
1103
|
/* A trigger pointing at a popup that is not there any more */
|
|
1044
1104
|
.ge-popup-orphan {
|
|
1045
1105
|
outline: 2px dashed #d9534f;
|
package/types/grideditor.d.ts
CHANGED
|
@@ -111,6 +111,35 @@ export interface CarouselOptions {
|
|
|
111
111
|
/** createContainer('carousel', …): the options, and how many slides. */
|
|
112
112
|
export interface CreateCarouselOptions extends Placement, CarouselOptions {}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The offcanvas plugin's options, the ones an offcanvas made new has, as the
|
|
116
|
+
* offcanvas setting gives them and createContainer overrides them: where it
|
|
117
|
+
* comes from, its backdrop, whether the page scrolls behind it, Esc, the
|
|
118
|
+
* breakpoint from which it is content and not a panel, and the dark theme.
|
|
119
|
+
*/
|
|
120
|
+
export interface OffcanvasOptions {
|
|
121
|
+
/** The edge it slides in from. Default `'start'`. */
|
|
122
|
+
placement?: 'start' | 'end' | 'top' | 'bottom';
|
|
123
|
+
/** A backdrop behind it: `true`, `false`, or `'static'`, which does not close it on a click. Default true. */
|
|
124
|
+
backdrop?: boolean | 'static';
|
|
125
|
+
/** The page can scroll while it is open. Default false. */
|
|
126
|
+
scroll?: boolean;
|
|
127
|
+
/** Esc closes it. Default true. */
|
|
128
|
+
keyboard?: boolean;
|
|
129
|
+
/** From this breakpoint up it is content in the page, and its trigger is hidden; null is a panel at every size. Default null. */
|
|
130
|
+
responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | null;
|
|
131
|
+
/** `data-bs-theme="dark"`. Default false. */
|
|
132
|
+
dark?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** createContainer('offcanvas', …): the options, its title and its trigger. */
|
|
136
|
+
export interface CreateOffcanvasOptions extends Placement, OffcanvasOptions {
|
|
137
|
+
title?: string;
|
|
138
|
+
/** false makes none, for a trigger the page writes itself. Default true. */
|
|
139
|
+
trigger?: boolean;
|
|
140
|
+
trigger_label?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
114
143
|
/** The inline-style plugin's settings. */
|
|
115
144
|
export interface InlineStyleOptions {
|
|
116
145
|
/** Every section is on unless it is turned off here. */
|
|
@@ -175,6 +204,8 @@ export interface GridEditorOptions {
|
|
|
175
204
|
tabs?: TabsOptions;
|
|
176
205
|
/** The carousel plugin: the options of the carousels made new. */
|
|
177
206
|
carousel?: CarouselOptions;
|
|
207
|
+
/** The offcanvas plugin: the options of the offcanvases made new. */
|
|
208
|
+
offcanvas?: OffcanvasOptions;
|
|
178
209
|
elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
|
|
179
210
|
/** The autosave plugin: what is edited, kept in the browser's storage as it changes. */
|
|
180
211
|
autosave?: AutosaveOptions;
|
|
@@ -347,6 +378,10 @@ export interface PopupOrphanPayload extends Payload {
|
|
|
347
378
|
missing: string;
|
|
348
379
|
}
|
|
349
380
|
|
|
381
|
+
export interface OffcanvasOrphanPayload extends Payload {
|
|
382
|
+
missing: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
350
385
|
export interface ViewChangePayload {
|
|
351
386
|
canvas: HTMLElement;
|
|
352
387
|
breakpoint: View;
|
|
@@ -361,6 +396,12 @@ export interface TargetChangePayload {
|
|
|
361
396
|
from: HTMLElement | null;
|
|
362
397
|
}
|
|
363
398
|
|
|
399
|
+
/** The preview button was pressed (true) or let go (false). */
|
|
400
|
+
export interface PreviewChangePayload {
|
|
401
|
+
canvas: HTMLElement;
|
|
402
|
+
previewing: boolean;
|
|
403
|
+
}
|
|
404
|
+
|
|
364
405
|
/** The selection changed, with settings_panel 'sidebar': the node whose settings the sidebar shows, or null. */
|
|
365
406
|
export interface SelectionChangePayload {
|
|
366
407
|
canvas: HTMLElement;
|
|
@@ -406,7 +447,9 @@ export interface GridEditorEventMap {
|
|
|
406
447
|
'grideditor:after-edit-html': EditHtmlPayload;
|
|
407
448
|
'grideditor:after-copy': Payload;
|
|
408
449
|
'grideditor:popup-orphan': PopupOrphanPayload;
|
|
450
|
+
'grideditor:offcanvas-orphan': OffcanvasOrphanPayload;
|
|
409
451
|
'grideditor:view-change': ViewChangePayload;
|
|
452
|
+
'grideditor:preview-change': PreviewChangePayload;
|
|
410
453
|
'grideditor:target-change': TargetChangePayload;
|
|
411
454
|
'grideditor:selection-change': SelectionChangePayload;
|
|
412
455
|
'grideditor:after-autosave': AutosavePayload;
|
|
@@ -537,6 +580,7 @@ export declare class GridEditor {
|
|
|
537
580
|
createSection(options?: CreateSectionOptions): HTMLElement | null;
|
|
538
581
|
createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
|
|
539
582
|
createContainer(type: 'carousel', options?: CreateCarouselOptions): HTMLElement | null;
|
|
583
|
+
createContainer(type: 'offcanvas', options?: CreateOffcanvasOptions): HTMLElement | null;
|
|
540
584
|
createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
|
|
541
585
|
addTab(container: Target, options?: PaneOptions): HTMLElement | null;
|
|
542
586
|
addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;
|