@themarioga/grid-editor 6.0.0 → 7.0.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 +47 -0
- package/README.md +137 -85
- 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 +85 -61
- package/example/autocols.html +9 -9
- package/example/autosave.html +13 -14
- package/example/basic.html +4 -5
- package/example/breakpoints.html +5 -6
- package/example/ckeditor.html +4 -5
- package/example/clipboard.html +11 -10
- package/example/codemirror.html +9 -7
- package/example/containers.html +7 -8
- package/example/custom_editor.html +53 -34
- package/example/elements.html +10 -11
- 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 +9 -9
- package/package.json +43 -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 +147 -139
- 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,148 +1,242 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 all(root, selector) {
|
|
10
|
+
return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
|
|
11
|
+
}
|
|
12
|
+
function one(root, selector) {
|
|
13
|
+
return root ? root.querySelector(selector) : null;
|
|
14
|
+
}
|
|
15
|
+
function children(node, selector) {
|
|
16
|
+
if (!node) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
return Array.prototype.filter.call(node.children, function(each) {
|
|
20
|
+
return !selector || each.matches(selector);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function child(node, selector) {
|
|
24
|
+
return children(node, selector)[0] || null;
|
|
25
|
+
}
|
|
26
|
+
function element(tag, attributes, text) {
|
|
27
|
+
var node = document.createElement(tag);
|
|
28
|
+
Object.keys(attributes || {}).forEach(function(name) {
|
|
29
|
+
var value = attributes[name];
|
|
30
|
+
if (value !== null && value !== void 0 && value !== false) {
|
|
31
|
+
node.setAttribute(name, value);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
if (text !== void 0 && text !== null) {
|
|
35
|
+
node.textContent = text;
|
|
36
|
+
}
|
|
37
|
+
return node;
|
|
38
|
+
}
|
|
39
|
+
function addClass(node, names) {
|
|
40
|
+
split(names).forEach(function(name) {
|
|
41
|
+
node.classList.add(name);
|
|
42
|
+
});
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
function removeClass(node, names) {
|
|
46
|
+
split(names).forEach(function(name) {
|
|
47
|
+
node.classList.remove(name);
|
|
48
|
+
});
|
|
49
|
+
return node;
|
|
50
|
+
}
|
|
51
|
+
function toggleClass(node, names, state) {
|
|
52
|
+
split(names).forEach(function(name) {
|
|
53
|
+
if (state === void 0) {
|
|
54
|
+
node.classList.toggle(name);
|
|
55
|
+
} else {
|
|
56
|
+
node.classList.toggle(name, !!state);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return node;
|
|
60
|
+
}
|
|
61
|
+
function hasClass(node, name) {
|
|
62
|
+
return !!node && node.nodeType === 1 && node.classList.contains(name);
|
|
63
|
+
}
|
|
64
|
+
function split(names) {
|
|
65
|
+
return String(names || "").split(/\s+/).filter(Boolean);
|
|
66
|
+
}
|
|
67
|
+
function hide(node) {
|
|
68
|
+
node.style.display = "none";
|
|
69
|
+
return node;
|
|
70
|
+
}
|
|
71
|
+
function visible(node) {
|
|
72
|
+
return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);
|
|
73
|
+
}
|
|
74
|
+
var DEFAULT_DURATION = 400;
|
|
75
|
+
function animateAway(node, frames, duration, done) {
|
|
76
|
+
duration = duration === void 0 ? DEFAULT_DURATION : duration;
|
|
77
|
+
var finish = function() {
|
|
78
|
+
hide(node);
|
|
79
|
+
if (done) {
|
|
80
|
+
done();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
if (!visible(node) || !node.animate || duration <= 0) {
|
|
84
|
+
window.setTimeout(finish, 0);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
var animation = node.animate(frames(getComputedStyle(node)), {
|
|
88
|
+
duration,
|
|
89
|
+
easing: "ease-in-out"
|
|
90
|
+
});
|
|
91
|
+
var called = false;
|
|
92
|
+
var once = function() {
|
|
93
|
+
if (called) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
called = true;
|
|
97
|
+
finish();
|
|
98
|
+
};
|
|
99
|
+
animation.onfinish = once;
|
|
100
|
+
animation.oncancel = once;
|
|
101
|
+
}
|
|
102
|
+
function fadeOut(node, duration, done) {
|
|
103
|
+
animateAway(node, function(style) {
|
|
104
|
+
return [{ opacity: style.opacity }, { opacity: 0 }];
|
|
105
|
+
}, duration, done);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/js/plugins/grideditor.tabs.js
|
|
109
|
+
Object.assign(GridEditor.locales.en, {
|
|
110
|
+
"container.add_tabs": "Tabs",
|
|
111
|
+
"container.add_tab": "Add tab",
|
|
112
|
+
"container.tab_label": "Tab {number}",
|
|
113
|
+
"confirm.delete_tab": "Delete this tab and everything in it?"
|
|
114
|
+
});
|
|
115
|
+
GridEditor.containers.tabs = function(ge) {
|
|
22
116
|
function addTabTo(container, options) {
|
|
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
|
-
|
|
117
|
+
options = options || {};
|
|
118
|
+
var strip = one(container, ":scope > .nav-tabs");
|
|
119
|
+
var content = one(container, ":scope > .tab-content");
|
|
120
|
+
var id = ge.containerId("tab");
|
|
121
|
+
var number = children(strip, ".nav-item").length + 1;
|
|
122
|
+
var tab = strip.appendChild(element("li", { "class": "nav-item ge-tab", role: "presentation" }));
|
|
123
|
+
var button = tab.appendChild(element("button", {
|
|
124
|
+
"class": "nav-link",
|
|
125
|
+
type: "button",
|
|
126
|
+
role: "tab",
|
|
127
|
+
"data-bs-toggle": "tab",
|
|
128
|
+
"data-bs-target": "#" + id,
|
|
129
|
+
"aria-controls": id
|
|
130
|
+
}));
|
|
131
|
+
button.appendChild(element(
|
|
132
|
+
"span",
|
|
133
|
+
{ "class": "ge-pane-label" },
|
|
134
|
+
options.label || ge.t("container.tab_label", { number })
|
|
135
|
+
));
|
|
136
|
+
var pane = content.appendChild(element("div", {
|
|
137
|
+
"class": "tab-pane fade",
|
|
138
|
+
role: "tabpanel",
|
|
139
|
+
tabindex: "0",
|
|
140
|
+
id
|
|
141
|
+
}));
|
|
142
|
+
pane.appendChild(ge.defaultRegion());
|
|
143
|
+
if (options.activate || number === 1) {
|
|
144
|
+
activatePane(container, pane);
|
|
145
|
+
}
|
|
146
|
+
return pane;
|
|
49
147
|
}
|
|
50
|
-
|
|
51
148
|
function activatePane(container, pane) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
149
|
+
var id = pane.getAttribute("id");
|
|
150
|
+
all(container, ":scope > .tab-content > .tab-pane").forEach(function(each) {
|
|
151
|
+
removeClass(each, "show active");
|
|
152
|
+
});
|
|
153
|
+
addClass(pane, "show active");
|
|
154
|
+
all(container, ":scope > .nav-tabs .nav-link").forEach(function(button) {
|
|
155
|
+
var active = button.getAttribute("data-bs-target") === "#" + id;
|
|
156
|
+
toggleClass(button, "active", active);
|
|
157
|
+
button.setAttribute("aria-selected", active ? "true" : "false");
|
|
158
|
+
});
|
|
63
159
|
}
|
|
64
|
-
|
|
65
|
-
function tabOf(container, pane) {
|
|
66
|
-
return container.find('> .nav-tabs .nav-link[data-bs-target="#' + pane.attr('id') + '"]')
|
|
67
|
-
.closest('.nav-item');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
160
|
function paneOf(container, tab) {
|
|
71
|
-
|
|
161
|
+
var link = one(tab, ".nav-link");
|
|
162
|
+
var target = link ? link.getAttribute("data-bs-target") : null;
|
|
163
|
+
return target ? one(container, target) : null;
|
|
72
164
|
}
|
|
73
|
-
|
|
74
165
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
166
|
+
labelKey: "container.add_tabs",
|
|
167
|
+
// A tab strip sorts its own tabs, and the panes follow them. No
|
|
168
|
+
// group: a tab belongs to the strip it was made in.
|
|
169
|
+
onSortable: function(sortable) {
|
|
170
|
+
sortable(all(ge.canvas, ".ge-container-tabs > .nav-tabs"), {
|
|
171
|
+
draggable: ".ge-tab"
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
addPaneKey: "container.add_tab",
|
|
175
|
+
paneKind: "tab",
|
|
176
|
+
create: function(options) {
|
|
177
|
+
var container = element("div", { "data-ge-container": "tabs" });
|
|
178
|
+
var labels = options.labels || [];
|
|
179
|
+
var count = options.tabs || labels.length || 2;
|
|
180
|
+
container.appendChild(element("ul", { "class": "nav nav-tabs", role: "tablist" }));
|
|
181
|
+
container.appendChild(element("div", { "class": "tab-content" }));
|
|
182
|
+
for (var i = 0; i < count; i++) {
|
|
183
|
+
addTabTo(container, { label: labels[i] });
|
|
184
|
+
}
|
|
185
|
+
return container;
|
|
186
|
+
},
|
|
187
|
+
addPane: addTabTo,
|
|
188
|
+
mark: function(container) {
|
|
189
|
+
all(container, ":scope > .tab-content > .tab-pane").forEach(function(pane) {
|
|
190
|
+
addClass(pane, "ge-tab-pane");
|
|
191
|
+
});
|
|
192
|
+
all(container, ":scope > .nav-tabs > .nav-item").forEach(function(tab) {
|
|
193
|
+
addClass(tab, "ge-tab");
|
|
194
|
+
var link = one(tab, ".nav-link");
|
|
195
|
+
if (link) {
|
|
196
|
+
ge.makeLabelEditable(ge.labelIn(link));
|
|
197
|
+
}
|
|
198
|
+
if (child(tab, ".ge-tools-drawer")) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
ge.createPaneControls(
|
|
202
|
+
tab,
|
|
203
|
+
"tab",
|
|
204
|
+
ge.settings.tab_tools,
|
|
205
|
+
ge.t("confirm.delete_tab"),
|
|
206
|
+
function(removed) {
|
|
207
|
+
var pane = paneOf(container, tab);
|
|
208
|
+
var wasActive = hasClass(pane, "active");
|
|
209
|
+
fadeOut(tab, 200, function() {
|
|
210
|
+
if (pane) {
|
|
211
|
+
pane.remove();
|
|
212
|
+
}
|
|
213
|
+
removed();
|
|
214
|
+
var first = one(container, ":scope > .tab-content > .tab-pane");
|
|
215
|
+
if (wasActive && first) {
|
|
216
|
+
activatePane(container, first);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
97
219
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var wasActive = pane.hasClass('active');
|
|
119
|
-
|
|
120
|
-
tab.fadeOut(200, function() {
|
|
121
|
-
pane.remove();
|
|
122
|
-
removed();
|
|
123
|
-
|
|
124
|
-
var first = container.find('> .tab-content > .tab-pane').first();
|
|
125
|
-
if (wasActive && first.length) { activatePane(container, first); }
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
unmark: function(container) {
|
|
132
|
-
ge.resumeToggles(container);
|
|
133
|
-
container.find('.ge-tab-pane').removeClass('ge-tab-pane');
|
|
134
|
-
ge.unwrapLabels(container);
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
/** Panes read in tab order, whatever order they were dropped in. */
|
|
138
|
-
afterPaneMove: function(container) {
|
|
139
|
-
var content = container.find('> .tab-content');
|
|
140
|
-
|
|
141
|
-
container.find('> .nav-tabs > .nav-item').each(function() {
|
|
142
|
-
content.append(paneOf(container, $(this)));
|
|
143
|
-
});
|
|
144
|
-
},
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
unmark: function(container) {
|
|
224
|
+
ge.resumeToggles(container);
|
|
225
|
+
all(container, ".ge-tab-pane").forEach(function(pane) {
|
|
226
|
+
removeClass(pane, "ge-tab-pane");
|
|
227
|
+
});
|
|
228
|
+
ge.unwrapLabels(container);
|
|
229
|
+
},
|
|
230
|
+
/** Panes read in tab order, whatever order they were dropped in. */
|
|
231
|
+
afterPaneMove: function(container) {
|
|
232
|
+
var content = one(container, ":scope > .tab-content");
|
|
233
|
+
all(container, ":scope > .nav-tabs > .nav-item").forEach(function(tab) {
|
|
234
|
+
var pane = paneOf(container, tab);
|
|
235
|
+
if (pane) {
|
|
236
|
+
content.appendChild(pane);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
145
240
|
};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
})(jQuery);
|
|
241
|
+
};
|
|
242
|
+
})();
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
(
|
|
2
|
-
//# sourceMappingURL=grideditor.tabs.min.js.map
|
|
1
|
+
(()=>{var d=window.GridEditor;if(!d||typeof d.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 c(t,r){return t?Array.prototype.slice.call(t.querySelectorAll(r)):[]}function f(t,r){return t?t.querySelector(r):null}function g(t,r){return t?Array.prototype.filter.call(t.children,function(a){return!r||a.matches(r)}):[]}function y(t,r){return g(t,r)[0]||null}function s(t,r,a){var l=document.createElement(t);return Object.keys(r||{}).forEach(function(n){var e=r[n];e!=null&&e!==!1&&l.setAttribute(n,e)}),a!=null&&(l.textContent=a),l}function v(t,r){return x(r).forEach(function(a){t.classList.add(a)}),t}function h(t,r){return x(r).forEach(function(a){t.classList.remove(a)}),t}function E(t,r,a){return x(r).forEach(function(l){a===void 0?t.classList.toggle(l):t.classList.toggle(l,!!a)}),t}function C(t,r){return!!t&&t.nodeType===1&&t.classList.contains(r)}function x(t){return String(t||"").split(/\s+/).filter(Boolean)}function T(t){return t.style.display="none",t}function S(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}var k=400;function B(t,r,a,l){a=a===void 0?k:a;var n=function(){T(t),l&&l()};if(!S(t)||!t.animate||a<=0){window.setTimeout(n,0);return}var e=t.animate(r(getComputedStyle(t)),{duration:a,easing:"ease-in-out"}),o=!1,i=function(){o||(o=!0,n())};e.onfinish=i,e.oncancel=i}function w(t,r,a){B(t,function(l){return[{opacity:l.opacity},{opacity:0}]},r,a)}Object.assign(d.locales.en,{"container.add_tabs":"Tabs","container.add_tab":"Add tab","container.tab_label":"Tab {number}","confirm.delete_tab":"Delete this tab and everything in it?"});d.containers.tabs=function(t){function r(n,e){e=e||{};var o=f(n,":scope > .nav-tabs"),i=f(n,":scope > .tab-content"),u=t.containerId("tab"),p=g(o,".nav-item").length+1,m=o.appendChild(s("li",{class:"nav-item ge-tab",role:"presentation"})),A=m.appendChild(s("button",{class:"nav-link",type:"button",role:"tab","data-bs-toggle":"tab","data-bs-target":"#"+u,"aria-controls":u}));A.appendChild(s("span",{class:"ge-pane-label"},e.label||t.t("container.tab_label",{number:p})));var b=i.appendChild(s("div",{class:"tab-pane fade",role:"tabpanel",tabindex:"0",id:u}));return b.appendChild(t.defaultRegion()),(e.activate||p===1)&&a(n,b),b}function a(n,e){var o=e.getAttribute("id");c(n,":scope > .tab-content > .tab-pane").forEach(function(i){h(i,"show active")}),v(e,"show active"),c(n,":scope > .nav-tabs .nav-link").forEach(function(i){var u=i.getAttribute("data-bs-target")==="#"+o;E(i,"active",u),i.setAttribute("aria-selected",u?"true":"false")})}function l(n,e){var o=f(e,".nav-link"),i=o?o.getAttribute("data-bs-target"):null;return i?f(n,i):null}return{labelKey:"container.add_tabs",onSortable:function(n){n(c(t.canvas,".ge-container-tabs > .nav-tabs"),{draggable:".ge-tab"})},addPaneKey:"container.add_tab",paneKind:"tab",create:function(n){var e=s("div",{"data-ge-container":"tabs"}),o=n.labels||[],i=n.tabs||o.length||2;e.appendChild(s("ul",{class:"nav nav-tabs",role:"tablist"})),e.appendChild(s("div",{class:"tab-content"}));for(var u=0;u<i;u++)r(e,{label:o[u]});return e},addPane:r,mark:function(n){c(n,":scope > .tab-content > .tab-pane").forEach(function(e){v(e,"ge-tab-pane")}),c(n,":scope > .nav-tabs > .nav-item").forEach(function(e){v(e,"ge-tab");var o=f(e,".nav-link");o&&t.makeLabelEditable(t.labelIn(o)),!y(e,".ge-tools-drawer")&&t.createPaneControls(e,"tab",t.settings.tab_tools,t.t("confirm.delete_tab"),function(i){var u=l(n,e),p=C(u,"active");w(e,200,function(){u&&u.remove(),i();var m=f(n,":scope > .tab-content > .tab-pane");p&&m&&a(n,m)})})})},unmark:function(n){t.resumeToggles(n),c(n,".ge-tab-pane").forEach(function(e){h(e,"ge-tab-pane")}),t.unwrapLabels(n)},afterPaneMove:function(n){var e=f(n,":scope > .tab-content");c(n,":scope > .nav-tabs > .nav-item").forEach(function(o){var i=l(n,o);i&&e.appendChild(i)})}}};})();
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.tabs.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 * Tabs for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a tabs container. What it can ask the editor for is the handle its factory is\n * called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.tabs.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_tabs': 'Tabs',\n 'container.add_tab': 'Add tab',\n 'container.tab_label': 'Tab {number}',\n 'confirm.delete_tab': 'Delete this tab and everything in it?',\n});\n\nGridEditor.containers.tabs = function(ge) {\n\n function addTabTo(container, options) {\n options = options || {};\n\n var strip = dom.one(container, ':scope > .nav-tabs');\n var content = dom.one(container, ':scope > .tab-content');\n var id = ge.containerId('tab');\n var number = dom.children(strip, '.nav-item').length + 1;\n\n var tab = strip.appendChild(dom.element('li', { 'class': 'nav-item ge-tab', role: 'presentation' }));\n var button = tab.appendChild(dom.element('button', {\n 'class': 'nav-link',\n type: 'button',\n role: 'tab',\n 'data-bs-toggle': 'tab',\n 'data-bs-target': '#' + id,\n 'aria-controls': id,\n }));\n button.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.label || ge.t('container.tab_label', { number: number })));\n\n var pane = content.appendChild(dom.element('div', {\n 'class': 'tab-pane fade',\n role: 'tabpanel',\n tabindex: '0',\n id: id,\n }));\n pane.appendChild(ge.defaultRegion());\n\n if (options.activate || number === 1) { activatePane(container, pane); }\n\n return pane;\n }\n\n function activatePane(container, pane) {\n var id = pane.getAttribute('id');\n\n dom.all(container, ':scope > .tab-content > .tab-pane').forEach(function(each) {\n dom.removeClass(each, 'show active');\n });\n dom.addClass(pane, 'show active');\n\n dom.all(container, ':scope > .nav-tabs .nav-link').forEach(function(button) {\n var active = button.getAttribute('data-bs-target') === '#' + id;\n\n dom.toggleClass(button, 'active', active);\n button.setAttribute('aria-selected', active ? 'true' : 'false');\n });\n }\n\n function paneOf(container, tab) {\n var link = dom.one(tab, '.nav-link');\n var target = link ? link.getAttribute('data-bs-target') : null;\n\n return target ? dom.one(container, target) : null;\n }\n\n return {\n labelKey: 'container.add_tabs',\n\n // A tab strip sorts its own tabs, and the panes follow them. No\n // group: a tab belongs to the strip it was made in.\n onSortable: function(sortable) {\n sortable(dom.all(ge.canvas, '.ge-container-tabs > .nav-tabs'), {\n draggable: '.ge-tab',\n });\n },\n addPaneKey: 'container.add_tab',\n paneKind: 'tab',\n\n create: function(options) {\n var container = dom.element('div', { 'data-ge-container': 'tabs' });\n var labels = options.labels || [];\n var count = options.tabs || labels.length || 2;\n\n container.appendChild(dom.element('ul', { 'class': 'nav nav-tabs', role: 'tablist' }));\n container.appendChild(dom.element('div', { 'class': 'tab-content' }));\n\n for (var i = 0; i < count; i++) {\n addTabTo(container, { label: labels[i] });\n }\n\n return container;\n },\n\n addPane: addTabTo,\n\n mark: function(container) {\n dom.all(container, ':scope > .tab-content > .tab-pane').forEach(function(pane) {\n dom.addClass(pane, 'ge-tab-pane');\n });\n\n dom.all(container, ':scope > .nav-tabs > .nav-item').forEach(function(tab) {\n dom.addClass(tab, 'ge-tab');\n\n var link = dom.one(tab, '.nav-link');\n if (link) { ge.makeLabelEditable(ge.labelIn(link)); }\n\n if (dom.child(tab, '.ge-tools-drawer')) { return; }\n\n ge.createPaneControls(tab, 'tab', ge.settings.tab_tools, ge.t('confirm.delete_tab'),\n function(removed) {\n var pane = paneOf(container, tab);\n var wasActive = dom.hasClass(pane, 'active');\n\n dom.fadeOut(tab, 200, function() {\n if (pane) { pane.remove(); }\n removed();\n\n var first = dom.one(container, ':scope > .tab-content > .tab-pane');\n if (wasActive && first) { activatePane(container, first); }\n });\n });\n });\n },\n\n unmark: function(container) {\n ge.resumeToggles(container);\n dom.all(container, '.ge-tab-pane').forEach(function(pane) {\n dom.removeClass(pane, 'ge-tab-pane');\n });\n ge.unwrapLabels(container);\n },\n\n /** Panes read in tab order, whatever order they were dropped in. */\n afterPaneMove: function(container) {\n var content = dom.one(container, ':scope > .tab-content');\n\n dom.all(container, ':scope > .nav-tabs > .nav-item').forEach(function(tab) {\n var pane = paneOf(container, tab);\n if (pane) { content.appendChild(pane); }\n });\n },\n };\n};\n"],
|
|
5
|
+
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECCvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAOD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AG,EAC5BoB,EAAgBC,EAASlB,EAAM,QAAQ,EAEvCmB,EAAQtB,EAAK,IAAK,UAAW,CACzBG,GAAQA,EAAK,OAAO,EACxBgB,EAAQ,EAER,IAAII,EAAY5B,EAAIH,EAAW,mCAAmC,EAC9D4B,GAAaG,GAASnB,EAAaZ,EAAW+B,CAAK,CAC3D,CAAC,CACL,CAAC,CACT,CAAC,CACL,EAEA,OAAQ,SAAS/B,EAAW,CACxBF,EAAG,cAAcE,CAAS,EACtBa,EAAIb,EAAW,cAAc,EAAE,QAAQ,SAASW,EAAM,CAClDI,EAAYJ,EAAM,aAAa,CACvC,CAAC,EACDb,EAAG,aAAaE,CAAS,CAC7B,EAGA,cAAe,SAASA,EAAW,CAC/B,IAAII,EAAcD,EAAIH,EAAW,uBAAuB,EAEpDa,EAAIb,EAAW,gCAAgC,EAAE,QAAQ,SAASQ,EAAK,CACvE,IAAIG,EAAOQ,EAAOnB,EAAWQ,CAAG,EAC5BG,GAAQP,EAAQ,YAAYO,CAAI,CACxC,CAAC,CACL,CACJ,CACJ",
|
|
6
|
+
"names": ["GridEditor", "all", "root", "selector", "one", "children", "node", "selector", "each", "child", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "toggleClass", "state", "hasClass", "hide", "node", "visible", "node", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "fadeOut", "node", "duration", "done", "animateAway", "style", "GridEditor", "ge", "addTabTo", "container", "options", "strip", "one", "content", "id", "number", "children", "tab", "element", "button", "pane", "activatePane", "all", "each", "removeClass", "addClass", "active", "toggleClass", "paneOf", "link", "target", "sortable", "labels", "count", "i", "child", "removed", "wasActive", "hasClass", "fadeOut", "first"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/js/plugins/grideditor.textalign.js
|
|
2
|
+
import { GridEditor } from "../grideditor.esm.js";
|
|
3
|
+
Object.assign(GridEditor.locales.en, {
|
|
4
|
+
"utility.text_align": "Text alignment",
|
|
5
|
+
"utility.text_start": "Start",
|
|
6
|
+
"utility.text_center": "Center",
|
|
7
|
+
"utility.text_end": "End"
|
|
8
|
+
});
|
|
9
|
+
var CSS = { start: "left", center: "center", end: "right" };
|
|
10
|
+
GridEditor.utilities.textalign = function(ge) {
|
|
11
|
+
function label(value) {
|
|
12
|
+
if (value === "start") {
|
|
13
|
+
return ge.t("utility.text_start");
|
|
14
|
+
}
|
|
15
|
+
if (value === "center") {
|
|
16
|
+
return ge.t("utility.text_center");
|
|
17
|
+
}
|
|
18
|
+
return ge.t("utility.text_end");
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
families: [{
|
|
22
|
+
name: "text-align",
|
|
23
|
+
prefix: "text",
|
|
24
|
+
values: ["start", "center", "end"],
|
|
25
|
+
appliesTo: ["row", "column", "text", "element", "container"],
|
|
26
|
+
labelKey: "utility.text_align",
|
|
27
|
+
label,
|
|
28
|
+
/**
|
|
29
|
+
* With no class applying here, the node aligns as its parent
|
|
30
|
+
* does - or as the host's css says - which only the browser can
|
|
31
|
+
* tell, so it is asked with the classes out of the way. Parents
|
|
32
|
+
* are previewed before their children, so the parent's answer is
|
|
33
|
+
* already the view's.
|
|
34
|
+
*/
|
|
35
|
+
preview: function(value, node) {
|
|
36
|
+
return { "text-align": value === null ? ge.bareStyle(node, "text-align", "text-align") : CSS[value] };
|
|
37
|
+
}
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
};
|