@themarioga/grid-editor 6.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTO_SAVE.md +2 -2
- package/BUILDING.md +45 -29
- package/CHANGELOG.md +59 -0
- package/README.md +163 -87
- package/UPGRADING.md +119 -0
- package/dist/grideditor.bundle.min.js +14 -0
- package/dist/grideditor.d.ts +335 -0
- package/dist/grideditor.esm.js +3977 -0
- package/dist/grideditor.jquery.js +253 -0
- package/dist/grideditor.jquery.min.js +1 -0
- package/dist/grideditor.jquery.min.js.map +7 -0
- package/dist/grideditor.js +3983 -0
- package/dist/grideditor.min.js +6 -0
- package/dist/grideditor.min.js.map +7 -0
- package/dist/locales/grideditor.es.esm.js +158 -0
- package/dist/locales/grideditor.es.js +164 -168
- package/dist/locales/grideditor.es.min.js +6 -2
- package/dist/locales/grideditor.es.min.js.map +7 -1
- package/dist/plugins/grideditor.accordion.esm.js +294 -0
- package/dist/plugins/grideditor.accordion.js +286 -180
- package/dist/plugins/grideditor.accordion.min.js +1 -2
- package/dist/plugins/grideditor.accordion.min.js.map +7 -1
- package/dist/plugins/grideditor.alignment.esm.js +55 -0
- package/dist/plugins/grideditor.alignment.js +58 -77
- package/dist/plugins/grideditor.alignment.min.js +1 -2
- package/dist/plugins/grideditor.alignment.min.js.map +7 -1
- package/dist/plugins/grideditor.card.esm.js +73 -0
- package/dist/plugins/grideditor.card.js +74 -64
- package/dist/plugins/grideditor.card.min.js +1 -2
- package/dist/plugins/grideditor.card.min.js.map +7 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +500 -0
- package/dist/plugins/grideditor.ckeditor.js +484 -449
- package/dist/plugins/grideditor.ckeditor.min.js +1 -2
- package/dist/plugins/grideditor.ckeditor.min.js.map +7 -1
- package/dist/plugins/grideditor.clipboard.esm.js +326 -0
- package/dist/plugins/grideditor.clipboard.js +298 -235
- package/dist/plugins/grideditor.clipboard.min.js +1 -2
- package/dist/plugins/grideditor.clipboard.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror-inline.esm.js +205 -0
- package/dist/plugins/grideditor.codemirror-inline.js +188 -168
- package/dist/plugins/grideditor.codemirror-inline.min.js +1 -2
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror.esm.js +63 -0
- package/dist/plugins/grideditor.codemirror.js +60 -71
- package/dist/plugins/grideditor.codemirror.min.js +1 -2
- package/dist/plugins/grideditor.codemirror.min.js.map +7 -1
- package/dist/plugins/grideditor.elements.esm.js +271 -0
- package/dist/plugins/grideditor.elements.js +256 -149
- package/dist/plugins/grideditor.elements.min.js +1 -2
- package/dist/plugins/grideditor.elements.min.js.map +7 -1
- package/dist/plugins/grideditor.float.esm.js +34 -0
- package/dist/plugins/grideditor.float.js +37 -52
- package/dist/plugins/grideditor.float.min.js +1 -2
- package/dist/plugins/grideditor.float.min.js.map +7 -1
- package/dist/plugins/grideditor.gutters.esm.js +143 -0
- package/dist/plugins/grideditor.gutters.js +134 -131
- package/dist/plugins/grideditor.gutters.min.js +1 -2
- package/dist/plugins/grideditor.gutters.min.js.map +7 -1
- package/dist/plugins/grideditor.order.esm.js +189 -0
- package/dist/plugins/grideditor.order.js +170 -182
- package/dist/plugins/grideditor.order.min.js +1 -2
- package/dist/plugins/grideditor.order.min.js.map +7 -1
- package/dist/plugins/grideditor.popup.esm.js +187 -0
- package/dist/plugins/grideditor.popup.js +183 -134
- package/dist/plugins/grideditor.popup.min.js +1 -2
- package/dist/plugins/grideditor.popup.min.js.map +7 -1
- package/dist/plugins/grideditor.sections.esm.js +271 -0
- package/dist/plugins/grideditor.sections.js +250 -173
- package/dist/plugins/grideditor.sections.min.js +1 -2
- package/dist/plugins/grideditor.sections.min.js.map +7 -1
- package/dist/plugins/grideditor.spacing.esm.js +318 -0
- package/dist/plugins/grideditor.spacing.js +296 -272
- package/dist/plugins/grideditor.spacing.min.js +1 -2
- package/dist/plugins/grideditor.spacing.min.js.map +7 -1
- package/dist/plugins/grideditor.summernote.esm.js +509 -0
- package/dist/plugins/grideditor.summernote.js +493 -427
- package/dist/plugins/grideditor.summernote.min.js +1 -2
- package/dist/plugins/grideditor.summernote.min.js.map +7 -1
- package/dist/plugins/grideditor.tabs.esm.js +237 -0
- package/dist/plugins/grideditor.tabs.js +233 -139
- package/dist/plugins/grideditor.tabs.min.js +1 -2
- package/dist/plugins/grideditor.tabs.min.js.map +7 -1
- package/dist/plugins/grideditor.textalign.esm.js +40 -0
- package/dist/plugins/grideditor.textalign.js +43 -56
- package/dist/plugins/grideditor.textalign.min.js +1 -2
- package/dist/plugins/grideditor.textalign.min.js.map +7 -1
- package/dist/plugins/grideditor.tinymce.esm.js +519 -0
- package/dist/plugins/grideditor.tinymce.js +502 -490
- package/dist/plugins/grideditor.tinymce.min.js +1 -2
- package/dist/plugins/grideditor.tinymce.min.js.map +7 -1
- package/dist/plugins/grideditor.visibility.esm.js +158 -0
- package/dist/plugins/grideditor.visibility.js +140 -149
- package/dist/plugins/grideditor.visibility.min.js +1 -2
- package/dist/plugins/grideditor.visibility.min.js.map +7 -1
- package/docs/events.md +47 -21
- package/docs/locale-keys.md +6 -0
- package/docs/plugins.md +47 -25
- package/example/adapter.html +112 -0
- package/example/attributes.html +89 -62
- package/example/autocols.html +9 -9
- package/example/autosave.html +18 -16
- package/example/basic.html +8 -6
- package/example/breakpoints.html +5 -6
- package/example/ckeditor.html +4 -5
- package/example/clipboard.html +15 -11
- package/example/codemirror.html +13 -8
- package/example/containers.html +11 -9
- package/example/custom_editor.html +53 -34
- package/example/elements.html +14 -12
- package/example/index.html +16 -2
- package/example/locale.html +6 -7
- package/example/plugins.html +44 -29
- package/example/summernote.html +6 -5
- package/example/utilities.html +17 -13
- package/example/wrap_content.html +13 -10
- package/package.json +44 -12
- package/src/js/dom.js +401 -0
- package/src/js/grideditor.classic.js +16 -0
- package/src/js/grideditor.jquery.js +325 -0
- package/src/js/{jquery.grideditor.js → grideditor.js} +1284 -1124
- package/src/js/locales/grideditor.es.js +163 -156
- package/src/js/plugins/grideditor.accordion.js +97 -77
- package/src/js/plugins/grideditor.alignment.js +5 -7
- package/src/js/plugins/grideditor.card.js +23 -23
- package/src/js/plugins/grideditor.ckeditor.js +107 -106
- package/src/js/plugins/grideditor.clipboard.js +49 -37
- package/src/js/plugins/grideditor.codemirror-inline.js +50 -37
- package/src/js/plugins/grideditor.codemirror.js +9 -10
- package/src/js/plugins/grideditor.elements.js +57 -33
- package/src/js/plugins/grideditor.float.js +4 -6
- package/src/js/plugins/grideditor.gutters.js +20 -15
- package/src/js/plugins/grideditor.order.js +28 -25
- package/src/js/plugins/grideditor.popup.js +63 -51
- package/src/js/plugins/grideditor.sections.js +39 -32
- package/src/js/plugins/grideditor.spacing.js +42 -45
- package/src/js/plugins/grideditor.summernote.js +112 -76
- package/src/js/plugins/grideditor.tabs.js +65 -57
- package/src/js/plugins/grideditor.textalign.js +4 -6
- package/src/js/plugins/grideditor.tinymce.js +148 -140
- package/src/js/plugins/grideditor.visibility.js +24 -25
- package/src/js/register.js +18 -0
- package/src/js/text/grideditor.text.js +77 -56
- package/types/grideditor.d.ts +335 -0
- package/dist/jquery.grideditor.bundle.min.js +0 -10
- package/dist/jquery.grideditor.js +0 -4927
- package/dist/jquery.grideditor.min.js +0 -2
- package/dist/jquery.grideditor.min.js.map +0 -1
|
@@ -1,199 +1,276 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
(() => {
|
|
2
|
+
// src/js/register.js
|
|
3
|
+
var GridEditor = window.GridEditor;
|
|
4
|
+
if (!GridEditor || typeof GridEditor.get !== "function") {
|
|
5
|
+
throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/js/dom.js
|
|
9
|
+
function one(root, selector) {
|
|
10
|
+
return root ? root.querySelector(selector) : null;
|
|
11
|
+
}
|
|
12
|
+
function children(node, selector) {
|
|
13
|
+
if (!node) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return Array.prototype.filter.call(node.children, function(each) {
|
|
17
|
+
return !selector || each.matches(selector);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function child(node, selector) {
|
|
21
|
+
return children(node, selector)[0] || null;
|
|
22
|
+
}
|
|
23
|
+
function element(tag, attributes, text) {
|
|
24
|
+
var node = document.createElement(tag);
|
|
25
|
+
Object.keys(attributes || {}).forEach(function(name) {
|
|
26
|
+
var value = attributes[name];
|
|
27
|
+
if (value !== null && value !== void 0 && value !== false) {
|
|
28
|
+
node.setAttribute(name, value);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (text !== void 0 && text !== null) {
|
|
32
|
+
node.textContent = text;
|
|
33
|
+
}
|
|
34
|
+
return node;
|
|
35
|
+
}
|
|
36
|
+
function addClass(node, names) {
|
|
37
|
+
split(names).forEach(function(name) {
|
|
38
|
+
node.classList.add(name);
|
|
39
|
+
});
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
function removeClass(node, names) {
|
|
43
|
+
split(names).forEach(function(name) {
|
|
44
|
+
node.classList.remove(name);
|
|
45
|
+
});
|
|
46
|
+
return node;
|
|
47
|
+
}
|
|
48
|
+
function hasClass(node, name) {
|
|
49
|
+
return !!node && node.nodeType === 1 && node.classList.contains(name);
|
|
50
|
+
}
|
|
51
|
+
function split(names) {
|
|
52
|
+
return String(names || "").split(/\s+/).filter(Boolean);
|
|
53
|
+
}
|
|
54
|
+
function hide(node) {
|
|
55
|
+
node.style.display = "none";
|
|
56
|
+
return node;
|
|
57
|
+
}
|
|
58
|
+
function visible(node) {
|
|
59
|
+
return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);
|
|
60
|
+
}
|
|
61
|
+
var DEFAULT_DURATION = 400;
|
|
62
|
+
function animateAway(node, frames, duration, done) {
|
|
63
|
+
duration = duration === void 0 ? DEFAULT_DURATION : duration;
|
|
64
|
+
var finish = function() {
|
|
65
|
+
hide(node);
|
|
66
|
+
if (done) {
|
|
67
|
+
done();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (!visible(node) || !node.animate || duration <= 0) {
|
|
71
|
+
window.setTimeout(finish, 0);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
var animation = node.animate(frames(getComputedStyle(node)), {
|
|
75
|
+
duration,
|
|
76
|
+
easing: "ease-in-out"
|
|
77
|
+
});
|
|
78
|
+
var called = false;
|
|
79
|
+
var once = function() {
|
|
80
|
+
if (called) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
called = true;
|
|
84
|
+
finish();
|
|
85
|
+
};
|
|
86
|
+
animation.onfinish = once;
|
|
87
|
+
animation.oncancel = once;
|
|
88
|
+
}
|
|
89
|
+
function slideUp(node, duration, done) {
|
|
90
|
+
if (typeof duration === "function") {
|
|
91
|
+
done = duration;
|
|
92
|
+
duration = void 0;
|
|
93
|
+
}
|
|
94
|
+
node.style.overflow = "hidden";
|
|
95
|
+
animateAway(node, function(style) {
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
height: style.height,
|
|
99
|
+
paddingTop: style.paddingTop,
|
|
100
|
+
paddingBottom: style.paddingBottom,
|
|
101
|
+
marginTop: style.marginTop,
|
|
102
|
+
marginBottom: style.marginBottom
|
|
103
|
+
},
|
|
104
|
+
{ height: "0px", paddingTop: "0px", paddingBottom: "0px", marginTop: "0px", marginBottom: "0px" }
|
|
105
|
+
];
|
|
106
|
+
}, duration, function() {
|
|
107
|
+
node.style.removeProperty("overflow");
|
|
108
|
+
if (done) {
|
|
109
|
+
done();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/js/plugins/grideditor.sections.js
|
|
115
|
+
Object.assign(GridEditor.locales.en, {
|
|
116
|
+
"section.add": "Section",
|
|
117
|
+
"section.width": "Width",
|
|
118
|
+
"section.fixed": "Fixed",
|
|
119
|
+
"section.fluid": "Full width",
|
|
120
|
+
"section.from": "Fixed from {breakpoint}",
|
|
121
|
+
"tool.add_row_to_section": "Add row",
|
|
122
|
+
"tool.delete_section": "Remove section",
|
|
123
|
+
"confirm.delete_section": "Delete this section and everything in it?"
|
|
124
|
+
});
|
|
125
|
+
var WIDTHS = {
|
|
126
|
+
fixed: "container",
|
|
127
|
+
fluid: "container-fluid",
|
|
128
|
+
sm: "container-sm",
|
|
129
|
+
md: "container-md",
|
|
130
|
+
lg: "container-lg",
|
|
131
|
+
xl: "container-xl",
|
|
132
|
+
xxl: "container-xxl"
|
|
133
|
+
};
|
|
134
|
+
var ORDER = ["fixed", "sm", "md", "lg", "xl", "xxl", "fluid"];
|
|
135
|
+
GridEditor.features.sections = function(ge) {
|
|
136
|
+
var options = Object.assign({ widths: ORDER }, ge.settings.sections);
|
|
49
137
|
function widthOf(section) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
138
|
+
var found = null;
|
|
139
|
+
Object.keys(WIDTHS).forEach(function(width) {
|
|
140
|
+
if (!found && hasClass(section, WIDTHS[width])) {
|
|
141
|
+
found = width;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return found;
|
|
57
145
|
}
|
|
58
|
-
|
|
59
146
|
function isSection(node) {
|
|
60
|
-
|
|
147
|
+
return node.parentElement === ge.canvas && widthOf(node) !== null;
|
|
61
148
|
}
|
|
62
|
-
|
|
63
149
|
function sections() {
|
|
64
|
-
|
|
150
|
+
return children(ge.canvas).filter(isSection);
|
|
65
151
|
}
|
|
66
|
-
|
|
67
152
|
function label(width) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
153
|
+
if (width === "fixed") {
|
|
154
|
+
return ge.t("section.fixed");
|
|
155
|
+
}
|
|
156
|
+
if (width === "fluid") {
|
|
157
|
+
return ge.t("section.fluid");
|
|
158
|
+
}
|
|
159
|
+
return ge.t("section.from", { breakpoint: width });
|
|
72
160
|
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Change a section's width, announced like a utility: the width is its
|
|
76
|
-
* one container class, the same at every breakpoint.
|
|
77
|
-
*/
|
|
78
161
|
function setWidth(section, width, source) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!ge.emit('before-utility', payload)) {
|
|
93
|
-
ge.detailsOf(section).find('.ge-section-width select').val(from);
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
section.removeClass(WIDTHS[from]).addClass(WIDTHS[width]);
|
|
98
|
-
ge.emit('after-utility', payload);
|
|
99
|
-
|
|
100
|
-
return true;
|
|
162
|
+
var from = widthOf(section);
|
|
163
|
+
if (from === width || !WIDTHS[width]) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return ge.operate(function() {
|
|
167
|
+
var payload = ge.payloadFor("section", section, {
|
|
168
|
+
family: "section",
|
|
169
|
+
breakpoint: "all",
|
|
170
|
+
tiers: [],
|
|
171
|
+
from,
|
|
172
|
+
to: width,
|
|
173
|
+
source: source || "api"
|
|
101
174
|
});
|
|
175
|
+
if (!ge.emit("before-utility", payload)) {
|
|
176
|
+
var select = one(ge.detailsOf(section), ".ge-section-width select");
|
|
177
|
+
if (select) {
|
|
178
|
+
select.value = from;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
removeClass(section, WIDTHS[from]);
|
|
183
|
+
addClass(section, WIDTHS[width]);
|
|
184
|
+
ge.emit("after-utility", payload);
|
|
185
|
+
return true;
|
|
186
|
+
});
|
|
102
187
|
}
|
|
103
|
-
|
|
104
188
|
function widthField(section) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
189
|
+
var select = element("select", { "class": "form-select form-select-sm" });
|
|
190
|
+
var current = widthOf(section);
|
|
191
|
+
var offered = options.widths.indexOf(current) === -1 ? options.widths.concat([current]) : options.widths;
|
|
192
|
+
ORDER.forEach(function(width) {
|
|
193
|
+
if (offered.indexOf(width) === -1) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
select.appendChild(element("option", { value: width }, label(width)));
|
|
197
|
+
});
|
|
198
|
+
select.value = current;
|
|
199
|
+
select.addEventListener("change", function() {
|
|
200
|
+
setWidth(section, this.value, "panel");
|
|
201
|
+
});
|
|
202
|
+
var field = element("label", { "class": "ge-utility ge-section-width" });
|
|
203
|
+
field.appendChild(element("span", { "class": "ge-utility-label" }, ge.t("section.width")));
|
|
204
|
+
field.appendChild(select);
|
|
205
|
+
return field;
|
|
119
206
|
}
|
|
120
|
-
|
|
121
207
|
function createControls(section) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ge.
|
|
128
|
-
|
|
129
|
-
section.slideUp(removed);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
ge.createTool(drawer, ge.t('tool.add_row_to_section'), 'ge-add-row', 'bi bi-plus-circle', function() {
|
|
134
|
-
ge.place(ge.rowFromLayout([12]), 'row', { appendTo: section });
|
|
208
|
+
var drawer = element("div", { "class": "ge-tools-drawer ge-section-drawer" });
|
|
209
|
+
section.insertBefore(drawer, section.firstChild);
|
|
210
|
+
ge.createMoveTool(drawer);
|
|
211
|
+
ge.addSettingsTool(drawer, section, ge.settings.section_classes || []).appendChild(widthField(section));
|
|
212
|
+
ge.createTool(drawer, ge.t("tool.delete_section"), "ge-delete-section", "bi bi-trash", function() {
|
|
213
|
+
ge.deleteNode("section", section, ge.t("confirm.delete_section"), function(removed) {
|
|
214
|
+
slideUp(section, removed);
|
|
135
215
|
});
|
|
216
|
+
});
|
|
217
|
+
ge.createTool(drawer, ge.t("tool.add_row_to_section"), "ge-add-row", "bi bi-plus-circle", function() {
|
|
218
|
+
ge.place(ge.rowFromLayout([12]), "row", { appendTo: section });
|
|
219
|
+
});
|
|
136
220
|
}
|
|
137
|
-
|
|
138
221
|
function mark() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
222
|
+
sections().forEach(function(section) {
|
|
223
|
+
addClass(section, "ge-section");
|
|
224
|
+
if (!child(section, ".ge-tools-drawer")) {
|
|
225
|
+
createControls(section);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
143
228
|
}
|
|
144
|
-
|
|
145
229
|
function unmark() {
|
|
146
|
-
|
|
230
|
+
children(ge.canvas, ".ge-section").forEach(function(section) {
|
|
231
|
+
removeClass(section, "ge-section");
|
|
232
|
+
});
|
|
147
233
|
}
|
|
148
|
-
|
|
149
|
-
/** createSection(options): a section, detached unless a placement is given. */
|
|
150
234
|
function createSection(settings) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
return ge.place(section, 'section', settings);
|
|
235
|
+
settings = settings || {};
|
|
236
|
+
var section = element("div", { "class": WIDTHS[settings.width] || WIDTHS.fixed });
|
|
237
|
+
(settings.rows || [[12]]).forEach(function(layout) {
|
|
238
|
+
section.appendChild(ge.rowFromLayout(layout));
|
|
239
|
+
});
|
|
240
|
+
return ge.place(section, "section", settings);
|
|
160
241
|
}
|
|
161
|
-
|
|
162
242
|
return {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
243
|
+
methods: {
|
|
244
|
+
createSection
|
|
245
|
+
},
|
|
246
|
+
kindOf: function(node) {
|
|
247
|
+
return hasClass(node, "ge-section") ? "section" : null;
|
|
248
|
+
},
|
|
249
|
+
// A section is a block the canvas moves, and a region rows move in
|
|
250
|
+
blocks: ".ge-section",
|
|
251
|
+
regions: ".ge-section",
|
|
252
|
+
/** A section goes on the canvas and nowhere else, and holds rows and nothing else. */
|
|
253
|
+
accepts: function(region, node) {
|
|
254
|
+
if (hasClass(node, "ge-section") || isSectionMade(node)) {
|
|
255
|
+
return region === ge.canvas;
|
|
256
|
+
}
|
|
257
|
+
if (hasClass(region, "ge-section")) {
|
|
258
|
+
return hasClass(node, "row");
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
},
|
|
262
|
+
toolbar: [{
|
|
263
|
+
labelKey: "section.add",
|
|
264
|
+
kind: "section",
|
|
265
|
+
create: function() {
|
|
266
|
+
return createSection();
|
|
267
|
+
}
|
|
268
|
+
}],
|
|
269
|
+
onInit: mark,
|
|
270
|
+
onDeinit: unmark
|
|
191
271
|
};
|
|
192
|
-
|
|
193
|
-
/** A section the toolbar just made, before init has marked it. */
|
|
194
272
|
function isSectionMade(node) {
|
|
195
|
-
|
|
273
|
+
return !node.parentElement && widthOf(node) !== null;
|
|
196
274
|
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
})(jQuery);
|
|
275
|
+
};
|
|
276
|
+
})();
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
(
|
|
2
|
-
//# sourceMappingURL=grideditor.sections.min.js.map
|
|
1
|
+
(()=>{var h=window.GridEditor;if(!h||typeof h.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function b(t,n){return t?t.querySelector(n):null}function g(t,n){return t?Array.prototype.filter.call(t.children,function(i){return!n||i.matches(n)}):[]}function C(t,n){return g(t,n)[0]||null}function c(t,n,i){var o=document.createElement(t);return Object.keys(n||{}).forEach(function(u){var l=n[u];l!=null&&l!==!1&&o.setAttribute(u,l)}),i!=null&&(o.textContent=i),o}function y(t,n){return T(n).forEach(function(i){t.classList.add(i)}),t}function w(t,n){return T(n).forEach(function(i){t.classList.remove(i)}),t}function m(t,n){return!!t&&t.nodeType===1&&t.classList.contains(n)}function T(t){return String(t||"").split(/\s+/).filter(Boolean)}function _(t){return t.style.display="none",t}function j(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}var F=400;function D(t,n,i,o){i=i===void 0?F:i;var u=function(){_(t),o&&o()};if(!j(t)||!t.animate||i<=0){window.setTimeout(u,0);return}var l=t.animate(n(getComputedStyle(t)),{duration:i,easing:"ease-in-out"}),v=!1,x=function(){v||(v=!0,u())};l.onfinish=x,l.oncancel=x}function S(t,n,i){typeof n=="function"&&(i=n,n=void 0),t.style.overflow="hidden",D(t,function(o){return[{height:o.height,paddingTop:o.paddingTop,paddingBottom:o.paddingBottom,marginTop:o.marginTop,marginBottom:o.marginBottom},{height:"0px",paddingTop:"0px",paddingBottom:"0px",marginTop:"0px",marginBottom:"0px"}]},n,function(){t.style.removeProperty("overflow"),i&&i()})}Object.assign(h.locales.en,{"section.add":"Section","section.width":"Width","section.fixed":"Fixed","section.fluid":"Full width","section.from":"Fixed from {breakpoint}","tool.add_row_to_section":"Add row","tool.delete_section":"Remove section","confirm.delete_section":"Delete this section and everything in it?"});var f={fixed:"container",fluid:"container-fluid",sm:"container-sm",md:"container-md",lg:"container-lg",xl:"container-xl",xxl:"container-xxl"},A=["fixed","sm","md","lg","xl","xxl","fluid"];h.features.sections=function(t){var n=Object.assign({widths:A},t.settings.sections);function i(e){var r=null;return Object.keys(f).forEach(function(a){!r&&m(e,f[a])&&(r=a)}),r}function o(e){return e.parentElement===t.canvas&&i(e)!==null}function u(){return g(t.canvas).filter(o)}function l(e){return e==="fixed"?t.t("section.fixed"):e==="fluid"?t.t("section.fluid"):t.t("section.from",{breakpoint:e})}function v(e,r,a){var s=i(e);return s===r||!f[r]?!1:t.operate(function(){var d=t.payloadFor("section",e,{family:"section",breakpoint:"all",tiers:[],from:s,to:r,source:a||"api"});if(!t.emit("before-utility",d)){var p=b(t.detailsOf(e),".ge-section-width select");return p&&(p.value=s),!1}return w(e,f[s]),y(e,f[r]),t.emit("after-utility",d),!0})}function x(e){var r=c("select",{class:"form-select form-select-sm"}),a=i(e),s=n.widths.indexOf(a)===-1?n.widths.concat([a]):n.widths;A.forEach(function(p){s.indexOf(p)!==-1&&r.appendChild(c("option",{value:p},l(p)))}),r.value=a,r.addEventListener("change",function(){v(e,this.value,"panel")});var d=c("label",{class:"ge-utility ge-section-width"});return d.appendChild(c("span",{class:"ge-utility-label"},t.t("section.width"))),d.appendChild(r),d}function O(e){var r=c("div",{class:"ge-tools-drawer ge-section-drawer"});e.insertBefore(r,e.firstChild),t.createMoveTool(r),t.addSettingsTool(r,e,t.settings.section_classes||[]).appendChild(x(e)),t.createTool(r,t.t("tool.delete_section"),"ge-delete-section","bi bi-trash",function(){t.deleteNode("section",e,t.t("confirm.delete_section"),function(a){S(e,a)})}),t.createTool(r,t.t("tool.add_row_to_section"),"ge-add-row","bi bi-plus-circle",function(){t.place(t.rowFromLayout([12]),"row",{appendTo:e})})}function k(){u().forEach(function(e){y(e,"ge-section"),C(e,".ge-tools-drawer")||O(e)})}function B(){g(t.canvas,".ge-section").forEach(function(e){w(e,"ge-section")})}function E(e){e=e||{};var r=c("div",{class:f[e.width]||f.fixed});return(e.rows||[[12]]).forEach(function(a){r.appendChild(t.rowFromLayout(a))}),t.place(r,"section",e)}return{methods:{createSection:E},kindOf:function(e){return m(e,"ge-section")?"section":null},blocks:".ge-section",regions:".ge-section",accepts:function(e,r){return m(r,"ge-section")||L(r)?e===t.canvas:m(e,"ge-section")?m(r,"row"):!0},toolbar:[{labelKey:"section.add",kind:"section",create:function(){return E()}}],onInit:k,onDeinit:B};function L(e){return!e.parentElement&&i(e)!==null}};})();
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.sections.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are the ones 6.x had through jQuery: 400 ms unless the\n * caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Sections for grid-editor.\n *\n * A feature plugin: load this file after the editor and the canvas can hold\n * sections - Bootstrap's .container, .container-fluid and .container-{bp} -\n * each grouping rows at a width of its own. What it can ask the editor for is\n * the handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.sections.min.js\"></script>\n *\n * Called sections, not containers, because a container is what the tabs,\n * accordion, popup and card plugins make. A section is recognised by its\n * Bootstrap class alone, and only as a child of the canvas: a .container\n * somewhere inside an element's markup is that element's business.\n *\n * sections.widths narrows the widths the field offers.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'section.add': 'Section',\n 'section.width': 'Width',\n 'section.fixed': 'Fixed',\n 'section.fluid': 'Full width',\n 'section.from': 'Fixed from {breakpoint}',\n 'tool.add_row_to_section': 'Add row',\n 'tool.delete_section': 'Remove section',\n 'confirm.delete_section': 'Delete this section and everything in it?',\n});\n\n/** Each width, and the class that gives it. */\nvar WIDTHS = {\n fixed: 'container',\n fluid: 'container-fluid',\n sm: 'container-sm',\n md: 'container-md',\n lg: 'container-lg',\n xl: 'container-xl',\n xxl: 'container-xxl',\n};\n\nvar ORDER = ['fixed', 'sm', 'md', 'lg', 'xl', 'xxl', 'fluid'];\n\nGridEditor.features.sections = function(ge) {\n\n var options = Object.assign({ widths: ORDER }, ge.settings.sections);\n\n function widthOf(section) {\n var found = null;\n\n Object.keys(WIDTHS).forEach(function(width) {\n if (!found && dom.hasClass(section, WIDTHS[width])) { found = width; }\n });\n\n return found;\n }\n\n function isSection(node) {\n return node.parentElement === ge.canvas && widthOf(node) !== null;\n }\n\n function sections() {\n return dom.children(ge.canvas).filter(isSection);\n }\n\n function label(width) {\n if (width === 'fixed') { return ge.t('section.fixed'); }\n if (width === 'fluid') { return ge.t('section.fluid'); }\n\n return ge.t('section.from', { breakpoint: width });\n }\n\n /**\n * Change a section's width, announced like a utility: the width is its\n * one container class, the same at every breakpoint.\n */\n function setWidth(section, width, source) {\n var from = widthOf(section);\n if (from === width || !WIDTHS[width]) { return false; }\n\n return ge.operate(function() {\n var payload = ge.payloadFor('section', section, {\n family: 'section',\n breakpoint: 'all',\n tiers: [],\n from: from,\n to: width,\n source: source || 'api',\n });\n\n if (!ge.emit('before-utility', payload)) {\n var select = dom.one(ge.detailsOf(section), '.ge-section-width select');\n if (select) { select.value = from; }\n return false;\n }\n\n dom.removeClass(section, WIDTHS[from]);\n dom.addClass(section, WIDTHS[width]);\n ge.emit('after-utility', payload);\n\n return true;\n });\n }\n\n function widthField(section) {\n var select = dom.element('select', { 'class': 'form-select form-select-sm' });\n var current = widthOf(section);\n var offered = options.widths.indexOf(current) === -1 ? options.widths.concat([current]) : options.widths;\n\n ORDER.forEach(function(width) {\n if (offered.indexOf(width) === -1) { return; }\n select.appendChild(dom.element('option', { value: width }, label(width)));\n });\n\n select.value = current;\n select.addEventListener('change', function() { setWidth(section, this.value, 'panel'); });\n\n var field = dom.element('label', { 'class': 'ge-utility ge-section-width' });\n field.appendChild(dom.element('span', { 'class': 'ge-utility-label' }, ge.t('section.width')));\n field.appendChild(select);\n\n return field;\n }\n\n function createControls(section) {\n var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-section-drawer' });\n section.insertBefore(drawer, section.firstChild);\n\n ge.createMoveTool(drawer);\n ge.addSettingsTool(drawer, section, ge.settings.section_classes || []).appendChild(widthField(section));\n\n ge.createTool(drawer, ge.t('tool.delete_section'), 'ge-delete-section', 'bi bi-trash', function() {\n ge.deleteNode('section', section, ge.t('confirm.delete_section'), function(removed) {\n dom.slideUp(section, removed);\n });\n });\n\n ge.createTool(drawer, ge.t('tool.add_row_to_section'), 'ge-add-row', 'bi bi-plus-circle', function() {\n ge.place(ge.rowFromLayout([12]), 'row', { appendTo: section });\n });\n }\n\n function mark() {\n sections().forEach(function(section) {\n dom.addClass(section, 'ge-section');\n if (!dom.child(section, '.ge-tools-drawer')) { createControls(section); }\n });\n }\n\n function unmark() {\n dom.children(ge.canvas, '.ge-section').forEach(function(section) {\n dom.removeClass(section, 'ge-section');\n });\n }\n\n /** createSection(options): a section, detached unless a placement is given. */\n function createSection(settings) {\n settings = settings || {};\n\n var section = dom.element('div', { 'class': WIDTHS[settings.width] || WIDTHS.fixed });\n\n (settings.rows || [[12]]).forEach(function(layout) {\n section.appendChild(ge.rowFromLayout(layout));\n });\n\n return ge.place(section, 'section', settings);\n }\n\n return {\n methods: {\n createSection: createSection,\n },\n\n kindOf: function(node) {\n return dom.hasClass(node, 'ge-section') ? 'section' : null;\n },\n\n // A section is a block the canvas moves, and a region rows move in\n blocks: '.ge-section',\n regions: '.ge-section',\n\n /** A section goes on the canvas and nowhere else, and holds rows and nothing else. */\n accepts: function(region, node) {\n if (dom.hasClass(node, 'ge-section') || isSectionMade(node)) { return region === ge.canvas; }\n if (dom.hasClass(region, 'ge-section')) { return dom.hasClass(node, 'row'); }\n\n return true;\n },\n\n toolbar: [{\n labelKey: 'section.add',\n kind: 'section',\n create: function() { return createSection(); },\n }],\n\n onInit: mark,\n onDeinit: unmark,\n };\n\n /** A section the toolbar just made, before init has marked it. */\n function isSectionMade(node) {\n return !node.parentElement && widthOf(node) !== null;\n }\n};\n"],
|
|
5
|
+
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECMvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAYO,SAASC,EAASC,EAAMC,EAAU,CACrC,OAAKD,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASE,EAAM,CAC7D,MAAO,CAACD,GAAYC,EAAK,QAAQD,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAGO,SAASE,EAAMH,EAAMC,EAAU,CAClC,OAAOF,EAASC,EAAMC,CAAQ,EAAE,CAAC,GAAK,IAC1C,CA6DO,SAASG,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SA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,EAAE,QAAQ,SAASG,EAAS,CACzDe,EAAYf,EAAS,YAAY,CACzC,CAAC,CACL,CAGA,SAAS6B,EAAcC,EAAU,CAC7BA,EAAWA,GAAY,CAAC,EAExB,IAAI9B,EAAckB,EAAQ,MAAO,CAAE,MAASvB,EAAOmC,EAAS,KAAK,GAAKnC,EAAO,KAAM,CAAC,EAEpF,OAACmC,EAAS,MAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,SAASC,EAAQ,CAC/C/B,EAAQ,YAAYH,EAAG,cAAckC,CAAM,CAAC,CAChD,CAAC,EAEMlC,EAAG,MAAMG,EAAS,UAAW8B,CAAQ,CAChD,CAEA,MAAO,CACH,QAAS,CACL,cAAeD,CACnB,EAEA,OAAQ,SAASxB,EAAM,CACnB,OAAWF,EAASE,EAAM,YAAY,EAAI,UAAY,IAC1D,EAGA,OAAQ,cACR,QAAS,cAGT,QAAS,SAAS2B,EAAQ3B,EAAM,CAC5B,OAAQF,EAASE,EAAM,YAAY,GAAK4B,EAAc5B,CAAI,EAAY2B,IAAWnC,EAAG,OAC5EM,EAAS6B,EAAQ,YAAY,EAAgB7B,EAASE,EAAM,KAAK,EAElE,EACX,EAEA,QAAS,CAAC,CACN,SAAU,cACV,KAAM,UACN,OAAQ,UAAW,CAAE,OAAOwB,EAAc,CAAG,CACjD,CAAC,EAED,OAAQH,EACR,SAAUE,CACd,EAGA,SAASK,EAAc5B,EAAM,CACzB,MAAO,CAACA,EAAK,eAAiBN,EAAQM,CAAI,IAAM,IACpD,CACJ",
|
|
6
|
+
"names": ["GridEditor", "one", "root", "selector", "children", "node", "selector", "each", "child", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "hasClass", "node", "name", "split", "names", "hide", "node", "visible", "node", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "slideUp", "style", "GridEditor", "WIDTHS", "ORDER", "ge", "options", "widthOf", "section", "found", "width", "hasClass", "isSection", "node", "sections", "children", "label", "setWidth", "source", "from", "payload", "select", "one", "removeClass", "addClass", "widthField", "element", "current", "offered", "field", "createControls", "drawer", "removed", "slideUp", "mark", "child", "unmark", "createSection", "settings", "layout", "region", "isSectionMade"]
|
|
7
|
+
}
|