@themarioga/grid-editor 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +83 -14
- package/UPGRADING.md +31 -0
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +102 -0
- package/dist/grideditor.d.ts +18 -0
- package/dist/grideditor.esm.js +291 -31
- package/dist/grideditor.js +291 -31
- 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 +67 -0
- package/dist/locales/grideditor.es.js +67 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.float.esm.js +10 -1
- package/dist/plugins/grideditor.float.js +8 -2
- package/dist/plugins/grideditor.float.min.js +1 -1
- package/dist/plugins/grideditor.float.min.js.map +4 -4
- package/dist/plugins/grideditor.spacing.esm.js +12 -3
- package/dist/plugins/grideditor.spacing.js +9 -3
- package/dist/plugins/grideditor.spacing.min.js +1 -1
- package/dist/plugins/grideditor.spacing.min.js.map +4 -4
- package/dist/plugins/grideditor.style.esm.js +1593 -0
- package/dist/plugins/grideditor.style.js +1592 -0
- package/dist/plugins/grideditor.style.min.js +2 -0
- package/dist/plugins/grideditor.style.min.js.map +7 -0
- package/dist/plugins/grideditor.textalign.esm.js +10 -1
- package/dist/plugins/grideditor.textalign.js +8 -2
- package/dist/plugins/grideditor.textalign.min.js +1 -1
- package/dist/plugins/grideditor.textalign.min.js.map +4 -4
- package/dist/plugins/grideditor.visibility.esm.js +12 -3
- package/dist/plugins/grideditor.visibility.js +9 -3
- package/dist/plugins/grideditor.visibility.min.js +1 -1
- package/dist/plugins/grideditor.visibility.min.js.map +4 -4
- package/docs/locale-keys.md +86 -7
- package/docs/plugins.md +49 -5
- package/example/index.html +14 -0
- package/example/style.html +151 -0
- package/example/utilities.html +15 -11
- package/package.json +1 -1
- package/src/js/grideditor.js +365 -27
- package/src/js/locales/grideditor.es.js +67 -0
- package/src/js/plugins/grideditor.float.js +8 -33
- package/src/js/plugins/grideditor.spacing.js +8 -273
- package/src/js/plugins/grideditor.style.js +179 -0
- package/src/js/plugins/grideditor.textalign.js +8 -39
- package/src/js/plugins/grideditor.visibility.js +8 -147
- package/src/js/style/accordion.js +157 -0
- package/src/js/style/catalog.js +76 -0
- package/src/js/style/custom.js +84 -0
- package/src/js/style/fields.js +382 -0
- package/src/js/style/float.js +46 -0
- package/src/js/style/options.js +75 -0
- package/src/js/style/sections.js +271 -0
- package/src/js/style/spacing.js +286 -0
- package/src/js/style/textalign.js +52 -0
- package/src/js/style/visibility.js +160 -0
- package/src/less/grideditor.less +111 -0
- package/types/grideditor.d.ts +18 -0
package/dist/grideditor.d.ts
CHANGED
|
@@ -53,6 +53,22 @@ export interface PresetClass {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/** A content filter: run on init and deinit with the canvas. A string names a function on window. */
|
|
56
|
+
/** A section of the style plugin's accordion. */
|
|
57
|
+
export type StyleSectionKey = 'size' | 'spacing' | 'border' | 'background' | 'text' | 'typography' | 'display' | 'position' | 'custom';
|
|
58
|
+
|
|
59
|
+
/** A section on or off, or on with some of its properties and without its catalog. */
|
|
60
|
+
export type StyleSection = boolean | { properties?: string[]; catalog?: boolean };
|
|
61
|
+
|
|
62
|
+
/** The style plugin's settings. */
|
|
63
|
+
export interface StyleOptions {
|
|
64
|
+
/** Every section is on unless it is turned off here. */
|
|
65
|
+
sections?: Partial<Record<StyleSectionKey, StyleSection>>;
|
|
66
|
+
/** What utilities.spacing was: the values offered, and what 0 to 5 come to. */
|
|
67
|
+
spacing?: { values?: string[]; scale?: string[] };
|
|
68
|
+
/** What utilities.visibility was: false leaves the eye out of the drawers. */
|
|
69
|
+
visibility?: { drawer?: boolean };
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
export type CustomFilter = ((canvas: HTMLElement, isInit: boolean) => void) | string;
|
|
57
73
|
|
|
58
74
|
/** The settings. Every one is optional. */
|
|
@@ -79,6 +95,8 @@ export interface GridEditorOptions {
|
|
|
79
95
|
content_types?: string[];
|
|
80
96
|
row_cols?: boolean;
|
|
81
97
|
utilities?: Record<string, unknown>;
|
|
98
|
+
/** The style plugin's sections, and the options of the utilities it carries. */
|
|
99
|
+
style?: StyleOptions;
|
|
82
100
|
elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean };
|
|
83
101
|
custom_filter?: CustomFilter | CustomFilter[] | '';
|
|
84
102
|
valid_col_sizes?: ColumnSize[];
|
package/dist/grideditor.esm.js
CHANGED
|
@@ -659,6 +659,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
659
659
|
instance.settings = settingsCopy();
|
|
660
660
|
removeConfirmModal();
|
|
661
661
|
removeSettingsPanels();
|
|
662
|
+
removeDialog();
|
|
662
663
|
mainControls.remove();
|
|
663
664
|
createMainControls();
|
|
664
665
|
reset();
|
|
@@ -1609,6 +1610,9 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1609
1610
|
if (openSettingsState && !attached(openSettingsState.node)) {
|
|
1610
1611
|
closeSettings();
|
|
1611
1612
|
}
|
|
1613
|
+
if (dialogState && dialogState.home && !attached(dialogState.home)) {
|
|
1614
|
+
closeDialog();
|
|
1615
|
+
}
|
|
1612
1616
|
runFilter(true);
|
|
1613
1617
|
addClass(canvas, "ge-editing");
|
|
1614
1618
|
toggleClass(canvas, "ge-drag-drawer", settings.drag_handle === "drawer");
|
|
@@ -1632,9 +1636,11 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1632
1636
|
plugins("onBeforeDeinit");
|
|
1633
1637
|
closeSizePicker();
|
|
1634
1638
|
hideDropMarker();
|
|
1639
|
+
closeDialog();
|
|
1635
1640
|
all(canvas, ".ge-tools-drawer").forEach(function(drawer) {
|
|
1636
1641
|
drawer.remove();
|
|
1637
1642
|
});
|
|
1643
|
+
pluginFields.clear();
|
|
1638
1644
|
unwrapTexts();
|
|
1639
1645
|
plugins("onDeinit");
|
|
1640
1646
|
clearPreviews(canvas);
|
|
@@ -1670,6 +1676,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1670
1676
|
deinit();
|
|
1671
1677
|
removeConfirmModal();
|
|
1672
1678
|
removeSettingsPanels();
|
|
1679
|
+
removeDialog();
|
|
1673
1680
|
mainControls.remove();
|
|
1674
1681
|
htmlTextArea.remove();
|
|
1675
1682
|
lifetime.abort();
|
|
@@ -1682,25 +1689,53 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1682
1689
|
if (settings.row_cols !== false) {
|
|
1683
1690
|
registerFamily("grid", {}, rowColsFamily());
|
|
1684
1691
|
}
|
|
1685
|
-
var
|
|
1692
|
+
var replacedBy = {};
|
|
1693
|
+
[GridEditor.containers, GridEditor.features, GridEditor.utilities].forEach(function(registry) {
|
|
1694
|
+
Object.keys(registry).forEach(function(name) {
|
|
1695
|
+
(registry[name].replaces || []).forEach(function(old) {
|
|
1696
|
+
if (!replacedBy[old]) {
|
|
1697
|
+
replacedBy[old] = name;
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
});
|
|
1701
|
+
});
|
|
1702
|
+
var named = function(name) {
|
|
1686
1703
|
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1687
1704
|
};
|
|
1705
|
+
var namedAsOld = function(name) {
|
|
1706
|
+
return !!settings.plugins && settings.plugins.some(function(old) {
|
|
1707
|
+
return replacedBy[old] === name;
|
|
1708
|
+
});
|
|
1709
|
+
};
|
|
1710
|
+
var standsDown = function(name) {
|
|
1711
|
+
return !!replacedBy[name] && wanted(replacedBy[name]);
|
|
1712
|
+
};
|
|
1713
|
+
var wanted = function(name) {
|
|
1714
|
+
return !standsDown(name) && (named(name) || namedAsOld(name));
|
|
1715
|
+
};
|
|
1716
|
+
var replaced = function(name) {
|
|
1717
|
+
if (!standsDown(name) || !named(name)) {
|
|
1718
|
+
return false;
|
|
1719
|
+
}
|
|
1720
|
+
warnOnceHere("replaced:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '", which is loaded: ignoring it');
|
|
1721
|
+
return true;
|
|
1722
|
+
};
|
|
1688
1723
|
var featureWanted = function(name, factory) {
|
|
1689
1724
|
return factory.always === true || wanted(name);
|
|
1690
1725
|
};
|
|
1691
1726
|
Object.keys(GridEditor.containers).forEach(function(type) {
|
|
1692
|
-
if (wanted(type)) {
|
|
1727
|
+
if (!replaced(type) && wanted(type)) {
|
|
1693
1728
|
CONTAINERS[type] = GridEditor.containers[type](api);
|
|
1694
1729
|
}
|
|
1695
1730
|
});
|
|
1696
1731
|
Object.keys(GridEditor.features).forEach(function(name) {
|
|
1697
1732
|
var factory = GridEditor.features[name];
|
|
1698
|
-
if (featureWanted(name, factory)) {
|
|
1733
|
+
if (!replaced(name) && featureWanted(name, factory)) {
|
|
1699
1734
|
FEATURES[name] = factory(api);
|
|
1700
1735
|
}
|
|
1701
1736
|
});
|
|
1702
1737
|
Object.keys(GridEditor.utilities).forEach(function(name) {
|
|
1703
|
-
if (!wanted(name)) {
|
|
1738
|
+
if (replaced(name) || !wanted(name)) {
|
|
1704
1739
|
return;
|
|
1705
1740
|
}
|
|
1706
1741
|
UTILITIES[name] = GridEditor.utilities[name](api);
|
|
@@ -1718,6 +1753,10 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1718
1753
|
if (CONTAINERS[name] || FEATURES[name] || UTILITIES[name]) {
|
|
1719
1754
|
return;
|
|
1720
1755
|
}
|
|
1756
|
+
if (standsDown(name)) {
|
|
1757
|
+
warnOnceHere("renamed:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '" now: name "' + replacedBy[name] + '" in the plugins setting instead');
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1721
1760
|
warnOnceHere("plugin:" + name, 'the "' + name + '" plugin is not loaded: include dist/plugins/grideditor.' + name + ".js after the editor");
|
|
1722
1761
|
});
|
|
1723
1762
|
}
|
|
@@ -1766,6 +1805,12 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1766
1805
|
setUtility,
|
|
1767
1806
|
utilityField,
|
|
1768
1807
|
bareStyle,
|
|
1808
|
+
// The host's own style, under the preview
|
|
1809
|
+
hostStyle,
|
|
1810
|
+
setHostStyle,
|
|
1811
|
+
// A modal of the editor's own, over the settings
|
|
1812
|
+
openDialog,
|
|
1813
|
+
closeDialog,
|
|
1769
1814
|
rowFromLayout: rowFromLayoutValue,
|
|
1770
1815
|
nodeHtml,
|
|
1771
1816
|
// A text editor has rewritten a content area, so whatever the
|
|
@@ -2002,6 +2047,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2002
2047
|
renderUtilities(section);
|
|
2003
2048
|
});
|
|
2004
2049
|
}
|
|
2050
|
+
renderPluginFields(node);
|
|
2005
2051
|
refreshPreviews(node);
|
|
2006
2052
|
}
|
|
2007
2053
|
function utilityNodes(scope) {
|
|
@@ -2068,6 +2114,61 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2068
2114
|
dropEmptyStyle(node);
|
|
2069
2115
|
});
|
|
2070
2116
|
}
|
|
2117
|
+
function hostDeclaration(node) {
|
|
2118
|
+
var scratch = document.createElement("div");
|
|
2119
|
+
var was = {};
|
|
2120
|
+
scratch.style.cssText = node.style.cssText;
|
|
2121
|
+
try {
|
|
2122
|
+
was = JSON.parse(node.getAttribute(PREVIEW_ATTR)) || {};
|
|
2123
|
+
} catch (error) {
|
|
2124
|
+
}
|
|
2125
|
+
Object.keys(was).forEach(function(property) {
|
|
2126
|
+
var before = was[property];
|
|
2127
|
+
if (before && before[0]) {
|
|
2128
|
+
scratch.style.setProperty(property, before[0], before[1]);
|
|
2129
|
+
} else {
|
|
2130
|
+
scratch.style.removeProperty(property);
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
return scratch.style;
|
|
2134
|
+
}
|
|
2135
|
+
function hostStyle(node, property) {
|
|
2136
|
+
var declaration = hostDeclaration(node);
|
|
2137
|
+
if (property === void 0) {
|
|
2138
|
+
return declaration.cssText;
|
|
2139
|
+
}
|
|
2140
|
+
return {
|
|
2141
|
+
value: declaration.getPropertyValue(property),
|
|
2142
|
+
priority: declaration.getPropertyPriority(property)
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
function setHostStyle(node, property, value, priority) {
|
|
2146
|
+
value = value === null || value === void 0 ? "" : String(value).trim();
|
|
2147
|
+
if (priority === void 0) {
|
|
2148
|
+
priority = hostStyle(node, property).priority;
|
|
2149
|
+
}
|
|
2150
|
+
if (value !== "") {
|
|
2151
|
+
var check = document.createElement("div").style;
|
|
2152
|
+
check.setProperty(property, value, priority || "");
|
|
2153
|
+
if (check.getPropertyValue(property) === "") {
|
|
2154
|
+
return false;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
var previewed = node.hasAttribute(PREVIEW_ATTR);
|
|
2158
|
+
if (previewed) {
|
|
2159
|
+
clearPreviews(node);
|
|
2160
|
+
}
|
|
2161
|
+
if (value === "") {
|
|
2162
|
+
node.style.removeProperty(property);
|
|
2163
|
+
} else {
|
|
2164
|
+
node.style.setProperty(property, value, priority || "");
|
|
2165
|
+
}
|
|
2166
|
+
dropEmptyStyle(node);
|
|
2167
|
+
if (previewed) {
|
|
2168
|
+
refreshPreviews(node);
|
|
2169
|
+
}
|
|
2170
|
+
return true;
|
|
2171
|
+
}
|
|
2071
2172
|
function createUtilitiesSection(node) {
|
|
2072
2173
|
var kind = kindOf(node);
|
|
2073
2174
|
var fields = familiesFor(kind).filter(function(family) {
|
|
@@ -2124,8 +2225,25 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2124
2225
|
}
|
|
2125
2226
|
var field = createField(node, family);
|
|
2126
2227
|
renderField(field, node);
|
|
2228
|
+
pluginFields.set(field, node);
|
|
2127
2229
|
return field;
|
|
2128
2230
|
}
|
|
2231
|
+
var pluginFields = /* @__PURE__ */ new Map();
|
|
2232
|
+
function renderPluginFields(node) {
|
|
2233
|
+
pluginFields.forEach(function(fieldNode, field) {
|
|
2234
|
+
if (!field.isConnected) {
|
|
2235
|
+
pluginFields.delete(field);
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
if (node && fieldNode !== node) {
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
if (closest(field, ".ge-utilities")) {
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
renderField(field, fieldNode);
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2129
2247
|
function renderUtilities(section) {
|
|
2130
2248
|
var node = sectionNodes.get(section);
|
|
2131
2249
|
children(section, ".ge-utilities-toggle").forEach(function(toggle2) {
|
|
@@ -2669,12 +2787,50 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2669
2787
|
});
|
|
2670
2788
|
classGroup.appendChild(btn);
|
|
2671
2789
|
});
|
|
2790
|
+
pluginSections(container).forEach(function(section) {
|
|
2791
|
+
detailsDiv.appendChild(section);
|
|
2792
|
+
});
|
|
2672
2793
|
var utilities = createUtilitiesSection(container);
|
|
2673
2794
|
if (utilities) {
|
|
2674
2795
|
detailsDiv.appendChild(utilities);
|
|
2675
2796
|
}
|
|
2676
2797
|
return detailsDiv;
|
|
2677
2798
|
}
|
|
2799
|
+
function pluginSections(node) {
|
|
2800
|
+
var kind = kindOf(node);
|
|
2801
|
+
var mode = panelMode();
|
|
2802
|
+
var sections = [];
|
|
2803
|
+
[CONTAINERS, FEATURES, UTILITIES].forEach(function(registry) {
|
|
2804
|
+
Object.keys(registry).forEach(function(name) {
|
|
2805
|
+
var plugin = registry[name];
|
|
2806
|
+
var section = plugin.panelSection ? plugin.panelSection(node, kind) : null;
|
|
2807
|
+
if (!section || !section.body) {
|
|
2808
|
+
return;
|
|
2809
|
+
}
|
|
2810
|
+
var holder = element("div", { "class": "ge-panel-section", "data-ge-plugin": name });
|
|
2811
|
+
if (mode === "offcanvas" || mode === "modal") {
|
|
2812
|
+
holder.appendChild(section.body);
|
|
2813
|
+
} else {
|
|
2814
|
+
var label = t(section.labelKey);
|
|
2815
|
+
var open = holder.appendChild(element("button", {
|
|
2816
|
+
type: "button",
|
|
2817
|
+
"class": "btn btn-sm btn-outline-secondary ge-panel-section-open"
|
|
2818
|
+
}, label));
|
|
2819
|
+
hide(section.body);
|
|
2820
|
+
holder.appendChild(section.body);
|
|
2821
|
+
open.addEventListener("click", function() {
|
|
2822
|
+
openDialog(
|
|
2823
|
+
section.titleKey ? t(section.titleKey, { kind: kindLabel(node) }) : label,
|
|
2824
|
+
section.body,
|
|
2825
|
+
open
|
|
2826
|
+
);
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
sections.push(holder);
|
|
2830
|
+
});
|
|
2831
|
+
});
|
|
2832
|
+
return sections;
|
|
2833
|
+
}
|
|
2678
2834
|
var PANEL_MODES = ["offcanvas", "popover", "modal", "inline"];
|
|
2679
2835
|
var settingsPanels = {};
|
|
2680
2836
|
var openSettingsState = null;
|
|
@@ -2722,7 +2878,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2722
2878
|
addClass(node, "ge-settings-target");
|
|
2723
2879
|
var signal = { signal: listening.signal };
|
|
2724
2880
|
document.addEventListener("keydown", function(e) {
|
|
2725
|
-
if (e.key === "Escape") {
|
|
2881
|
+
if (e.key === "Escape" && !dialogState) {
|
|
2726
2882
|
closeSettings();
|
|
2727
2883
|
}
|
|
2728
2884
|
}, signal);
|
|
@@ -2745,15 +2901,20 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2745
2901
|
openSettingsState.observer.observe(details);
|
|
2746
2902
|
}
|
|
2747
2903
|
on(document, "mousedown touchstart", function(e) {
|
|
2748
|
-
if (!panel.contains(e.target) && !gear.contains(e.target)) {
|
|
2904
|
+
if (!dialogState && !panel.contains(e.target) && !gear.contains(e.target)) {
|
|
2749
2905
|
closeSettings();
|
|
2750
2906
|
}
|
|
2751
2907
|
}, signal);
|
|
2752
2908
|
} else {
|
|
2753
|
-
showModal(panel)
|
|
2909
|
+
showModal(panel, function() {
|
|
2910
|
+
if (openSettingsState && openSettingsState.mode === "modal") {
|
|
2911
|
+
closeSettings();
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2754
2914
|
}
|
|
2755
2915
|
}
|
|
2756
2916
|
function closeSettings() {
|
|
2917
|
+
closeDialog();
|
|
2757
2918
|
var open = openSettingsState;
|
|
2758
2919
|
if (!open) {
|
|
2759
2920
|
return;
|
|
@@ -2831,10 +2992,9 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2831
2992
|
settingsPanels[mode].remove();
|
|
2832
2993
|
}
|
|
2833
2994
|
});
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
}
|
|
2995
|
+
Object.keys(settingsPanels).forEach(function(mode) {
|
|
2996
|
+
removeBackdrop(settingsPanels[mode]);
|
|
2997
|
+
});
|
|
2838
2998
|
settingsPanels = {};
|
|
2839
2999
|
}
|
|
2840
3000
|
function placePopover(panel, gear) {
|
|
@@ -2865,25 +3025,30 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2865
3025
|
left: Math.max(gap, Math.min(tool.left + tool.width / 2 - left - 8, width - 24))
|
|
2866
3026
|
});
|
|
2867
3027
|
}
|
|
2868
|
-
|
|
2869
|
-
function showModal(panel) {
|
|
3028
|
+
function showModal(panel, dismissed) {
|
|
2870
3029
|
var Modal = modalLibrary();
|
|
3030
|
+
var state = modalState.get(panel);
|
|
3031
|
+
if (!state) {
|
|
3032
|
+
state = { wanted: null, busy: false, backdrop: null, dismissed };
|
|
3033
|
+
modalState.set(panel, state);
|
|
3034
|
+
}
|
|
3035
|
+
state.dismissed = dismissed;
|
|
2871
3036
|
if (!Modal) {
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
3037
|
+
if (!state.backdrop) {
|
|
3038
|
+
state.backdrop = element("div", { "class": "modal-backdrop fade show ge-settings-backdrop" });
|
|
3039
|
+
state.backdrop.addEventListener("click", function() {
|
|
3040
|
+
state.dismissed();
|
|
3041
|
+
});
|
|
3042
|
+
document.body.appendChild(state.backdrop);
|
|
3043
|
+
}
|
|
2877
3044
|
addClass(panel, "show");
|
|
2878
3045
|
panel.style.display = "block";
|
|
2879
3046
|
panel.removeAttribute("aria-hidden");
|
|
2880
3047
|
return;
|
|
2881
3048
|
}
|
|
2882
3049
|
var modal = Modal.getOrCreateInstance(panel);
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
state = { wanted: null, busy: false };
|
|
2886
|
-
modalState.set(panel, state);
|
|
3050
|
+
if (!state.watched) {
|
|
3051
|
+
state.watched = true;
|
|
2887
3052
|
trackModal(panel);
|
|
2888
3053
|
panel.addEventListener("hide.bs.modal", function() {
|
|
2889
3054
|
if (state.wanted === "open") {
|
|
@@ -2900,9 +3065,9 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2900
3065
|
panel.addEventListener("hidden.bs.modal", function() {
|
|
2901
3066
|
state.busy = false;
|
|
2902
3067
|
if (state.wanted === "open") {
|
|
2903
|
-
showModal(panel);
|
|
2904
|
-
} else
|
|
2905
|
-
|
|
3068
|
+
showModal(panel, state.dismissed);
|
|
3069
|
+
} else {
|
|
3070
|
+
state.dismissed();
|
|
2906
3071
|
}
|
|
2907
3072
|
});
|
|
2908
3073
|
}
|
|
@@ -2914,23 +3079,117 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2914
3079
|
}
|
|
2915
3080
|
function hideModal(panel) {
|
|
2916
3081
|
var Modal = modalLibrary();
|
|
3082
|
+
var state = modalState.get(panel);
|
|
3083
|
+
if (!state) {
|
|
3084
|
+
return;
|
|
3085
|
+
}
|
|
3086
|
+
state.wanted = "closed";
|
|
2917
3087
|
if (!Modal) {
|
|
2918
|
-
if (
|
|
2919
|
-
|
|
2920
|
-
|
|
3088
|
+
if (state.backdrop) {
|
|
3089
|
+
state.backdrop.remove();
|
|
3090
|
+
state.backdrop = null;
|
|
2921
3091
|
}
|
|
2922
3092
|
removeClass(panel, "show");
|
|
2923
3093
|
panel.style.removeProperty("display");
|
|
2924
3094
|
panel.setAttribute("aria-hidden", "true");
|
|
2925
3095
|
return;
|
|
2926
3096
|
}
|
|
2927
|
-
var state = modalState.get(panel) || { wanted: null, busy: false };
|
|
2928
|
-
state.wanted = "closed";
|
|
2929
3097
|
if (!state.busy && hasClass(panel, "show")) {
|
|
2930
3098
|
state.busy = true;
|
|
2931
3099
|
Modal.getOrCreateInstance(panel).hide();
|
|
2932
3100
|
}
|
|
2933
3101
|
}
|
|
3102
|
+
function removeBackdrop(panel) {
|
|
3103
|
+
var state = modalState.get(panel);
|
|
3104
|
+
if (state && state.backdrop) {
|
|
3105
|
+
state.backdrop.remove();
|
|
3106
|
+
state.backdrop = null;
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
var dialogPanel = null;
|
|
3110
|
+
var dialogState = null;
|
|
3111
|
+
function dialog() {
|
|
3112
|
+
if (dialogPanel) {
|
|
3113
|
+
return dialogPanel;
|
|
3114
|
+
}
|
|
3115
|
+
dialogPanel = create('<div class="modal fade ge-dialog" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"><div class="modal-content"><div class="modal-header"><h5 class="modal-title ge-dialog-title"></h5></div><div class="modal-body ge-dialog-body"></div><div class="modal-footer"></div></div></div></div>');
|
|
3116
|
+
one(dialogPanel, ".modal-header").appendChild(element("button", {
|
|
3117
|
+
type: "button",
|
|
3118
|
+
"class": "btn-close ge-dialog-close",
|
|
3119
|
+
"aria-label": t("panel.close")
|
|
3120
|
+
}));
|
|
3121
|
+
one(dialogPanel, ".modal-footer").appendChild(element("button", {
|
|
3122
|
+
type: "button",
|
|
3123
|
+
"class": "btn btn-primary ge-dialog-close"
|
|
3124
|
+
}, t("panel.done")));
|
|
3125
|
+
delegate(dialogPanel, "click", ".ge-dialog-close", function(e) {
|
|
3126
|
+
e.preventDefault();
|
|
3127
|
+
closeDialog();
|
|
3128
|
+
});
|
|
3129
|
+
return document.body.appendChild(dialogPanel);
|
|
3130
|
+
}
|
|
3131
|
+
function openDialog(title, body, opener) {
|
|
3132
|
+
closeDialog();
|
|
3133
|
+
var panel = dialog();
|
|
3134
|
+
var listening = new AbortController();
|
|
3135
|
+
dialogState = {
|
|
3136
|
+
body,
|
|
3137
|
+
home: body.parentElement,
|
|
3138
|
+
next: body.nextElementSibling,
|
|
3139
|
+
opener: opener || document.activeElement,
|
|
3140
|
+
listening
|
|
3141
|
+
};
|
|
3142
|
+
one(panel, ".ge-dialog-title").textContent = title;
|
|
3143
|
+
one(panel, ".ge-dialog-body").appendChild(body);
|
|
3144
|
+
show(body);
|
|
3145
|
+
if (!modalLibrary()) {
|
|
3146
|
+
document.addEventListener("keydown", function(e) {
|
|
3147
|
+
if (e.key === "Escape") {
|
|
3148
|
+
closeDialog();
|
|
3149
|
+
}
|
|
3150
|
+
}, { signal: listening.signal });
|
|
3151
|
+
}
|
|
3152
|
+
Object.keys(settingsPanels).forEach(function(mode) {
|
|
3153
|
+
addClass(settingsPanels[mode], "ge-under-dialog");
|
|
3154
|
+
});
|
|
3155
|
+
showModal(panel, function() {
|
|
3156
|
+
closeDialog();
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
function closeDialog() {
|
|
3160
|
+
var open = dialogState;
|
|
3161
|
+
if (!open) {
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
3164
|
+
dialogState = null;
|
|
3165
|
+
open.listening.abort();
|
|
3166
|
+
hideModal(dialogPanel);
|
|
3167
|
+
Object.keys(settingsPanels).forEach(function(mode) {
|
|
3168
|
+
removeClass(settingsPanels[mode], "ge-under-dialog");
|
|
3169
|
+
});
|
|
3170
|
+
hide(open.body);
|
|
3171
|
+
if (open.home && attached(open.home)) {
|
|
3172
|
+
if (open.next && open.next.parentElement === open.home) {
|
|
3173
|
+
open.home.insertBefore(open.body, open.next);
|
|
3174
|
+
} else {
|
|
3175
|
+
open.home.appendChild(open.body);
|
|
3176
|
+
}
|
|
3177
|
+
} else {
|
|
3178
|
+
open.body.remove();
|
|
3179
|
+
}
|
|
3180
|
+
if (open.opener && attached(open.opener) && open.opener.focus) {
|
|
3181
|
+
open.opener.focus();
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
function removeDialog() {
|
|
3185
|
+
closeDialog();
|
|
3186
|
+
if (!dialogPanel) {
|
|
3187
|
+
return;
|
|
3188
|
+
}
|
|
3189
|
+
removeBackdrop(dialogPanel);
|
|
3190
|
+
retireModal(dialogPanel);
|
|
3191
|
+
dialogPanel = null;
|
|
3192
|
+
}
|
|
2934
3193
|
function kindLabel(node) {
|
|
2935
3194
|
var kind = kindOf(node);
|
|
2936
3195
|
if (CONTAINERS[kind] && CONTAINERS[kind].labelKey) {
|
|
@@ -3801,6 +4060,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3801
4060
|
renderUtilities(section);
|
|
3802
4061
|
});
|
|
3803
4062
|
});
|
|
4063
|
+
renderPluginFields(null);
|
|
3804
4064
|
refreshPreviews(canvas);
|
|
3805
4065
|
plugins("onViewChange", key);
|
|
3806
4066
|
emit("view-change", { canvas, breakpoint: key, from, to: key });
|
|
@@ -3889,7 +4149,7 @@ GridEditor.t = translate;
|
|
|
3889
4149
|
GridEditor._plainHtml = plainHtml;
|
|
3890
4150
|
GridEditor.Sortable = null;
|
|
3891
4151
|
GridEditor.bootstrap = null;
|
|
3892
|
-
GridEditor.version = false ? "dev" : "7.
|
|
4152
|
+
GridEditor.version = false ? "dev" : "7.3.0";
|
|
3893
4153
|
GridEditor.locales = {
|
|
3894
4154
|
en: {
|
|
3895
4155
|
"tool.move": "Move",
|