@themarioga/grid-editor 9.0.0-beta.6 → 9.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +54 -27
- package/UPGRADING.md +1 -1
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +24 -3
- package/dist/grideditor.d.ts +27 -2
- package/dist/grideditor.esm.js +64 -7
- package/dist/grideditor.js +64 -7
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +2 -0
- package/dist/locales/grideditor.es.js +2 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.esm.js +9 -0
- package/dist/plugins/grideditor.accordion.js +9 -0
- package/dist/plugins/grideditor.accordion.min.js +1 -1
- package/dist/plugins/grideditor.accordion.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js +1 -1
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.carousel.esm.js +3 -0
- package/dist/plugins/grideditor.carousel.js +3 -0
- package/dist/plugins/grideditor.carousel.min.js +1 -1
- package/dist/plugins/grideditor.carousel.min.js.map +3 -3
- package/dist/plugins/grideditor.ckeditor.esm.js +9 -0
- package/dist/plugins/grideditor.ckeditor.js +9 -0
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.esm.js +44 -7
- package/dist/plugins/grideditor.clipboard.js +44 -7
- package/dist/plugins/grideditor.clipboard.min.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.esm.js +3 -0
- package/dist/plugins/grideditor.elements.js +3 -0
- package/dist/plugins/grideditor.elements.min.js +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +3 -3
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.history.esm.js +1 -1
- package/dist/plugins/grideditor.history.js +1 -1
- package/dist/plugins/grideditor.history.min.js +1 -1
- package/dist/plugins/grideditor.history.min.js.map +2 -2
- package/dist/plugins/grideditor.inline-style.esm.js +66 -3
- package/dist/plugins/grideditor.inline-style.js +66 -3
- package/dist/plugins/grideditor.inline-style.min.js +4 -4
- package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
- package/dist/plugins/grideditor.offcanvas.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.esm.js +9 -0
- package/dist/plugins/grideditor.sections.js +9 -0
- package/dist/plugins/grideditor.sections.min.js +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +3 -3
- package/dist/plugins/grideditor.summernote.esm.js +9 -0
- package/dist/plugins/grideditor.summernote.js +9 -0
- package/dist/plugins/grideditor.summernote.min.js +1 -1
- package/dist/plugins/grideditor.summernote.min.js.map +3 -3
- package/dist/plugins/grideditor.tabs.esm.js +3 -0
- package/dist/plugins/grideditor.tabs.js +3 -0
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/dist/plugins/grideditor.tinymce.esm.js +9 -0
- package/dist/plugins/grideditor.tinymce.js +9 -0
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +6 -1
- package/docs/locale-keys.md +2 -0
- package/docs/plugins.md +9 -7
- package/example/adapter.html +11 -1
- package/example/clipboard.html +7 -4
- package/example/{autocols.html → columns.html} +61 -20
- package/example/containers.html +13 -2
- package/example/{attributes.html → custom-plugins.html} +130 -12
- package/example/elements.html +13 -2
- package/example/history.html +6 -3
- package/example/index.html +30 -81
- package/example/playground.html +840 -0
- package/example/style.html +291 -0
- package/example/text-editors.html +320 -0
- package/package.json +1 -1
- package/src/js/dom.js +6 -0
- package/src/js/grideditor.js +69 -7
- package/src/js/inline-style/accordion.js +4 -3
- package/src/js/inline-style/fields.js +56 -3
- package/src/js/inline-style/options.js +12 -0
- package/src/js/locales/grideditor.es.js +2 -0
- package/src/js/plugins/grideditor.clipboard.js +61 -11
- package/src/js/plugins/grideditor.history.js +3 -3
- package/src/js/plugins/grideditor.inline-style.js +10 -0
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +26 -3
- package/types/grideditor.d.ts +27 -2
- package/example/breakpoints.html +0 -100
- package/example/ckeditor.html +0 -110
- package/example/custom_editor.html +0 -212
- package/example/inline-style.html +0 -163
- package/example/plugins.html +0 -251
- package/example/summernote.html +0 -114
- package/example/utilities.html +0 -200
package/dist/grideditor.css
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
ones that don't fit go behind a button at its end. The right-hand
|
|
12
12
|
buttons come before in the markup, so they are ordered back to how
|
|
13
13
|
floating them puts them. */
|
|
14
|
+
/* As wide as its buttons, so the more button comes right after them;
|
|
15
|
+
the room left over pushes the right-hand buttons to the end, from
|
|
16
|
+
the line or, while it shows, from the more button */
|
|
14
17
|
}
|
|
15
18
|
.ge-mainControls .ge-wrapper {
|
|
16
19
|
padding-top: 5px;
|
|
@@ -88,33 +91,51 @@
|
|
|
88
91
|
}
|
|
89
92
|
.ge-mainControls .ge-toolbar-start {
|
|
90
93
|
display: flex;
|
|
91
|
-
flex:
|
|
94
|
+
flex: 0 1 auto;
|
|
92
95
|
min-width: 0;
|
|
96
|
+
margin-right: auto;
|
|
93
97
|
overflow: hidden;
|
|
94
98
|
/* A group as wide as its buttons and a button as wide as its label:
|
|
95
99
|
squeezed, they would wrap their labels rather than overflow */
|
|
96
100
|
}
|
|
97
101
|
.ge-mainControls .ge-toolbar-start > .btn-group {
|
|
98
102
|
flex: none;
|
|
103
|
+
/* All its buttons behind the more button: no margin left over */
|
|
104
|
+
}
|
|
105
|
+
.ge-mainControls .ge-toolbar-start > .btn-group:empty {
|
|
106
|
+
display: none;
|
|
99
107
|
}
|
|
100
108
|
.ge-mainControls .ge-toolbar-start .btn {
|
|
101
109
|
white-space: nowrap;
|
|
102
110
|
}
|
|
111
|
+
.ge-mainControls .ge-toolbar-start .btn.ge-before-more {
|
|
112
|
+
border-top-right-radius: 0;
|
|
113
|
+
border-bottom-right-radius: 0;
|
|
114
|
+
}
|
|
115
|
+
.ge-mainControls .ge-toolbar-overflowing > .ge-toolbar-start {
|
|
116
|
+
margin-right: 0;
|
|
117
|
+
}
|
|
103
118
|
.ge-mainControls .ge-toolbar-more {
|
|
104
119
|
display: none;
|
|
105
120
|
position: relative;
|
|
106
121
|
flex: none;
|
|
107
|
-
margin: 0
|
|
122
|
+
margin: 0 auto 0 -1px;
|
|
123
|
+
padding-right: 5px;
|
|
124
|
+
/* Joined to the last button on the line, as in a btn-group */
|
|
108
125
|
}
|
|
109
126
|
.ge-mainControls .ge-toolbar-more.ge-needed {
|
|
110
127
|
display: block;
|
|
111
128
|
}
|
|
129
|
+
.ge-mainControls .ge-toolbar-more > .btn {
|
|
130
|
+
border-top-left-radius: 0;
|
|
131
|
+
border-bottom-left-radius: 0;
|
|
132
|
+
}
|
|
112
133
|
.ge-mainControls .ge-toolbar-overflow {
|
|
113
134
|
display: none;
|
|
114
135
|
position: absolute;
|
|
115
136
|
z-index: 30;
|
|
116
137
|
top: calc(100% + 4px);
|
|
117
|
-
right:
|
|
138
|
+
right: 5px;
|
|
118
139
|
flex-direction: column;
|
|
119
140
|
gap: 6px;
|
|
120
141
|
width: max-content;
|
package/dist/grideditor.d.ts
CHANGED
|
@@ -140,6 +140,24 @@ export interface CreateOffcanvasOptions extends Placement, OffcanvasOptions {
|
|
|
140
140
|
trigger_label?: string;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
/** What a file browser is told about the field it was opened from. */
|
|
144
|
+
export interface InlineStyleBrowseContext {
|
|
145
|
+
node: HTMLElement;
|
|
146
|
+
property: string;
|
|
147
|
+
/** What the field shows: the url, or the value as it is when it is not one. */
|
|
148
|
+
value: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The host's file browser. It answers with `done(url)`, or with a promise of
|
|
153
|
+
* the url: the first answer counts. Nothing, `null` or an empty text leaves
|
|
154
|
+
* the field as it was.
|
|
155
|
+
*/
|
|
156
|
+
export type InlineStyleBrowse = (
|
|
157
|
+
done: (url?: string | null) => void,
|
|
158
|
+
context: InlineStyleBrowseContext,
|
|
159
|
+
) => void | Promise<string | null | undefined>;
|
|
160
|
+
|
|
143
161
|
/** The inline-style plugin's settings. */
|
|
144
162
|
export interface InlineStyleOptions {
|
|
145
163
|
/** Every section is on unless it is turned off here. */
|
|
@@ -148,6 +166,8 @@ export interface InlineStyleOptions {
|
|
|
148
166
|
spacing?: { values?: string[]; scale?: string[] };
|
|
149
167
|
/** The eye that hides and shows a node, the display family's: false leaves it out of the drawers. */
|
|
150
168
|
visibility?: { drawer?: boolean };
|
|
169
|
+
/** A file browser for the url fields: with it they have a button that opens it. */
|
|
170
|
+
browse?: InlineStyleBrowse;
|
|
151
171
|
}
|
|
152
172
|
|
|
153
173
|
/** What the sidebar shows while nothing is selected, instead of its message. */
|
|
@@ -331,11 +351,16 @@ export interface Payload {
|
|
|
331
351
|
parent: HTMLElement | null;
|
|
332
352
|
canvas: HTMLElement;
|
|
333
353
|
breakpoint: View;
|
|
334
|
-
source: 'api' | 'tool' | 'dragdrop' | 'paste' | 'panel' | 'shortcut' | string;
|
|
354
|
+
source: 'api' | 'tool' | 'dragdrop' | 'paste' | 'cut' | 'panel' | 'shortcut' | string;
|
|
335
355
|
/** A pane inside a container. */
|
|
336
356
|
container?: HTMLElement;
|
|
337
357
|
}
|
|
338
358
|
|
|
359
|
+
/** A node was copied, or cut: with the clipboard plugin, `source` is 'tool' or 'shortcut', and `cut` says whether the node is leaving. */
|
|
360
|
+
export interface CopyPayload extends Payload {
|
|
361
|
+
cut: boolean;
|
|
362
|
+
}
|
|
363
|
+
|
|
339
364
|
export interface MovePayload extends Payload {
|
|
340
365
|
from: Position;
|
|
341
366
|
to?: Position;
|
|
@@ -438,7 +463,7 @@ export interface GridEditorEventMap {
|
|
|
438
463
|
'grideditor:after-convert': ConvertPayload;
|
|
439
464
|
'grideditor:before-edit-html': EditHtmlPayload;
|
|
440
465
|
'grideditor:after-edit-html': EditHtmlPayload;
|
|
441
|
-
'grideditor:after-copy':
|
|
466
|
+
'grideditor:after-copy': CopyPayload;
|
|
442
467
|
'grideditor:popup-orphan': PopupOrphanPayload;
|
|
443
468
|
'grideditor:offcanvas-orphan': OffcanvasOrphanPayload;
|
|
444
469
|
'grideditor:view-change': ViewChangePayload;
|
package/dist/grideditor.esm.js
CHANGED
|
@@ -238,7 +238,10 @@ function off(target, types, handler, options) {
|
|
|
238
238
|
var DEFAULT_DURATION = 400;
|
|
239
239
|
function animateAway(node, frames, duration, done) {
|
|
240
240
|
duration = duration === void 0 ? DEFAULT_DURATION : duration;
|
|
241
|
+
addClass(node, "ge-leaving");
|
|
241
242
|
var finish = function() {
|
|
243
|
+
removeClass(node, "ge-leaving");
|
|
244
|
+
dropEmptyClass(node);
|
|
242
245
|
hide(node);
|
|
243
246
|
if (done) {
|
|
244
247
|
done();
|
|
@@ -695,6 +698,8 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
695
698
|
}
|
|
696
699
|
}
|
|
697
700
|
var detailsFor = /* @__PURE__ */ new WeakMap();
|
|
701
|
+
var toolActions = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
var pendingDelete = null;
|
|
698
703
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
699
704
|
var resizes = /* @__PURE__ */ new WeakMap();
|
|
700
705
|
var sectionNodes = /* @__PURE__ */ new WeakMap();
|
|
@@ -918,12 +923,17 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
918
923
|
});
|
|
919
924
|
}
|
|
920
925
|
function deleteNode(kind, node, message, animate) {
|
|
926
|
+
var asked = pendingDelete || {};
|
|
927
|
+
pendingDelete = null;
|
|
921
928
|
operate(function() {
|
|
922
|
-
var payload = payloadFor(kind, node, { source: "tool" });
|
|
929
|
+
var payload = payloadFor(kind, node, { source: asked.source || "tool" });
|
|
923
930
|
if (!emit("before-delete", payload)) {
|
|
924
931
|
return;
|
|
925
932
|
}
|
|
926
|
-
|
|
933
|
+
if (asked.before) {
|
|
934
|
+
asked.before();
|
|
935
|
+
}
|
|
936
|
+
var remove = function() {
|
|
927
937
|
operate(function() {
|
|
928
938
|
animate(function() {
|
|
929
939
|
node.remove();
|
|
@@ -933,9 +943,40 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
933
943
|
});
|
|
934
944
|
});
|
|
935
945
|
});
|
|
936
|
-
}
|
|
946
|
+
};
|
|
947
|
+
if (asked.confirm === false) {
|
|
948
|
+
remove();
|
|
949
|
+
} else {
|
|
950
|
+
askToDelete(message, remove);
|
|
951
|
+
}
|
|
937
952
|
});
|
|
938
953
|
}
|
|
954
|
+
function removeNode(node, options) {
|
|
955
|
+
options = options || {};
|
|
956
|
+
var drawer = node ? drawerOf(node) : null;
|
|
957
|
+
var tool = drawer ? child(drawer, '[class*="ge-delete-"]') : null;
|
|
958
|
+
var action = tool ? toolActions.get(tool) : null;
|
|
959
|
+
if (!action) {
|
|
960
|
+
return false;
|
|
961
|
+
}
|
|
962
|
+
var went = false;
|
|
963
|
+
pendingDelete = {
|
|
964
|
+
source: options.source,
|
|
965
|
+
confirm: options.confirm,
|
|
966
|
+
before: function() {
|
|
967
|
+
went = true;
|
|
968
|
+
if (options.before) {
|
|
969
|
+
options.before();
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
try {
|
|
974
|
+
action.call(tool);
|
|
975
|
+
} finally {
|
|
976
|
+
pendingDelete = null;
|
|
977
|
+
}
|
|
978
|
+
return went;
|
|
979
|
+
}
|
|
939
980
|
function planSize(col, size, view) {
|
|
940
981
|
view = view || curView;
|
|
941
982
|
if (view !== ALL_VIEW) {
|
|
@@ -1507,17 +1548,26 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1507
1548
|
var homes = shownAddButtons();
|
|
1508
1549
|
homes.forEach(function(entry) {
|
|
1509
1550
|
entry.home.appendChild(entry.button);
|
|
1551
|
+
removeClass(entry.button, "ge-before-more");
|
|
1510
1552
|
});
|
|
1511
1553
|
removeClass(more, "ge-needed");
|
|
1554
|
+
removeClass(wrapper, "ge-toolbar-overflowing");
|
|
1512
1555
|
if (start.scrollWidth <= start.clientWidth) {
|
|
1513
1556
|
openOverflow(false);
|
|
1514
1557
|
return;
|
|
1515
1558
|
}
|
|
1516
1559
|
addClass(more, "ge-needed");
|
|
1560
|
+
addClass(wrapper, "ge-toolbar-overflowing");
|
|
1517
1561
|
for (var i = homes.length - 1; i >= 0 && start.scrollWidth > start.clientWidth; i--) {
|
|
1518
1562
|
var into = spareOf(homes[i].home);
|
|
1519
1563
|
into.insertBefore(homes[i].button, into.firstChild);
|
|
1520
1564
|
}
|
|
1565
|
+
var onLine = homes.filter(function(entry) {
|
|
1566
|
+
return entry.button.parentNode === entry.home;
|
|
1567
|
+
});
|
|
1568
|
+
if (onLine.length) {
|
|
1569
|
+
addClass(onLine[onLine.length - 1].button, "ge-before-more");
|
|
1570
|
+
}
|
|
1521
1571
|
}
|
|
1522
1572
|
}
|
|
1523
1573
|
function labelButton(button, label, iconClass) {
|
|
@@ -2214,8 +2264,8 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2214
2264
|
}
|
|
2215
2265
|
var copy = copyCanvas();
|
|
2216
2266
|
var root = copy.root;
|
|
2217
|
-
[root].concat(all(root, ".ge-selected, .ge-settings-target")).forEach(function(node) {
|
|
2218
|
-
removeClass(node, "ge-selected ge-settings-target");
|
|
2267
|
+
[root].concat(all(root, ".ge-selected, .ge-settings-target, .ge-leaving")).forEach(function(node) {
|
|
2268
|
+
removeClass(node, "ge-selected ge-settings-target ge-leaving");
|
|
2219
2269
|
dropEmptyClass(node);
|
|
2220
2270
|
});
|
|
2221
2271
|
all(root, ".ge-drop-marker").forEach(function(marker) {
|
|
@@ -2442,13 +2492,16 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2442
2492
|
// True when it took: a node that cannot be, or no setting
|
|
2443
2493
|
// for it, says nothing, since a plugin putting back what it
|
|
2444
2494
|
// remembers cannot know the node is still one
|
|
2495
|
+
// null takes it away
|
|
2445
2496
|
setActiveTarget: function(node) {
|
|
2446
|
-
var chosen = !!settings.active_target && isTarget(node);
|
|
2497
|
+
var chosen = !!settings.active_target && (node === null || isTarget(node));
|
|
2447
2498
|
if (chosen) {
|
|
2448
2499
|
changeTarget(node);
|
|
2449
2500
|
}
|
|
2450
2501
|
return chosen;
|
|
2451
2502
|
},
|
|
2503
|
+
// A node removed as its delete tool does, as asked
|
|
2504
|
+
removeNode,
|
|
2452
2505
|
// What keeps Escape from the target, and an
|
|
2453
2506
|
// inline panel unfolded in a drawer, which Escape leaves alone
|
|
2454
2507
|
panelOpen: function() {
|
|
@@ -3499,11 +3552,15 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3499
3552
|
drawer.appendChild(tool);
|
|
3500
3553
|
if (typeof eventHandlers == "function") {
|
|
3501
3554
|
tool.addEventListener("click", eventHandlers);
|
|
3555
|
+
toolActions.set(tool, eventHandlers);
|
|
3502
3556
|
}
|
|
3503
3557
|
if (eventHandlers && typeof eventHandlers == "object") {
|
|
3504
3558
|
Object.keys(eventHandlers).forEach(function(name) {
|
|
3505
3559
|
on(tool, name, eventHandlers[name]);
|
|
3506
3560
|
});
|
|
3561
|
+
if (typeof eventHandlers.click == "function") {
|
|
3562
|
+
toolActions.set(tool, eventHandlers.click);
|
|
3563
|
+
}
|
|
3507
3564
|
}
|
|
3508
3565
|
return tool;
|
|
3509
3566
|
}
|
|
@@ -5213,7 +5270,7 @@ GridEditor.t = translate;
|
|
|
5213
5270
|
GridEditor._plainHtml = plainHtml;
|
|
5214
5271
|
GridEditor.Sortable = null;
|
|
5215
5272
|
GridEditor.bootstrap = null;
|
|
5216
|
-
GridEditor.version = false ? "dev" : "9.0.0-beta.
|
|
5273
|
+
GridEditor.version = false ? "dev" : "9.0.0-beta.8";
|
|
5217
5274
|
GridEditor.locales = {
|
|
5218
5275
|
en: {
|
|
5219
5276
|
"tool.move": "Move",
|
package/dist/grideditor.js
CHANGED
|
@@ -239,7 +239,10 @@
|
|
|
239
239
|
var DEFAULT_DURATION = 400;
|
|
240
240
|
function animateAway(node, frames, duration, done) {
|
|
241
241
|
duration = duration === void 0 ? DEFAULT_DURATION : duration;
|
|
242
|
+
addClass(node, "ge-leaving");
|
|
242
243
|
var finish = function() {
|
|
244
|
+
removeClass(node, "ge-leaving");
|
|
245
|
+
dropEmptyClass(node);
|
|
243
246
|
hide(node);
|
|
244
247
|
if (done) {
|
|
245
248
|
done();
|
|
@@ -696,6 +699,8 @@
|
|
|
696
699
|
}
|
|
697
700
|
}
|
|
698
701
|
var detailsFor = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
var toolActions = /* @__PURE__ */ new WeakMap();
|
|
703
|
+
var pendingDelete = null;
|
|
699
704
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
700
705
|
var resizes = /* @__PURE__ */ new WeakMap();
|
|
701
706
|
var sectionNodes = /* @__PURE__ */ new WeakMap();
|
|
@@ -919,12 +924,17 @@
|
|
|
919
924
|
});
|
|
920
925
|
}
|
|
921
926
|
function deleteNode(kind, node, message, animate) {
|
|
927
|
+
var asked = pendingDelete || {};
|
|
928
|
+
pendingDelete = null;
|
|
922
929
|
operate(function() {
|
|
923
|
-
var payload = payloadFor(kind, node, { source: "tool" });
|
|
930
|
+
var payload = payloadFor(kind, node, { source: asked.source || "tool" });
|
|
924
931
|
if (!emit("before-delete", payload)) {
|
|
925
932
|
return;
|
|
926
933
|
}
|
|
927
|
-
|
|
934
|
+
if (asked.before) {
|
|
935
|
+
asked.before();
|
|
936
|
+
}
|
|
937
|
+
var remove = function() {
|
|
928
938
|
operate(function() {
|
|
929
939
|
animate(function() {
|
|
930
940
|
node.remove();
|
|
@@ -934,9 +944,40 @@
|
|
|
934
944
|
});
|
|
935
945
|
});
|
|
936
946
|
});
|
|
937
|
-
}
|
|
947
|
+
};
|
|
948
|
+
if (asked.confirm === false) {
|
|
949
|
+
remove();
|
|
950
|
+
} else {
|
|
951
|
+
askToDelete(message, remove);
|
|
952
|
+
}
|
|
938
953
|
});
|
|
939
954
|
}
|
|
955
|
+
function removeNode(node, options) {
|
|
956
|
+
options = options || {};
|
|
957
|
+
var drawer = node ? drawerOf(node) : null;
|
|
958
|
+
var tool = drawer ? child(drawer, '[class*="ge-delete-"]') : null;
|
|
959
|
+
var action = tool ? toolActions.get(tool) : null;
|
|
960
|
+
if (!action) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
var went = false;
|
|
964
|
+
pendingDelete = {
|
|
965
|
+
source: options.source,
|
|
966
|
+
confirm: options.confirm,
|
|
967
|
+
before: function() {
|
|
968
|
+
went = true;
|
|
969
|
+
if (options.before) {
|
|
970
|
+
options.before();
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
try {
|
|
975
|
+
action.call(tool);
|
|
976
|
+
} finally {
|
|
977
|
+
pendingDelete = null;
|
|
978
|
+
}
|
|
979
|
+
return went;
|
|
980
|
+
}
|
|
940
981
|
function planSize(col, size, view) {
|
|
941
982
|
view = view || curView;
|
|
942
983
|
if (view !== ALL_VIEW) {
|
|
@@ -1508,17 +1549,26 @@
|
|
|
1508
1549
|
var homes = shownAddButtons();
|
|
1509
1550
|
homes.forEach(function(entry) {
|
|
1510
1551
|
entry.home.appendChild(entry.button);
|
|
1552
|
+
removeClass(entry.button, "ge-before-more");
|
|
1511
1553
|
});
|
|
1512
1554
|
removeClass(more, "ge-needed");
|
|
1555
|
+
removeClass(wrapper, "ge-toolbar-overflowing");
|
|
1513
1556
|
if (start.scrollWidth <= start.clientWidth) {
|
|
1514
1557
|
openOverflow(false);
|
|
1515
1558
|
return;
|
|
1516
1559
|
}
|
|
1517
1560
|
addClass(more, "ge-needed");
|
|
1561
|
+
addClass(wrapper, "ge-toolbar-overflowing");
|
|
1518
1562
|
for (var i = homes.length - 1; i >= 0 && start.scrollWidth > start.clientWidth; i--) {
|
|
1519
1563
|
var into = spareOf(homes[i].home);
|
|
1520
1564
|
into.insertBefore(homes[i].button, into.firstChild);
|
|
1521
1565
|
}
|
|
1566
|
+
var onLine = homes.filter(function(entry) {
|
|
1567
|
+
return entry.button.parentNode === entry.home;
|
|
1568
|
+
});
|
|
1569
|
+
if (onLine.length) {
|
|
1570
|
+
addClass(onLine[onLine.length - 1].button, "ge-before-more");
|
|
1571
|
+
}
|
|
1522
1572
|
}
|
|
1523
1573
|
}
|
|
1524
1574
|
function labelButton(button, label, iconClass) {
|
|
@@ -2215,8 +2265,8 @@
|
|
|
2215
2265
|
}
|
|
2216
2266
|
var copy = copyCanvas();
|
|
2217
2267
|
var root = copy.root;
|
|
2218
|
-
[root].concat(all(root, ".ge-selected, .ge-settings-target")).forEach(function(node) {
|
|
2219
|
-
removeClass(node, "ge-selected ge-settings-target");
|
|
2268
|
+
[root].concat(all(root, ".ge-selected, .ge-settings-target, .ge-leaving")).forEach(function(node) {
|
|
2269
|
+
removeClass(node, "ge-selected ge-settings-target ge-leaving");
|
|
2220
2270
|
dropEmptyClass(node);
|
|
2221
2271
|
});
|
|
2222
2272
|
all(root, ".ge-drop-marker").forEach(function(marker) {
|
|
@@ -2443,13 +2493,16 @@
|
|
|
2443
2493
|
// True when it took: a node that cannot be, or no setting
|
|
2444
2494
|
// for it, says nothing, since a plugin putting back what it
|
|
2445
2495
|
// remembers cannot know the node is still one
|
|
2496
|
+
// null takes it away
|
|
2446
2497
|
setActiveTarget: function(node) {
|
|
2447
|
-
var chosen = !!settings.active_target && isTarget(node);
|
|
2498
|
+
var chosen = !!settings.active_target && (node === null || isTarget(node));
|
|
2448
2499
|
if (chosen) {
|
|
2449
2500
|
changeTarget(node);
|
|
2450
2501
|
}
|
|
2451
2502
|
return chosen;
|
|
2452
2503
|
},
|
|
2504
|
+
// A node removed as its delete tool does, as asked
|
|
2505
|
+
removeNode,
|
|
2453
2506
|
// What keeps Escape from the target, and an
|
|
2454
2507
|
// inline panel unfolded in a drawer, which Escape leaves alone
|
|
2455
2508
|
panelOpen: function() {
|
|
@@ -3500,11 +3553,15 @@
|
|
|
3500
3553
|
drawer.appendChild(tool);
|
|
3501
3554
|
if (typeof eventHandlers == "function") {
|
|
3502
3555
|
tool.addEventListener("click", eventHandlers);
|
|
3556
|
+
toolActions.set(tool, eventHandlers);
|
|
3503
3557
|
}
|
|
3504
3558
|
if (eventHandlers && typeof eventHandlers == "object") {
|
|
3505
3559
|
Object.keys(eventHandlers).forEach(function(name) {
|
|
3506
3560
|
on(tool, name, eventHandlers[name]);
|
|
3507
3561
|
});
|
|
3562
|
+
if (typeof eventHandlers.click == "function") {
|
|
3563
|
+
toolActions.set(tool, eventHandlers.click);
|
|
3564
|
+
}
|
|
3508
3565
|
}
|
|
3509
3566
|
return tool;
|
|
3510
3567
|
}
|
|
@@ -5214,7 +5271,7 @@
|
|
|
5214
5271
|
GridEditor._plainHtml = plainHtml;
|
|
5215
5272
|
GridEditor.Sortable = null;
|
|
5216
5273
|
GridEditor.bootstrap = null;
|
|
5217
|
-
GridEditor.version = false ? "dev" : "9.0.0-beta.
|
|
5274
|
+
GridEditor.version = false ? "dev" : "9.0.0-beta.8";
|
|
5218
5275
|
GridEditor.locales = {
|
|
5219
5276
|
en: {
|
|
5220
5277
|
"tool.move": "Move",
|