@themarioga/grid-editor 9.0.0 → 9.1.1
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 +36 -0
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.esm.js +168 -54
- package/dist/grideditor.js +168 -54
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/plugins/grideditor.carousel.esm.js +8 -2
- package/dist/plugins/grideditor.carousel.js +8 -2
- package/dist/plugins/grideditor.carousel.min.js +1 -1
- package/dist/plugins/grideditor.carousel.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.esm.js +1 -1
- package/dist/plugins/grideditor.clipboard.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js.map +2 -2
- package/dist/plugins/grideditor.inline-style.esm.js +32 -16
- package/dist/plugins/grideditor.inline-style.js +32 -16
- package/dist/plugins/grideditor.inline-style.min.js +4 -4
- package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
- package/dist/plugins/grideditor.offcanvas.esm.js +7 -1
- package/dist/plugins/grideditor.offcanvas.js +7 -1
- package/dist/plugins/grideditor.offcanvas.min.js +1 -1
- package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
- package/dist/plugins/grideditor.sections.esm.js +1 -1
- package/dist/plugins/grideditor.sections.js +1 -1
- package/dist/plugins/grideditor.sections.min.js +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.esm.js +7 -1
- package/dist/plugins/grideditor.tabs.js +7 -1
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/docs/plugins.md +10 -2
- package/package.json +1 -1
- package/src/js/grideditor.js +187 -56
- package/src/js/inline-style/catalog.js +1 -1
- package/src/js/inline-style/drawerflow.js +35 -14
- package/src/js/plugins/grideditor.carousel.js +9 -2
- package/src/js/plugins/grideditor.clipboard.js +1 -1
- package/src/js/plugins/grideditor.inline-style.js +3 -0
- package/src/js/plugins/grideditor.offcanvas.js +8 -1
- package/src/js/plugins/grideditor.sections.js +1 -1
- package/src/js/plugins/grideditor.tabs.js +8 -1
package/dist/grideditor.esm.js
CHANGED
|
@@ -685,6 +685,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
685
685
|
var toolbarGroup = null;
|
|
686
686
|
var warnedHere = {};
|
|
687
687
|
var sortables = [];
|
|
688
|
+
var sortableKinds = /* @__PURE__ */ new WeakMap();
|
|
688
689
|
var instanceId = ++editorCounter;
|
|
689
690
|
var destroyed = false;
|
|
690
691
|
var sidebarCollapsed = null;
|
|
@@ -698,6 +699,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
701
|
var detailsFor = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
var panelBodies = /* @__PURE__ */ new WeakMap();
|
|
701
703
|
var toolActions = /* @__PURE__ */ new WeakMap();
|
|
702
704
|
var pendingDelete = null;
|
|
703
705
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
@@ -1165,7 +1167,23 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1165
1167
|
createMainControls();
|
|
1166
1168
|
watchDrawers();
|
|
1167
1169
|
var signal = { signal: lifetime.signal };
|
|
1168
|
-
|
|
1170
|
+
var scrollFrame = null;
|
|
1171
|
+
window.addEventListener("scroll", function() {
|
|
1172
|
+
if (scrollFrame !== null) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
scrollFrame = window.requestAnimationFrame(function() {
|
|
1176
|
+
scrollFrame = null;
|
|
1177
|
+
if (!destroyed && mainControls) {
|
|
1178
|
+
onScroll();
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
}, signal);
|
|
1182
|
+
lifetime.signal.addEventListener("abort", function() {
|
|
1183
|
+
if (scrollFrame !== null) {
|
|
1184
|
+
window.cancelAnimationFrame(scrollFrame);
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1169
1187
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1170
1188
|
if (settings.active_target) {
|
|
1171
1189
|
var pressed = null;
|
|
@@ -2228,19 +2246,27 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2228
2246
|
return names;
|
|
2229
2247
|
}
|
|
2230
2248
|
function copyCanvas() {
|
|
2231
|
-
var copy = canvas.cloneNode(true);
|
|
2232
2249
|
var toLive = /* @__PURE__ */ new Map();
|
|
2233
2250
|
var toCopy = /* @__PURE__ */ new Map();
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
toLive.set(
|
|
2240
|
-
toCopy.set(
|
|
2241
|
-
|
|
2242
|
-
|
|
2251
|
+
function copyNode(live) {
|
|
2252
|
+
var copied = live.cloneNode(live.nodeName === "TEMPLATE");
|
|
2253
|
+
if (live.nodeType !== 1) {
|
|
2254
|
+
return copied;
|
|
2255
|
+
}
|
|
2256
|
+
toLive.set(copied, live);
|
|
2257
|
+
toCopy.set(live, copied);
|
|
2258
|
+
if (live.nodeName === "TEMPLATE") {
|
|
2259
|
+
return copied;
|
|
2260
|
+
}
|
|
2261
|
+
for (var child2 = live.firstChild; child2; child2 = child2.nextSibling) {
|
|
2262
|
+
if (child2.nodeType === 1 && hasClass(child2, "ge-tools-drawer")) {
|
|
2263
|
+
continue;
|
|
2264
|
+
}
|
|
2265
|
+
copied.appendChild(copyNode(child2));
|
|
2266
|
+
}
|
|
2267
|
+
return copied;
|
|
2243
2268
|
}
|
|
2269
|
+
var copy = copyNode(canvas);
|
|
2244
2270
|
return {
|
|
2245
2271
|
root: copy,
|
|
2246
2272
|
liveOf: function(node) {
|
|
@@ -2476,8 +2502,16 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2476
2502
|
attachPicker,
|
|
2477
2503
|
openPicker,
|
|
2478
2504
|
closePicker: closeSizePicker,
|
|
2479
|
-
// A node's settings panel, in its drawer or open outside it
|
|
2480
|
-
|
|
2505
|
+
// A node's settings panel, in its drawer or open outside it,
|
|
2506
|
+
// whole: { build: false } for it as it is, without what is
|
|
2507
|
+
// built only while it is open
|
|
2508
|
+
detailsOf: function(node, options) {
|
|
2509
|
+
var details = detailsOf(node);
|
|
2510
|
+
if (details && !(options && options.build === false)) {
|
|
2511
|
+
buildPanelBody(details);
|
|
2512
|
+
}
|
|
2513
|
+
return details;
|
|
2514
|
+
},
|
|
2481
2515
|
// A node's drawer: its first child, or for a content area the
|
|
2482
2516
|
// one beside it in its text block
|
|
2483
2517
|
drawerOf,
|
|
@@ -3465,15 +3499,15 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3465
3499
|
}
|
|
3466
3500
|
function flush() {
|
|
3467
3501
|
frame = null;
|
|
3468
|
-
var drawers = Array.from(due)
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
if (!drawer.isConnected) {
|
|
3472
|
-
drawerResizes.unobserve(drawer);
|
|
3473
|
-
return;
|
|
3502
|
+
var drawers = Array.from(due).filter(function(drawer) {
|
|
3503
|
+
if (drawer.isConnected) {
|
|
3504
|
+
return true;
|
|
3474
3505
|
}
|
|
3475
|
-
|
|
3506
|
+
drawerResizes.unobserve(drawer);
|
|
3507
|
+
return false;
|
|
3476
3508
|
});
|
|
3509
|
+
due.clear();
|
|
3510
|
+
fitDrawers(drawers);
|
|
3477
3511
|
}
|
|
3478
3512
|
var drawerResizes = new window.ResizeObserver(function(entries) {
|
|
3479
3513
|
entries.forEach(function(entry) {
|
|
@@ -3515,36 +3549,58 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3515
3549
|
}
|
|
3516
3550
|
});
|
|
3517
3551
|
}
|
|
3518
|
-
function
|
|
3519
|
-
var
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3552
|
+
function fitDrawers(drawers) {
|
|
3553
|
+
var fits = drawers.map(function(drawer) {
|
|
3554
|
+
var fit = {
|
|
3555
|
+
drawer,
|
|
3556
|
+
tools: children(drawer, "a").filter(function(tool) {
|
|
3557
|
+
return !hasClass(tool, "ge-drawer-more");
|
|
3558
|
+
}),
|
|
3559
|
+
expanded: hasClass(drawer, "ge-drawer-expanded")
|
|
3560
|
+
};
|
|
3561
|
+
removeClass(drawer, "ge-drawer-overflow ge-drawer-expanded");
|
|
3562
|
+
fit.tools.forEach(function(tool) {
|
|
3563
|
+
removeClass(tool, "ge-tool-overflow");
|
|
3564
|
+
});
|
|
3565
|
+
return fit;
|
|
3526
3566
|
});
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
if (!child(drawer, ".ge-drawer-more")) {
|
|
3532
|
-
createTool(drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3533
|
-
toggleClass(drawer, "ge-drawer-expanded");
|
|
3567
|
+
var over = fits.filter(function(fit) {
|
|
3568
|
+
fit.rights = fit.tools.map(function(tool) {
|
|
3569
|
+
var rects = tool.getClientRects();
|
|
3570
|
+
return rects.length ? rects[0].right : null;
|
|
3534
3571
|
});
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3572
|
+
return overflows(fit, roomOf(fit.drawer));
|
|
3573
|
+
});
|
|
3574
|
+
over.forEach(function(fit) {
|
|
3575
|
+
addClass(fit.drawer, "ge-drawer-overflow");
|
|
3576
|
+
});
|
|
3577
|
+
over.forEach(function(fit) {
|
|
3578
|
+
fit.room = roomOf(fit.drawer);
|
|
3579
|
+
});
|
|
3580
|
+
over.forEach(function(fit) {
|
|
3581
|
+
for (var i = fit.tools.length - 1; i >= 0 && overflows(fit, fit.room, i); i--) {
|
|
3582
|
+
addClass(fit.tools[i], "ge-tool-overflow");
|
|
3583
|
+
}
|
|
3584
|
+
if (!child(fit.drawer, ".ge-drawer-more")) {
|
|
3585
|
+
createTool(fit.drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3586
|
+
toggleClass(fit.drawer, "ge-drawer-expanded");
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
toggleClass(fit.drawer, "ge-drawer-expanded", fit.expanded);
|
|
3590
|
+
});
|
|
3540
3591
|
}
|
|
3541
|
-
function
|
|
3592
|
+
function roomOf(drawer) {
|
|
3542
3593
|
var style = window.getComputedStyle(drawer);
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3594
|
+
return drawer.getBoundingClientRect().right - parseFloat(style.borderRightWidth) - parseFloat(style.paddingRight);
|
|
3595
|
+
}
|
|
3596
|
+
function overflows(fit, room, last) {
|
|
3597
|
+
last = last === void 0 ? fit.rights.length - 1 : last;
|
|
3598
|
+
for (var i = 0; i <= last; i++) {
|
|
3599
|
+
if (fit.rights[i] !== null && fit.rights[i] > room + 0.5) {
|
|
3600
|
+
return true;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
return false;
|
|
3548
3604
|
}
|
|
3549
3605
|
function createTool(drawer, title, className, iconClass, eventHandlers) {
|
|
3550
3606
|
var tool = element("a", { title, "class": className });
|
|
@@ -3668,14 +3724,42 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3668
3724
|
});
|
|
3669
3725
|
classGroup.appendChild(btn);
|
|
3670
3726
|
});
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3727
|
+
var anchor = detailsDiv.appendChild(document.createComment(" ge-details-body "));
|
|
3728
|
+
panelBodies.set(detailsDiv, { node: container, anchor, nodes: null });
|
|
3729
|
+
return detailsDiv;
|
|
3730
|
+
}
|
|
3731
|
+
function buildPanelBody(details) {
|
|
3732
|
+
var body = panelBodies.get(details);
|
|
3733
|
+
if (!body || body.nodes) {
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
var nodes = pluginSections(body.node);
|
|
3737
|
+
var utilities = createUtilitiesSection(body.node);
|
|
3675
3738
|
if (utilities) {
|
|
3676
|
-
|
|
3739
|
+
nodes.push(utilities);
|
|
3677
3740
|
}
|
|
3678
|
-
|
|
3741
|
+
nodes.forEach(function(node) {
|
|
3742
|
+
details.insertBefore(node, body.anchor);
|
|
3743
|
+
});
|
|
3744
|
+
body.nodes = nodes;
|
|
3745
|
+
}
|
|
3746
|
+
function dropPanelBody(details) {
|
|
3747
|
+
var body = panelBodies.get(details);
|
|
3748
|
+
if (!body || !body.nodes) {
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
if (dialogState && dialogState.home && details.contains(dialogState.home)) {
|
|
3752
|
+
closeDialog();
|
|
3753
|
+
}
|
|
3754
|
+
body.nodes.forEach(function(node) {
|
|
3755
|
+
node.remove();
|
|
3756
|
+
});
|
|
3757
|
+
body.nodes = null;
|
|
3758
|
+
pluginFields.forEach(function(fieldNode, field) {
|
|
3759
|
+
if (!field.isConnected) {
|
|
3760
|
+
pluginFields.delete(field);
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3679
3763
|
}
|
|
3680
3764
|
function sectionTitle(text) {
|
|
3681
3765
|
return element("h6", { "class": "ge-section-title" }, text);
|
|
@@ -3743,7 +3827,13 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3743
3827
|
function toggleSettings(node, details, gear) {
|
|
3744
3828
|
var mode = panelMode();
|
|
3745
3829
|
if (mode === "inline") {
|
|
3746
|
-
|
|
3830
|
+
if (visible(details)) {
|
|
3831
|
+
hide(details);
|
|
3832
|
+
dropPanelBody(details);
|
|
3833
|
+
} else {
|
|
3834
|
+
buildPanelBody(details);
|
|
3835
|
+
show(details);
|
|
3836
|
+
}
|
|
3747
3837
|
return;
|
|
3748
3838
|
}
|
|
3749
3839
|
var same = openSettingsState && openSettingsState.details === details;
|
|
@@ -3765,6 +3855,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3765
3855
|
listening
|
|
3766
3856
|
};
|
|
3767
3857
|
one(panel, ".ge-settings-title").textContent = t("panel.title", { kind: kindLabel(node) });
|
|
3858
|
+
buildPanelBody(details);
|
|
3768
3859
|
one(panel, ".ge-settings-body").appendChild(details);
|
|
3769
3860
|
show(details);
|
|
3770
3861
|
addClass(node, "ge-settings-target");
|
|
@@ -3831,6 +3922,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3831
3922
|
returnPanel(open);
|
|
3832
3923
|
}
|
|
3833
3924
|
function returnPanel(open) {
|
|
3925
|
+
dropPanelBody(open.details);
|
|
3834
3926
|
removeClass(open.node, "ge-settings-target");
|
|
3835
3927
|
open.details.style.removeProperty("display");
|
|
3836
3928
|
dropEmptyStyle(open.details);
|
|
@@ -4016,6 +4108,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
4016
4108
|
}
|
|
4017
4109
|
sidebarShown = { node: activeTarget, details, home: details.parentElement, next: details.nextElementSibling };
|
|
4018
4110
|
setSidebarTitle(t("panel.title", { kind: kindLabel(activeTarget) }));
|
|
4111
|
+
buildPanelBody(details);
|
|
4019
4112
|
holder.appendChild(details);
|
|
4020
4113
|
show(details);
|
|
4021
4114
|
}
|
|
@@ -4508,7 +4601,17 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
4508
4601
|
var wholeDrawer = settings.drag_handle === "drawer";
|
|
4509
4602
|
var cancel = dragCancelSelector();
|
|
4510
4603
|
var soloGroup = 0;
|
|
4604
|
+
var kind = options.draggable + "|" + (options.group || "");
|
|
4605
|
+
dropDetachedSortables();
|
|
4511
4606
|
lists.forEach(function(list) {
|
|
4607
|
+
var kinds = sortableKinds.get(list);
|
|
4608
|
+
if (kinds && kinds.has(kind)) {
|
|
4609
|
+
return;
|
|
4610
|
+
}
|
|
4611
|
+
if (!kinds) {
|
|
4612
|
+
sortableKinds.set(list, kinds = /* @__PURE__ */ new Set());
|
|
4613
|
+
}
|
|
4614
|
+
kinds.add(kind);
|
|
4512
4615
|
var group = options.group ? { name: groupName(options.group) } : { name: groupName(options.draggable + "-" + ++soloGroup), pull: false, put: false };
|
|
4513
4616
|
if (options.group && options.accepts) {
|
|
4514
4617
|
group.put = function(to, from, dragged) {
|
|
@@ -4818,6 +4921,17 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
4818
4921
|
sortableInstance.destroy();
|
|
4819
4922
|
});
|
|
4820
4923
|
sortables = [];
|
|
4924
|
+
sortableKinds = /* @__PURE__ */ new WeakMap();
|
|
4925
|
+
}
|
|
4926
|
+
function dropDetachedSortables() {
|
|
4927
|
+
sortables = sortables.filter(function(sortableInstance) {
|
|
4928
|
+
if (canvas.contains(sortableInstance.el)) {
|
|
4929
|
+
return true;
|
|
4930
|
+
}
|
|
4931
|
+
sortableInstance.destroy();
|
|
4932
|
+
sortableKinds.delete(sortableInstance.el);
|
|
4933
|
+
return false;
|
|
4934
|
+
});
|
|
4821
4935
|
}
|
|
4822
4936
|
function createRow() {
|
|
4823
4937
|
return element("div", { "class": "row" });
|
|
@@ -5270,7 +5384,7 @@ GridEditor.t = translate;
|
|
|
5270
5384
|
GridEditor._plainHtml = plainHtml;
|
|
5271
5385
|
GridEditor.Sortable = null;
|
|
5272
5386
|
GridEditor.bootstrap = null;
|
|
5273
|
-
GridEditor.version = false ? "dev" : "9.
|
|
5387
|
+
GridEditor.version = false ? "dev" : "9.1.1";
|
|
5274
5388
|
GridEditor.locales = {
|
|
5275
5389
|
en: {
|
|
5276
5390
|
"tool.move": "Move",
|
package/dist/grideditor.js
CHANGED
|
@@ -686,6 +686,7 @@
|
|
|
686
686
|
var toolbarGroup = null;
|
|
687
687
|
var warnedHere = {};
|
|
688
688
|
var sortables = [];
|
|
689
|
+
var sortableKinds = /* @__PURE__ */ new WeakMap();
|
|
689
690
|
var instanceId = ++editorCounter;
|
|
690
691
|
var destroyed = false;
|
|
691
692
|
var sidebarCollapsed = null;
|
|
@@ -699,6 +700,7 @@
|
|
|
699
700
|
}
|
|
700
701
|
}
|
|
701
702
|
var detailsFor = /* @__PURE__ */ new WeakMap();
|
|
703
|
+
var panelBodies = /* @__PURE__ */ new WeakMap();
|
|
702
704
|
var toolActions = /* @__PURE__ */ new WeakMap();
|
|
703
705
|
var pendingDelete = null;
|
|
704
706
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
@@ -1166,7 +1168,23 @@
|
|
|
1166
1168
|
createMainControls();
|
|
1167
1169
|
watchDrawers();
|
|
1168
1170
|
var signal = { signal: lifetime.signal };
|
|
1169
|
-
|
|
1171
|
+
var scrollFrame = null;
|
|
1172
|
+
window.addEventListener("scroll", function() {
|
|
1173
|
+
if (scrollFrame !== null) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
scrollFrame = window.requestAnimationFrame(function() {
|
|
1177
|
+
scrollFrame = null;
|
|
1178
|
+
if (!destroyed && mainControls) {
|
|
1179
|
+
onScroll();
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}, signal);
|
|
1183
|
+
lifetime.signal.addEventListener("abort", function() {
|
|
1184
|
+
if (scrollFrame !== null) {
|
|
1185
|
+
window.cancelAnimationFrame(scrollFrame);
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1170
1188
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1171
1189
|
if (settings.active_target) {
|
|
1172
1190
|
var pressed = null;
|
|
@@ -2229,19 +2247,27 @@
|
|
|
2229
2247
|
return names;
|
|
2230
2248
|
}
|
|
2231
2249
|
function copyCanvas() {
|
|
2232
|
-
var copy = canvas.cloneNode(true);
|
|
2233
2250
|
var toLive = /* @__PURE__ */ new Map();
|
|
2234
2251
|
var toCopy = /* @__PURE__ */ new Map();
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
toLive.set(
|
|
2241
|
-
toCopy.set(
|
|
2242
|
-
|
|
2243
|
-
|
|
2252
|
+
function copyNode(live) {
|
|
2253
|
+
var copied = live.cloneNode(live.nodeName === "TEMPLATE");
|
|
2254
|
+
if (live.nodeType !== 1) {
|
|
2255
|
+
return copied;
|
|
2256
|
+
}
|
|
2257
|
+
toLive.set(copied, live);
|
|
2258
|
+
toCopy.set(live, copied);
|
|
2259
|
+
if (live.nodeName === "TEMPLATE") {
|
|
2260
|
+
return copied;
|
|
2261
|
+
}
|
|
2262
|
+
for (var child2 = live.firstChild; child2; child2 = child2.nextSibling) {
|
|
2263
|
+
if (child2.nodeType === 1 && hasClass(child2, "ge-tools-drawer")) {
|
|
2264
|
+
continue;
|
|
2265
|
+
}
|
|
2266
|
+
copied.appendChild(copyNode(child2));
|
|
2267
|
+
}
|
|
2268
|
+
return copied;
|
|
2244
2269
|
}
|
|
2270
|
+
var copy = copyNode(canvas);
|
|
2245
2271
|
return {
|
|
2246
2272
|
root: copy,
|
|
2247
2273
|
liveOf: function(node) {
|
|
@@ -2477,8 +2503,16 @@
|
|
|
2477
2503
|
attachPicker,
|
|
2478
2504
|
openPicker,
|
|
2479
2505
|
closePicker: closeSizePicker,
|
|
2480
|
-
// A node's settings panel, in its drawer or open outside it
|
|
2481
|
-
|
|
2506
|
+
// A node's settings panel, in its drawer or open outside it,
|
|
2507
|
+
// whole: { build: false } for it as it is, without what is
|
|
2508
|
+
// built only while it is open
|
|
2509
|
+
detailsOf: function(node, options) {
|
|
2510
|
+
var details = detailsOf(node);
|
|
2511
|
+
if (details && !(options && options.build === false)) {
|
|
2512
|
+
buildPanelBody(details);
|
|
2513
|
+
}
|
|
2514
|
+
return details;
|
|
2515
|
+
},
|
|
2482
2516
|
// A node's drawer: its first child, or for a content area the
|
|
2483
2517
|
// one beside it in its text block
|
|
2484
2518
|
drawerOf,
|
|
@@ -3466,15 +3500,15 @@
|
|
|
3466
3500
|
}
|
|
3467
3501
|
function flush() {
|
|
3468
3502
|
frame = null;
|
|
3469
|
-
var drawers = Array.from(due)
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
if (!drawer.isConnected) {
|
|
3473
|
-
drawerResizes.unobserve(drawer);
|
|
3474
|
-
return;
|
|
3503
|
+
var drawers = Array.from(due).filter(function(drawer) {
|
|
3504
|
+
if (drawer.isConnected) {
|
|
3505
|
+
return true;
|
|
3475
3506
|
}
|
|
3476
|
-
|
|
3507
|
+
drawerResizes.unobserve(drawer);
|
|
3508
|
+
return false;
|
|
3477
3509
|
});
|
|
3510
|
+
due.clear();
|
|
3511
|
+
fitDrawers(drawers);
|
|
3478
3512
|
}
|
|
3479
3513
|
var drawerResizes = new window.ResizeObserver(function(entries) {
|
|
3480
3514
|
entries.forEach(function(entry) {
|
|
@@ -3516,36 +3550,58 @@
|
|
|
3516
3550
|
}
|
|
3517
3551
|
});
|
|
3518
3552
|
}
|
|
3519
|
-
function
|
|
3520
|
-
var
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3553
|
+
function fitDrawers(drawers) {
|
|
3554
|
+
var fits = drawers.map(function(drawer) {
|
|
3555
|
+
var fit = {
|
|
3556
|
+
drawer,
|
|
3557
|
+
tools: children(drawer, "a").filter(function(tool) {
|
|
3558
|
+
return !hasClass(tool, "ge-drawer-more");
|
|
3559
|
+
}),
|
|
3560
|
+
expanded: hasClass(drawer, "ge-drawer-expanded")
|
|
3561
|
+
};
|
|
3562
|
+
removeClass(drawer, "ge-drawer-overflow ge-drawer-expanded");
|
|
3563
|
+
fit.tools.forEach(function(tool) {
|
|
3564
|
+
removeClass(tool, "ge-tool-overflow");
|
|
3565
|
+
});
|
|
3566
|
+
return fit;
|
|
3527
3567
|
});
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
if (!child(drawer, ".ge-drawer-more")) {
|
|
3533
|
-
createTool(drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3534
|
-
toggleClass(drawer, "ge-drawer-expanded");
|
|
3568
|
+
var over = fits.filter(function(fit) {
|
|
3569
|
+
fit.rights = fit.tools.map(function(tool) {
|
|
3570
|
+
var rects = tool.getClientRects();
|
|
3571
|
+
return rects.length ? rects[0].right : null;
|
|
3535
3572
|
});
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3573
|
+
return overflows(fit, roomOf(fit.drawer));
|
|
3574
|
+
});
|
|
3575
|
+
over.forEach(function(fit) {
|
|
3576
|
+
addClass(fit.drawer, "ge-drawer-overflow");
|
|
3577
|
+
});
|
|
3578
|
+
over.forEach(function(fit) {
|
|
3579
|
+
fit.room = roomOf(fit.drawer);
|
|
3580
|
+
});
|
|
3581
|
+
over.forEach(function(fit) {
|
|
3582
|
+
for (var i = fit.tools.length - 1; i >= 0 && overflows(fit, fit.room, i); i--) {
|
|
3583
|
+
addClass(fit.tools[i], "ge-tool-overflow");
|
|
3584
|
+
}
|
|
3585
|
+
if (!child(fit.drawer, ".ge-drawer-more")) {
|
|
3586
|
+
createTool(fit.drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3587
|
+
toggleClass(fit.drawer, "ge-drawer-expanded");
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
toggleClass(fit.drawer, "ge-drawer-expanded", fit.expanded);
|
|
3591
|
+
});
|
|
3541
3592
|
}
|
|
3542
|
-
function
|
|
3593
|
+
function roomOf(drawer) {
|
|
3543
3594
|
var style = window.getComputedStyle(drawer);
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3595
|
+
return drawer.getBoundingClientRect().right - parseFloat(style.borderRightWidth) - parseFloat(style.paddingRight);
|
|
3596
|
+
}
|
|
3597
|
+
function overflows(fit, room, last) {
|
|
3598
|
+
last = last === void 0 ? fit.rights.length - 1 : last;
|
|
3599
|
+
for (var i = 0; i <= last; i++) {
|
|
3600
|
+
if (fit.rights[i] !== null && fit.rights[i] > room + 0.5) {
|
|
3601
|
+
return true;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
return false;
|
|
3549
3605
|
}
|
|
3550
3606
|
function createTool(drawer, title, className, iconClass, eventHandlers) {
|
|
3551
3607
|
var tool = element("a", { title, "class": className });
|
|
@@ -3669,14 +3725,42 @@
|
|
|
3669
3725
|
});
|
|
3670
3726
|
classGroup.appendChild(btn);
|
|
3671
3727
|
});
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3728
|
+
var anchor = detailsDiv.appendChild(document.createComment(" ge-details-body "));
|
|
3729
|
+
panelBodies.set(detailsDiv, { node: container, anchor, nodes: null });
|
|
3730
|
+
return detailsDiv;
|
|
3731
|
+
}
|
|
3732
|
+
function buildPanelBody(details) {
|
|
3733
|
+
var body = panelBodies.get(details);
|
|
3734
|
+
if (!body || body.nodes) {
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
var nodes = pluginSections(body.node);
|
|
3738
|
+
var utilities = createUtilitiesSection(body.node);
|
|
3676
3739
|
if (utilities) {
|
|
3677
|
-
|
|
3740
|
+
nodes.push(utilities);
|
|
3678
3741
|
}
|
|
3679
|
-
|
|
3742
|
+
nodes.forEach(function(node) {
|
|
3743
|
+
details.insertBefore(node, body.anchor);
|
|
3744
|
+
});
|
|
3745
|
+
body.nodes = nodes;
|
|
3746
|
+
}
|
|
3747
|
+
function dropPanelBody(details) {
|
|
3748
|
+
var body = panelBodies.get(details);
|
|
3749
|
+
if (!body || !body.nodes) {
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
if (dialogState && dialogState.home && details.contains(dialogState.home)) {
|
|
3753
|
+
closeDialog();
|
|
3754
|
+
}
|
|
3755
|
+
body.nodes.forEach(function(node) {
|
|
3756
|
+
node.remove();
|
|
3757
|
+
});
|
|
3758
|
+
body.nodes = null;
|
|
3759
|
+
pluginFields.forEach(function(fieldNode, field) {
|
|
3760
|
+
if (!field.isConnected) {
|
|
3761
|
+
pluginFields.delete(field);
|
|
3762
|
+
}
|
|
3763
|
+
});
|
|
3680
3764
|
}
|
|
3681
3765
|
function sectionTitle(text) {
|
|
3682
3766
|
return element("h6", { "class": "ge-section-title" }, text);
|
|
@@ -3744,7 +3828,13 @@
|
|
|
3744
3828
|
function toggleSettings(node, details, gear) {
|
|
3745
3829
|
var mode = panelMode();
|
|
3746
3830
|
if (mode === "inline") {
|
|
3747
|
-
|
|
3831
|
+
if (visible(details)) {
|
|
3832
|
+
hide(details);
|
|
3833
|
+
dropPanelBody(details);
|
|
3834
|
+
} else {
|
|
3835
|
+
buildPanelBody(details);
|
|
3836
|
+
show(details);
|
|
3837
|
+
}
|
|
3748
3838
|
return;
|
|
3749
3839
|
}
|
|
3750
3840
|
var same = openSettingsState && openSettingsState.details === details;
|
|
@@ -3766,6 +3856,7 @@
|
|
|
3766
3856
|
listening
|
|
3767
3857
|
};
|
|
3768
3858
|
one(panel, ".ge-settings-title").textContent = t("panel.title", { kind: kindLabel(node) });
|
|
3859
|
+
buildPanelBody(details);
|
|
3769
3860
|
one(panel, ".ge-settings-body").appendChild(details);
|
|
3770
3861
|
show(details);
|
|
3771
3862
|
addClass(node, "ge-settings-target");
|
|
@@ -3832,6 +3923,7 @@
|
|
|
3832
3923
|
returnPanel(open);
|
|
3833
3924
|
}
|
|
3834
3925
|
function returnPanel(open) {
|
|
3926
|
+
dropPanelBody(open.details);
|
|
3835
3927
|
removeClass(open.node, "ge-settings-target");
|
|
3836
3928
|
open.details.style.removeProperty("display");
|
|
3837
3929
|
dropEmptyStyle(open.details);
|
|
@@ -4017,6 +4109,7 @@
|
|
|
4017
4109
|
}
|
|
4018
4110
|
sidebarShown = { node: activeTarget, details, home: details.parentElement, next: details.nextElementSibling };
|
|
4019
4111
|
setSidebarTitle(t("panel.title", { kind: kindLabel(activeTarget) }));
|
|
4112
|
+
buildPanelBody(details);
|
|
4020
4113
|
holder.appendChild(details);
|
|
4021
4114
|
show(details);
|
|
4022
4115
|
}
|
|
@@ -4509,7 +4602,17 @@
|
|
|
4509
4602
|
var wholeDrawer = settings.drag_handle === "drawer";
|
|
4510
4603
|
var cancel = dragCancelSelector();
|
|
4511
4604
|
var soloGroup = 0;
|
|
4605
|
+
var kind = options.draggable + "|" + (options.group || "");
|
|
4606
|
+
dropDetachedSortables();
|
|
4512
4607
|
lists.forEach(function(list) {
|
|
4608
|
+
var kinds = sortableKinds.get(list);
|
|
4609
|
+
if (kinds && kinds.has(kind)) {
|
|
4610
|
+
return;
|
|
4611
|
+
}
|
|
4612
|
+
if (!kinds) {
|
|
4613
|
+
sortableKinds.set(list, kinds = /* @__PURE__ */ new Set());
|
|
4614
|
+
}
|
|
4615
|
+
kinds.add(kind);
|
|
4513
4616
|
var group = options.group ? { name: groupName(options.group) } : { name: groupName(options.draggable + "-" + ++soloGroup), pull: false, put: false };
|
|
4514
4617
|
if (options.group && options.accepts) {
|
|
4515
4618
|
group.put = function(to, from, dragged) {
|
|
@@ -4819,6 +4922,17 @@
|
|
|
4819
4922
|
sortableInstance.destroy();
|
|
4820
4923
|
});
|
|
4821
4924
|
sortables = [];
|
|
4925
|
+
sortableKinds = /* @__PURE__ */ new WeakMap();
|
|
4926
|
+
}
|
|
4927
|
+
function dropDetachedSortables() {
|
|
4928
|
+
sortables = sortables.filter(function(sortableInstance) {
|
|
4929
|
+
if (canvas.contains(sortableInstance.el)) {
|
|
4930
|
+
return true;
|
|
4931
|
+
}
|
|
4932
|
+
sortableInstance.destroy();
|
|
4933
|
+
sortableKinds.delete(sortableInstance.el);
|
|
4934
|
+
return false;
|
|
4935
|
+
});
|
|
4822
4936
|
}
|
|
4823
4937
|
function createRow() {
|
|
4824
4938
|
return element("div", { "class": "row" });
|
|
@@ -5271,7 +5385,7 @@
|
|
|
5271
5385
|
GridEditor._plainHtml = plainHtml;
|
|
5272
5386
|
GridEditor.Sortable = null;
|
|
5273
5387
|
GridEditor.bootstrap = null;
|
|
5274
|
-
GridEditor.version = false ? "dev" : "9.
|
|
5388
|
+
GridEditor.version = false ? "dev" : "9.1.1";
|
|
5275
5389
|
GridEditor.locales = {
|
|
5276
5390
|
en: {
|
|
5277
5391
|
"tool.move": "Move",
|