@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
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// src/js/plugins/grideditor.spacing.js
|
|
2
|
+
import { GridEditor } from "../grideditor.esm.js";
|
|
3
|
+
|
|
4
|
+
// src/js/dom.js
|
|
5
|
+
function all(root, selector) {
|
|
6
|
+
return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
|
|
7
|
+
}
|
|
8
|
+
function selfAndAll(root, selector) {
|
|
9
|
+
if (!root) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
var found = all(root, selector);
|
|
13
|
+
if (root.nodeType === 1 && root.matches(selector)) {
|
|
14
|
+
found.unshift(root);
|
|
15
|
+
}
|
|
16
|
+
return found;
|
|
17
|
+
}
|
|
18
|
+
function children(node, selector) {
|
|
19
|
+
if (!node) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return Array.prototype.filter.call(node.children, function(each) {
|
|
23
|
+
return !selector || each.matches(selector);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function child(node, selector) {
|
|
27
|
+
return children(node, selector)[0] || null;
|
|
28
|
+
}
|
|
29
|
+
function is(node, selector) {
|
|
30
|
+
return !!node && node.nodeType === 1 && node.matches(selector);
|
|
31
|
+
}
|
|
32
|
+
function element(tag, attributes, text) {
|
|
33
|
+
var node = document.createElement(tag);
|
|
34
|
+
Object.keys(attributes || {}).forEach(function(name) {
|
|
35
|
+
var value = attributes[name];
|
|
36
|
+
if (value !== null && value !== void 0 && value !== false) {
|
|
37
|
+
node.setAttribute(name, value);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (text !== void 0 && text !== null) {
|
|
41
|
+
node.textContent = text;
|
|
42
|
+
}
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
function hasClass(node, name) {
|
|
46
|
+
return !!node && node.nodeType === 1 && node.classList.contains(name);
|
|
47
|
+
}
|
|
48
|
+
function css(node, styles) {
|
|
49
|
+
Object.keys(styles).forEach(function(property) {
|
|
50
|
+
var value = styles[property];
|
|
51
|
+
if (typeof value === "number" && !UNITLESS[property]) {
|
|
52
|
+
value = value + "px";
|
|
53
|
+
}
|
|
54
|
+
node.style.setProperty(property, value === null || value === void 0 ? "" : String(value));
|
|
55
|
+
});
|
|
56
|
+
return node;
|
|
57
|
+
}
|
|
58
|
+
var UNITLESS = { opacity: true, "z-index": true, "flex-grow": true, "flex-shrink": true, order: true };
|
|
59
|
+
var defaultDisplays = {};
|
|
60
|
+
function defaultDisplay(node) {
|
|
61
|
+
var tag = node.nodeName;
|
|
62
|
+
if (!defaultDisplays[tag]) {
|
|
63
|
+
var probe = document.body.appendChild(document.createElement(tag));
|
|
64
|
+
defaultDisplays[tag] = getComputedStyle(probe).display;
|
|
65
|
+
probe.remove();
|
|
66
|
+
if (defaultDisplays[tag] === "none") {
|
|
67
|
+
defaultDisplays[tag] = "block";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return defaultDisplays[tag];
|
|
71
|
+
}
|
|
72
|
+
function show(node) {
|
|
73
|
+
node.style.removeProperty("display");
|
|
74
|
+
if (getComputedStyle(node).display === "none") {
|
|
75
|
+
node.style.display = defaultDisplay(node);
|
|
76
|
+
}
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
79
|
+
function hide(node) {
|
|
80
|
+
node.style.display = "none";
|
|
81
|
+
return node;
|
|
82
|
+
}
|
|
83
|
+
function toggle(node, state) {
|
|
84
|
+
if (state === void 0) {
|
|
85
|
+
state = !visible(node);
|
|
86
|
+
}
|
|
87
|
+
return state ? show(node) : hide(node);
|
|
88
|
+
}
|
|
89
|
+
function visible(node) {
|
|
90
|
+
return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/js/plugins/grideditor.spacing.js
|
|
94
|
+
Object.assign(GridEditor.locales.en, {
|
|
95
|
+
"utility.padding": "Padding",
|
|
96
|
+
"utility.margin": "Margin",
|
|
97
|
+
"utility.side_all": "All sides",
|
|
98
|
+
"utility.side_x": "Left and right",
|
|
99
|
+
"utility.side_y": "Top and bottom",
|
|
100
|
+
"utility.side_t": "Top",
|
|
101
|
+
"utility.side_b": "Bottom",
|
|
102
|
+
"utility.side_s": "Start",
|
|
103
|
+
"utility.side_e": "End",
|
|
104
|
+
"utility.spacing_gutter": "A column's side padding is its gutter: changing it changes the gutter"
|
|
105
|
+
});
|
|
106
|
+
var VALUES = ["0", "1", "2", "3", "4", "5"];
|
|
107
|
+
var SCALE = ["0", ".25rem", ".5rem", "1rem", "1.5rem", "3rem"];
|
|
108
|
+
var SIDES = ["", "x", "y", "t", "e", "b", "s"];
|
|
109
|
+
var SET = {
|
|
110
|
+
"": ["top", "right", "bottom", "left"],
|
|
111
|
+
x: ["left", "right"],
|
|
112
|
+
y: ["top", "bottom"],
|
|
113
|
+
t: ["top"],
|
|
114
|
+
e: ["right"],
|
|
115
|
+
b: ["bottom"],
|
|
116
|
+
s: ["left"]
|
|
117
|
+
};
|
|
118
|
+
var INFIXES = ["", "sm", "md", "lg", "xl", "xxl"];
|
|
119
|
+
var PROPERTIES = { p: "padding", m: "margin" };
|
|
120
|
+
function pattern(key) {
|
|
121
|
+
return new RegExp("^" + key + "[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$");
|
|
122
|
+
}
|
|
123
|
+
GridEditor.utilities.spacing = function(ge) {
|
|
124
|
+
var options = Object.assign({ values: VALUES, scale: SCALE }, ge.settings.utilities.spacing);
|
|
125
|
+
var patterns = { p: pattern("p"), m: pattern("m") };
|
|
126
|
+
function applies(node, kind) {
|
|
127
|
+
return kind === "row" || kind === "column" || kind === "element" || is(node, "[data-ge-container]");
|
|
128
|
+
}
|
|
129
|
+
function classes(node) {
|
|
130
|
+
return (node.getAttribute("class") || "").split(/\s+/);
|
|
131
|
+
}
|
|
132
|
+
function carries(node, key) {
|
|
133
|
+
return classes(node).some(function(name) {
|
|
134
|
+
return patterns[key].test(name);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function source(node, family, tier) {
|
|
138
|
+
var names = classes(node);
|
|
139
|
+
var values = family.charAt(0) === "m" ? VALUES.concat(["auto"]) : VALUES;
|
|
140
|
+
for (var i = tier; i >= 0; i--) {
|
|
141
|
+
for (var v = 0; v < values.length; v++) {
|
|
142
|
+
var name = family + (INFIXES[i] ? "-" + INFIXES[i] : "") + "-" + values[v];
|
|
143
|
+
if (names.indexOf(name) !== -1) {
|
|
144
|
+
return { tier: i, value: values[v] };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
function without(node, key) {
|
|
151
|
+
var original = node.getAttribute("class");
|
|
152
|
+
var style;
|
|
153
|
+
var bare = {};
|
|
154
|
+
node.setAttribute("class", classes(node).filter(function(name) {
|
|
155
|
+
return !patterns[key].test(name);
|
|
156
|
+
}).join(" "));
|
|
157
|
+
style = getComputedStyle(node);
|
|
158
|
+
["top", "right", "bottom", "left"].forEach(function(side) {
|
|
159
|
+
bare[side] = style.getPropertyValue(PROPERTIES[key] + "-" + side);
|
|
160
|
+
});
|
|
161
|
+
if (original === null) {
|
|
162
|
+
node.removeAttribute("class");
|
|
163
|
+
} else {
|
|
164
|
+
node.setAttribute("class", original);
|
|
165
|
+
}
|
|
166
|
+
return bare;
|
|
167
|
+
}
|
|
168
|
+
function sides(node, key, breakpoint) {
|
|
169
|
+
var tier = ge.breakpoints.indexOf(breakpoint);
|
|
170
|
+
var winners = {};
|
|
171
|
+
var styles = {};
|
|
172
|
+
var neutral = null;
|
|
173
|
+
SIDES.forEach(function(side, order) {
|
|
174
|
+
var found = source(node, key + side, tier);
|
|
175
|
+
if (!found) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
SET[side].forEach(function(set) {
|
|
179
|
+
var current = winners[set];
|
|
180
|
+
if (!current || found.tier > current.tier || found.tier === current.tier && order > current.order) {
|
|
181
|
+
winners[set] = { tier: found.tier, order, value: found.value };
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
["top", "right", "bottom", "left"].forEach(function(set) {
|
|
186
|
+
var winner = winners[set];
|
|
187
|
+
if (!winner) {
|
|
188
|
+
neutral = neutral || without(node, key);
|
|
189
|
+
styles[PROPERTIES[key] + "-" + set] = neutral[set];
|
|
190
|
+
} else {
|
|
191
|
+
styles[PROPERTIES[key] + "-" + set] = winner.value === "auto" ? "auto" : options.scale[winner.value];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return styles;
|
|
195
|
+
}
|
|
196
|
+
function startingSide(node, key) {
|
|
197
|
+
var names = classes(node).filter(function(name) {
|
|
198
|
+
return patterns[key].test(name);
|
|
199
|
+
});
|
|
200
|
+
var found = SIDES.filter(function(side) {
|
|
201
|
+
return names.some(function(name) {
|
|
202
|
+
return name.indexOf(key + side + "-") === 0;
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
return found.length ? found[0] : "";
|
|
206
|
+
}
|
|
207
|
+
function sideLabel(side) {
|
|
208
|
+
switch (side) {
|
|
209
|
+
case "x":
|
|
210
|
+
return ge.t("utility.side_x");
|
|
211
|
+
case "y":
|
|
212
|
+
return ge.t("utility.side_y");
|
|
213
|
+
case "t":
|
|
214
|
+
return ge.t("utility.side_t");
|
|
215
|
+
case "b":
|
|
216
|
+
return ge.t("utility.side_b");
|
|
217
|
+
case "s":
|
|
218
|
+
return ge.t("utility.side_s");
|
|
219
|
+
case "e":
|
|
220
|
+
return ge.t("utility.side_e");
|
|
221
|
+
default:
|
|
222
|
+
return ge.t("utility.side_all");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function group(node, key, labelText) {
|
|
226
|
+
var box = element("div", { "class": "ge-spacing-group", "data-ge-spacing": key });
|
|
227
|
+
var side = element("select", { "class": "ge-spacing-side form-select form-select-sm" });
|
|
228
|
+
box.appendChild(element("span", { "class": "ge-utility-label" }, labelText));
|
|
229
|
+
SIDES.forEach(function(value) {
|
|
230
|
+
side.appendChild(element("option", { value }, sideLabel(value)));
|
|
231
|
+
});
|
|
232
|
+
var field = ge.utilityField(node, key + startingSide(node, key));
|
|
233
|
+
side.value = field.getAttribute("data-ge-family").slice(1);
|
|
234
|
+
side.addEventListener("change", function() {
|
|
235
|
+
var next = ge.utilityField(node, key + this.value);
|
|
236
|
+
field.replaceWith(next);
|
|
237
|
+
field = next;
|
|
238
|
+
});
|
|
239
|
+
box.appendChild(side);
|
|
240
|
+
box.appendChild(field);
|
|
241
|
+
return box;
|
|
242
|
+
}
|
|
243
|
+
var NODES = ".row, .column, .ge-element, [data-ge-container]";
|
|
244
|
+
function mark(scope) {
|
|
245
|
+
selfAndAll(scope, NODES).forEach(function(node) {
|
|
246
|
+
var drawer = child(node, ".ge-tools-drawer");
|
|
247
|
+
if (!drawer || !applies(node, ge.kindOf(node))) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (carries(node, "p")) {
|
|
251
|
+
var style = getComputedStyle(node);
|
|
252
|
+
css(drawer, {
|
|
253
|
+
"margin-top": "-" + style.paddingTop,
|
|
254
|
+
"margin-left": "-" + style.paddingLeft,
|
|
255
|
+
"margin-right": "-" + style.paddingRight,
|
|
256
|
+
width: "calc(100% + " + style.paddingLeft + " + " + style.paddingRight + ")"
|
|
257
|
+
});
|
|
258
|
+
} else {
|
|
259
|
+
css(drawer, { "margin-top": "", "margin-left": "", "margin-right": "", width: "" });
|
|
260
|
+
}
|
|
261
|
+
if (hasClass(node, "column")) {
|
|
262
|
+
var padded = classes(node).some(function(name) {
|
|
263
|
+
return /^p[xse]?-/.test(name) && patterns.p.test(name);
|
|
264
|
+
});
|
|
265
|
+
all(drawer, ".ge-spacing-gutter").forEach(function(note) {
|
|
266
|
+
toggle(note, padded);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function families(key, labelKey) {
|
|
272
|
+
var values = key === "m" ? VALUES.concat(["auto"]) : VALUES;
|
|
273
|
+
var offered = options.values.concat(key === "m" ? ["auto"] : []);
|
|
274
|
+
return SIDES.map(function(side) {
|
|
275
|
+
return {
|
|
276
|
+
name: key + side,
|
|
277
|
+
prefix: key + side,
|
|
278
|
+
values,
|
|
279
|
+
appliesTo: ["row", "column", "text", "element", "container"],
|
|
280
|
+
labelKey,
|
|
281
|
+
panel: false,
|
|
282
|
+
choices: function() {
|
|
283
|
+
return values.filter(function(value) {
|
|
284
|
+
return offered.indexOf(value) !== -1;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
families: families("p", "utility.padding").concat(families("m", "utility.margin")),
|
|
292
|
+
panel: function(node, kind) {
|
|
293
|
+
if (!applies(node, kind)) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
var box = element("div", { "class": "ge-spacing" });
|
|
297
|
+
box.appendChild(group(node, "p", ge.t("utility.padding")));
|
|
298
|
+
box.appendChild(group(node, "m", ge.t("utility.margin")));
|
|
299
|
+
if (kind === "column") {
|
|
300
|
+
box.appendChild(element("small", { "class": "ge-spacing-gutter" }, ge.t("utility.spacing_gutter")));
|
|
301
|
+
}
|
|
302
|
+
return box;
|
|
303
|
+
},
|
|
304
|
+
preview: function(node, kind, breakpoint) {
|
|
305
|
+
if (!applies(node, kind)) {
|
|
306
|
+
return {};
|
|
307
|
+
}
|
|
308
|
+
var styles = {};
|
|
309
|
+
["p", "m"].forEach(function(key) {
|
|
310
|
+
if (carries(node, key)) {
|
|
311
|
+
Object.assign(styles, sides(node, key, breakpoint));
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return styles;
|
|
315
|
+
},
|
|
316
|
+
onRefresh: mark
|
|
317
|
+
};
|
|
318
|
+
};
|