@themarioga/grid-editor 8.4.0 → 8.6.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +105 -5
  3. package/dist/grideditor.bundle.min.js +3 -3
  4. package/dist/grideditor.css +15 -4
  5. package/dist/grideditor.d.ts +76 -4
  6. package/dist/grideditor.esm.js +212 -38
  7. package/dist/grideditor.js +212 -38
  8. package/dist/grideditor.min.css +1 -1
  9. package/dist/grideditor.min.css.map +1 -1
  10. package/dist/grideditor.min.js +2 -2
  11. package/dist/grideditor.min.js.map +3 -3
  12. package/dist/locales/grideditor.es.esm.js +5 -0
  13. package/dist/locales/grideditor.es.js +5 -0
  14. package/dist/locales/grideditor.es.min.js +1 -1
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.accordion.esm.js +7 -0
  17. package/dist/plugins/grideditor.accordion.js +7 -0
  18. package/dist/plugins/grideditor.accordion.min.js +1 -1
  19. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  20. package/dist/plugins/grideditor.autosave.esm.js +309 -0
  21. package/dist/plugins/grideditor.autosave.js +316 -0
  22. package/dist/plugins/grideditor.autosave.min.js +1 -0
  23. package/dist/plugins/grideditor.autosave.min.js.map +7 -0
  24. package/dist/plugins/grideditor.card.esm.js +10 -0
  25. package/dist/plugins/grideditor.card.js +10 -0
  26. package/dist/plugins/grideditor.card.min.js +1 -1
  27. package/dist/plugins/grideditor.card.min.js.map +3 -3
  28. package/dist/plugins/grideditor.ckeditor.esm.js +30 -1
  29. package/dist/plugins/grideditor.ckeditor.js +30 -1
  30. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  31. package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
  32. package/dist/plugins/grideditor.clipboard.esm.js +3 -0
  33. package/dist/plugins/grideditor.clipboard.js +3 -0
  34. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  35. package/dist/plugins/grideditor.clipboard.min.js.map +2 -2
  36. package/dist/plugins/grideditor.codemirror-inline.esm.js +11 -0
  37. package/dist/plugins/grideditor.codemirror-inline.js +11 -0
  38. package/dist/plugins/grideditor.codemirror-inline.min.js +1 -1
  39. package/dist/plugins/grideditor.codemirror-inline.min.js.map +3 -3
  40. package/dist/plugins/grideditor.elements.esm.js +78 -4
  41. package/dist/plugins/grideditor.elements.js +78 -4
  42. package/dist/plugins/grideditor.elements.min.js +1 -1
  43. package/dist/plugins/grideditor.elements.min.js.map +3 -3
  44. package/dist/plugins/grideditor.gutters.esm.js +5 -0
  45. package/dist/plugins/grideditor.gutters.js +5 -0
  46. package/dist/plugins/grideditor.gutters.min.js +1 -1
  47. package/dist/plugins/grideditor.gutters.min.js.map +3 -3
  48. package/dist/plugins/grideditor.inline-style.esm.js +18 -10
  49. package/dist/plugins/grideditor.inline-style.js +18 -10
  50. package/dist/plugins/grideditor.inline-style.min.js +3 -3
  51. package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
  52. package/dist/plugins/grideditor.order.esm.js +5 -0
  53. package/dist/plugins/grideditor.order.js +5 -0
  54. package/dist/plugins/grideditor.order.min.js +1 -1
  55. package/dist/plugins/grideditor.order.min.js.map +3 -3
  56. package/dist/plugins/grideditor.popup.esm.js +17 -6
  57. package/dist/plugins/grideditor.popup.js +17 -6
  58. package/dist/plugins/grideditor.popup.min.js +1 -1
  59. package/dist/plugins/grideditor.popup.min.js.map +3 -3
  60. package/dist/plugins/grideditor.sections.esm.js +6 -3
  61. package/dist/plugins/grideditor.sections.js +6 -3
  62. package/dist/plugins/grideditor.sections.min.js +1 -1
  63. package/dist/plugins/grideditor.sections.min.js.map +3 -3
  64. package/dist/plugins/grideditor.summernote.esm.js +40 -1
  65. package/dist/plugins/grideditor.summernote.js +40 -1
  66. package/dist/plugins/grideditor.summernote.min.js +1 -1
  67. package/dist/plugins/grideditor.summernote.min.js.map +3 -3
  68. package/dist/plugins/grideditor.tabs.esm.js +7 -0
  69. package/dist/plugins/grideditor.tabs.js +7 -0
  70. package/dist/plugins/grideditor.tabs.min.js +1 -1
  71. package/dist/plugins/grideditor.tabs.min.js.map +3 -3
  72. package/dist/plugins/grideditor.tinymce.esm.js +32 -1
  73. package/dist/plugins/grideditor.tinymce.js +32 -1
  74. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  75. package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
  76. package/docs/events.md +8 -0
  77. package/docs/locale-keys.md +16 -1
  78. package/docs/plugins.md +60 -7
  79. package/example/autosave.html +39 -22
  80. package/example/index.html +1 -1
  81. package/example/plugins.html +10 -0
  82. package/package.json +1 -2
  83. package/src/js/grideditor.js +248 -28
  84. package/src/js/inline-style/display.js +4 -3
  85. package/src/js/inline-style/drawerflow.js +10 -5
  86. package/src/js/locales/grideditor.es.js +5 -0
  87. package/src/js/plugins/grideditor.accordion.js +6 -0
  88. package/src/js/plugins/grideditor.autosave.js +349 -0
  89. package/src/js/plugins/grideditor.card.js +6 -0
  90. package/src/js/plugins/grideditor.ckeditor.js +6 -0
  91. package/src/js/plugins/grideditor.clipboard.js +3 -0
  92. package/src/js/plugins/grideditor.codemirror-inline.js +7 -0
  93. package/src/js/plugins/grideditor.elements.js +98 -4
  94. package/src/js/plugins/grideditor.gutters.js +4 -0
  95. package/src/js/plugins/grideditor.inline-style.js +2 -0
  96. package/src/js/plugins/grideditor.order.js +4 -0
  97. package/src/js/plugins/grideditor.popup.js +15 -6
  98. package/src/js/plugins/grideditor.sections.js +4 -3
  99. package/src/js/plugins/grideditor.summernote.js +14 -0
  100. package/src/js/plugins/grideditor.tabs.js +6 -0
  101. package/src/js/plugins/grideditor.tinymce.js +8 -0
  102. package/src/js/text/grideditor.text.js +27 -1
  103. package/src/less/grideditor.less +16 -8
  104. package/types/grideditor.d.ts +76 -4
  105. package/AUTO_SAVE.md +0 -30
@@ -393,8 +393,10 @@
393
393
  // 'auto' turns them on when the page has any
394
394
  selector: "[data-ge-element]",
395
395
  // What the host marks an element with
396
- auto: false
396
+ auto: false,
397
397
  // Treat every child of a content area as an element
398
+ types: []
399
+ // The elements the toolbar offers: { type, html, label | labelKey, iconClass, group }
398
400
  },
399
401
  resize: {
400
402
  enabled: true,
@@ -761,31 +763,53 @@
761
763
  whenConfirmed();
762
764
  return;
763
765
  }
764
- var Modal = modalLibrary();
765
- if (!Modal) {
766
- if (window.confirm(message)) {
766
+ confirmWith(message, { danger: true }, function(confirmed) {
767
+ if (confirmed) {
767
768
  whenConfirmed();
768
769
  }
770
+ });
771
+ }
772
+ function confirmWith(message, options, answer) {
773
+ options = options || {};
774
+ var Modal = modalLibrary();
775
+ if (!Modal) {
776
+ answer(window.confirm(message));
769
777
  return;
770
778
  }
771
779
  var modal = confirmModal();
772
780
  var confirmed = false;
781
+ var ok = one(modal, ".ge-confirm-ok");
782
+ if (pendingAnswer) {
783
+ pendingAnswer(null);
784
+ }
785
+ var settle = function(value) {
786
+ if (pendingAnswer !== settle) {
787
+ return;
788
+ }
789
+ pendingAnswer = null;
790
+ answer(value);
791
+ };
792
+ pendingAnswer = settle;
793
+ one(modal, ".modal-title").textContent = options.title || t("confirm.title");
794
+ one(modal, ".ge-confirm-cancel").textContent = options.cancel || t("confirm.cancel");
795
+ ok.textContent = options.ok || t("confirm.ok");
796
+ toggleClass(ok, "btn-danger", !!options.danger);
797
+ toggleClass(ok, "btn-primary", !options.danger);
773
798
  one(modal, ".ge-confirm-message").textContent = message;
774
- one(modal, ".ge-confirm-ok").onclick = function() {
799
+ ok.onclick = function() {
775
800
  confirmed = true;
776
801
  Modal.getInstance(modal).hide();
777
802
  };
778
803
  confirmHandlers.hidden = function() {
779
- if (confirmed) {
780
- whenConfirmed();
781
- }
804
+ settle(confirmed);
782
805
  };
783
806
  confirmHandlers.shown = function() {
784
- one(modal, ".ge-confirm-ok").focus();
807
+ ok.focus();
785
808
  };
786
809
  Modal.getOrCreateInstance(modal).show();
787
810
  }
788
811
  var confirmHandlers = { hidden: null, shown: null };
812
+ var pendingAnswer = null;
789
813
  function confirmModal() {
790
814
  if (confirmDialog) {
791
815
  return confirmDialog;
@@ -799,13 +823,14 @@
799
823
  one(confirmDialog, ".ge-confirm-cancel").textContent = t("confirm.cancel");
800
824
  one(confirmDialog, ".ge-confirm-ok").textContent = t("confirm.ok");
801
825
  trackModal(confirmDialog);
826
+ var asking = confirmDialog;
802
827
  confirmDialog.addEventListener("hidden.bs.modal", function() {
803
- if (confirmHandlers.hidden) {
828
+ if (asking === confirmDialog && confirmHandlers.hidden) {
804
829
  confirmHandlers.hidden();
805
830
  }
806
831
  });
807
832
  confirmDialog.addEventListener("shown.bs.modal", function() {
808
- if (confirmHandlers.shown) {
833
+ if (asking === confirmDialog && confirmHandlers.shown) {
809
834
  confirmHandlers.shown();
810
835
  }
811
836
  });
@@ -819,6 +844,9 @@
819
844
  confirmHandlers.shown = null;
820
845
  retireModal(confirmDialog);
821
846
  confirmDialog = null;
847
+ if (pendingAnswer) {
848
+ pendingAnswer(null);
849
+ }
822
850
  }
823
851
  function retireModal(panel) {
824
852
  var Modal = modalLibrary();
@@ -1113,7 +1141,7 @@
1113
1141
  settings.new_row_layouts.forEach(function(layout) {
1114
1142
  var grouped = !Array.isArray(layout);
1115
1143
  var btn = element("a", {
1116
- "class": "btn btn-sm btn-primary",
1144
+ "class": "btn btn-sm btn-light",
1117
1145
  title: grouped ? t("row.add_row_cols", { columns: layout.columns, counts: rowColsText(layout.row_cols) }) : t("row.add", { layout: layout.join("-") }),
1118
1146
  // What this button makes, in the markup rather than in
1119
1147
  // memory: a drag works on a clone of it
@@ -1148,7 +1176,7 @@
1148
1176
  Object.keys(CONTAINERS).forEach(function(type) {
1149
1177
  var definition = CONTAINERS[type];
1150
1178
  var button = labelButton(
1151
- element("a", { "class": "btn btn-sm btn-primary ge-add-container" }),
1179
+ element("a", { "class": "btn btn-sm btn-light ge-add-container" }),
1152
1180
  t(definition.labelKey),
1153
1181
  definition.iconClass
1154
1182
  );
@@ -1240,7 +1268,8 @@
1240
1268
  }
1241
1269
  var CORE_GROUPS = [
1242
1270
  { name: "rows", labelKey: "group.rows" },
1243
- { name: "content", labelKey: "group.content" }
1271
+ { name: "content", labelKey: "group.content" },
1272
+ { name: "elements", labelKey: "group.elements" }
1244
1273
  ];
1245
1274
  function toolbarGroupOf(value) {
1246
1275
  return typeof value === "string" && value.trim() !== "" ? value : null;
@@ -1268,7 +1297,7 @@
1268
1297
  names.forEach(function(name) {
1269
1298
  var tab = tabs.appendChild(element("button", {
1270
1299
  type: "button",
1271
- "class": "btn btn-sm btn-outline-primary",
1300
+ "class": "btn btn-sm btn-outline-secondary",
1272
1301
  role: "tab",
1273
1302
  "data-ge-group": name
1274
1303
  }, groupLabel(name)));
@@ -1317,7 +1346,7 @@
1317
1346
  mainControls.remove();
1318
1347
  }
1319
1348
  function createOverflowMenu(start) {
1320
- var more = create('<div class="ge-toolbar-more"><button type="button" class="btn btn-sm btn-primary"><i class="bi bi-three-dots"></i></button><div class="ge-toolbar-overflow"><div class="ge-addRowGroup btn-group"></div><div class="ge-addContainerGroup btn-group"></div></div></div>');
1349
+ var more = create('<div class="ge-toolbar-more"><button type="button" class="btn btn-sm btn-light"><i class="bi bi-three-dots"></i></button><div class="ge-toolbar-overflow"><div class="ge-addRowGroup btn-group"></div><div class="ge-addContainerGroup btn-group"></div></div></div>');
1321
1350
  start.parentNode.insertBefore(more, start.nextSibling);
1322
1351
  var toggle2 = one(more, "button");
1323
1352
  var panel = one(more, ".ge-toolbar-overflow");
@@ -1408,7 +1437,8 @@
1408
1437
  function featureButton(name, item, index) {
1409
1438
  var iconClass = item.iconClass || (item.align === "end" ? "bi bi-plus" : null);
1410
1439
  var label = typeof item.label === "function" ? item.label() : item.label || t(item.labelKey);
1411
- var button = labelButton(element("a", { "class": "btn btn-sm btn-primary ge-add-container ge-add-feature" }), label, iconClass);
1440
+ var colour = item.align === "end" ? "btn-primary" : "btn-light";
1441
+ var button = labelButton(element("a", { "class": "btn btn-sm " + colour + " ge-add-container ge-add-feature" }), label, iconClass);
1412
1442
  addClass(button, item.className || "");
1413
1443
  attr(button, {
1414
1444
  "data-ge-toolbar": "feature",
@@ -1421,6 +1451,9 @@
1421
1451
  return;
1422
1452
  }
1423
1453
  var made = item.create();
1454
+ if (!made) {
1455
+ return;
1456
+ }
1424
1457
  var placed = item.inColumn ? inRowOfItsOwn(made) : made;
1425
1458
  var added = addNode(item.kind, made, function() {
1426
1459
  canvas.appendChild(placed);
@@ -1529,6 +1562,9 @@
1529
1562
  function insertFeatureFromToolbar(button, where, source) {
1530
1563
  var item = FEATURES[button.getAttribute("data-ge-feature")].toolbar[parseInt(button.getAttribute("data-ge-item"), 10)];
1531
1564
  var made = item.create();
1565
+ if (!made) {
1566
+ return null;
1567
+ }
1532
1568
  var placed = made;
1533
1569
  if (item.inColumn) {
1534
1570
  if (!is(where.region, ".column")) {
@@ -1910,22 +1946,122 @@
1910
1946
  closeSizePicker();
1911
1947
  hideDropMarker();
1912
1948
  closeDialog();
1913
- all(canvas, ".ge-tools-drawer").forEach(function(drawer) {
1914
- drawer.remove();
1915
- });
1949
+ removeDrawers(canvas);
1916
1950
  pluginFields.clear();
1917
- unwrapTexts();
1951
+ unwrapTexts(canvas);
1918
1952
  plugins("onDeinit");
1919
1953
  clearPreviews(canvas);
1920
- all(canvas, "[data-ge-row-cols]").forEach(function(row) {
1921
- row.removeAttribute("data-ge-row-cols");
1922
- });
1954
+ clearRowCols(canvas);
1923
1955
  unmarkContainers();
1924
1956
  removeSortable();
1925
1957
  removeResizable();
1926
- runFilter(false);
1958
+ runFilter(false, canvas);
1959
+ }
1960
+ function removeDrawers(root) {
1961
+ all(root, ".ge-tools-drawer").forEach(function(drawer) {
1962
+ drawer.remove();
1963
+ });
1964
+ }
1965
+ function clearRowCols(root) {
1966
+ all(root, "[data-ge-row-cols]").forEach(function(row) {
1967
+ row.removeAttribute("data-ge-row-cols");
1968
+ });
1969
+ }
1970
+ function pluginsWithoutCleanMarkup() {
1971
+ var names = [];
1972
+ [CONTAINERS, FEATURES, UTILITIES].forEach(function(registry) {
1973
+ Object.keys(registry).forEach(function(name) {
1974
+ var plugin = registry[name];
1975
+ var marks = plugin.unmark || plugin.onDeinit || plugin.onBeforeDeinit;
1976
+ if (marks && !plugin.cleanMarkup) {
1977
+ names.push(name);
1978
+ }
1979
+ });
1980
+ });
1981
+ return names;
1982
+ }
1983
+ function copyCanvas() {
1984
+ var copy = canvas.cloneNode(true);
1985
+ var toLive = /* @__PURE__ */ new Map();
1986
+ var toCopy = /* @__PURE__ */ new Map();
1987
+ var live = document.createTreeWalker(canvas, NodeFilter.SHOW_ELEMENT);
1988
+ var copied = document.createTreeWalker(copy, NodeFilter.SHOW_ELEMENT);
1989
+ var a = live.currentNode;
1990
+ var b = copied.currentNode;
1991
+ while (a && b) {
1992
+ toLive.set(b, a);
1993
+ toCopy.set(a, b);
1994
+ a = live.nextNode();
1995
+ b = copied.nextNode();
1996
+ }
1997
+ return {
1998
+ root: copy,
1999
+ liveOf: function(node) {
2000
+ return toLive.get(node) || null;
2001
+ },
2002
+ copyOf: function(node) {
2003
+ return toCopy.get(node) || null;
2004
+ }
2005
+ };
1927
2006
  }
1928
- function getHtml() {
2007
+ function snapshotHtml() {
2008
+ if (sourceOpen) {
2009
+ return getHtml();
2010
+ }
2011
+ var missing = pluginsWithoutCleanMarkup();
2012
+ if (missing.length) {
2013
+ missing.forEach(function(name) {
2014
+ warnOnceHere("snapshot:" + name, 'the "' + name + '" plugin has no cleanMarkup, so the canvas leaves editing to be read: open texts and settings panels close');
2015
+ });
2016
+ return getHtml();
2017
+ }
2018
+ var copy = copyCanvas();
2019
+ var root = copy.root;
2020
+ [root].concat(all(root, ".ge-active-target, .ge-settings-target")).forEach(function(node) {
2021
+ removeClass(node, "ge-active-target ge-settings-target");
2022
+ dropEmptyClass(node);
2023
+ });
2024
+ all(root, ".ge-drop-marker").forEach(function(marker) {
2025
+ marker.remove();
2026
+ });
2027
+ removeDrawers(root);
2028
+ unwrapTexts(root);
2029
+ var refused = null;
2030
+ [CONTAINERS, FEATURES, UTILITIES].forEach(function(registry) {
2031
+ Object.keys(registry).forEach(function(name) {
2032
+ var plugin = registry[name];
2033
+ if (refused || !plugin.cleanMarkup) {
2034
+ return;
2035
+ }
2036
+ if (plugin.cleanMarkup(root, copy.liveOf) === false) {
2037
+ refused = name;
2038
+ }
2039
+ });
2040
+ });
2041
+ if (refused) {
2042
+ warnOnceHere("snapshot-refused:" + refused, 'the "' + refused + '" plugin cannot take its marking off a copy right now, so the canvas leaves editing to be read');
2043
+ return getHtml();
2044
+ }
2045
+ clearPreviews(root);
2046
+ clearRowCols(root);
2047
+ all(root, "[data-ge-container]").forEach(unmarkContainerClasses);
2048
+ sortables.forEach(function(sortableInstance) {
2049
+ var list = copy.copyOf(sortableInstance.el);
2050
+ if (list) {
2051
+ all(list, "[draggable]").forEach(function(node) {
2052
+ node.removeAttribute("draggable");
2053
+ });
2054
+ }
2055
+ });
2056
+ removeResizeFurniture(root);
2057
+ runFilter(false, root);
2058
+ stripPixelWidths(root);
2059
+ return root.innerHTML;
2060
+ }
2061
+ function getHtml(options) {
2062
+ if (options && options.keepEditing) {
2063
+ return snapshotHtml();
2064
+ }
1929
2065
  deinit();
1930
2066
  stripPixelWidths(canvas);
1931
2067
  var html = canvas.innerHTML;
@@ -1939,10 +2075,24 @@
1939
2075
  init();
1940
2076
  return html;
1941
2077
  }
1942
- function getPlainHtml() {
1943
- return plainHtml(getHtml());
2078
+ function getPlainHtml(options) {
2079
+ return plainHtml(getHtml(options));
2080
+ }
2081
+ function setHtml2(html) {
2082
+ if (sourceOpen) {
2083
+ closeSource();
2084
+ if (mainControls) {
2085
+ all(mainControls, ".gm-edit-mode").forEach(function(button) {
2086
+ removeClass(button, "active btn-danger");
2087
+ });
2088
+ }
2089
+ }
2090
+ deinit();
2091
+ setHtml(canvas, html);
2092
+ init();
1944
2093
  }
1945
2094
  function destroy() {
2095
+ plugins("onDestroy");
1946
2096
  if (sourceOpen) {
1947
2097
  closeSource();
1948
2098
  }
@@ -2055,6 +2205,11 @@
2055
2205
  closeDialog,
2056
2206
  rowFromLayout: rowFromLayoutValue,
2057
2207
  nodeHtml,
2208
+ // The markup as getHtml gives it, with the canvas left editing
2209
+ snapshotHtml,
2210
+ setHtml: setHtml2,
2211
+ // A question in the editor's confirm modal
2212
+ confirm: confirmWith,
2058
2213
  // A text editor has rewritten a content area, so whatever the
2059
2214
  // editor and its plugins had put in there goes back in
2060
2215
  textReady,
@@ -2577,10 +2732,13 @@
2577
2732
  if (definition) {
2578
2733
  definition.unmark(container);
2579
2734
  }
2580
- removeClass(container, "ge-container ge-container-" + containerTypeOf(container));
2581
- dropEmptyClass(container);
2735
+ unmarkContainerClasses(container);
2582
2736
  });
2583
2737
  }
2738
+ function unmarkContainerClasses(container) {
2739
+ removeClass(container, "ge-container ge-container-" + containerTypeOf(container));
2740
+ dropEmptyClass(container);
2741
+ }
2584
2742
  function prependDrawer(node, className) {
2585
2743
  var drawer = element("div", { "class": className });
2586
2744
  node.insertBefore(drawer, node.firstChild);
@@ -3981,13 +4139,16 @@
3981
4139
  on(handle, "pointerup pointercancel", onUp);
3982
4140
  }
3983
4141
  function removeResizable() {
3984
- all(canvas, ".ge-resize-handle").forEach(function(handle) {
4142
+ removeResizeFurniture(canvas);
4143
+ }
4144
+ function removeResizeFurniture(root) {
4145
+ all(root, ".ge-resize-handle").forEach(function(handle) {
3985
4146
  handle.remove();
3986
4147
  });
3987
- all(canvas, ".ge-resize-size").forEach(function(readout) {
4148
+ all(root, ".ge-resize-size").forEach(function(readout) {
3988
4149
  readout.remove();
3989
4150
  });
3990
- stripPixelWidths(canvas);
4151
+ stripPixelWidths(root);
3991
4152
  }
3992
4153
  function snapUnits(col, pixels) {
3993
4154
  var units = Math.round(pixels / rowContentWidth(col.parentElement) * MAX_COL_SIZE);
@@ -4195,7 +4356,7 @@
4195
4356
  setOffset(column, tier, wanted.offset);
4196
4357
  return column;
4197
4358
  }
4198
- function runFilter(isInit) {
4359
+ function runFilter(isInit, root) {
4199
4360
  if (!settings.custom_filter || !settings.custom_filter.length) {
4200
4361
  return;
4201
4362
  }
@@ -4204,7 +4365,7 @@
4204
4365
  if (typeof func == "string") {
4205
4366
  func = window[func];
4206
4367
  }
4207
- func(canvas, isInit);
4368
+ func(root || canvas, isInit);
4208
4369
  });
4209
4370
  }
4210
4371
  function textCutter() {
@@ -4324,8 +4485,8 @@
4324
4485
  }
4325
4486
  });
4326
4487
  }
4327
- function unwrapTexts() {
4328
- all(canvas, ".ge-text-block").forEach(function(textBlock) {
4488
+ function unwrapTexts(root) {
4489
+ all(root, ".ge-text-block").forEach(function(textBlock) {
4329
4490
  unwrap(textBlock);
4330
4491
  });
4331
4492
  }
@@ -4498,6 +4659,18 @@
4498
4659
  instances.set(canvas, instance);
4499
4660
  loadPlugins();
4500
4661
  instance.settings = settingsCopy();
4662
+ Object.keys(featureMethods).forEach(function(name) {
4663
+ if (Object.prototype.hasOwnProperty.call(own, name) || name in instance) {
4664
+ return;
4665
+ }
4666
+ instance[name] = function() {
4667
+ if (destroyed) {
4668
+ warnOnceHere("destroyed:" + name, t("warning.destroyed", { method: name }));
4669
+ return null;
4670
+ }
4671
+ return featureMethods[name].apply(null, arguments);
4672
+ };
4673
+ });
4501
4674
  setup();
4502
4675
  init();
4503
4676
  GridEditor._created.forEach(function(hook) {
@@ -4513,7 +4686,7 @@
4513
4686
  GridEditor._plainHtml = plainHtml;
4514
4687
  GridEditor.Sortable = null;
4515
4688
  GridEditor.bootstrap = null;
4516
- GridEditor.version = false ? "dev" : "8.4.0";
4689
+ GridEditor.version = false ? "dev" : "8.6.0";
4517
4690
  GridEditor.locales = {
4518
4691
  en: {
4519
4692
  "tool.move": "Move",
@@ -4541,6 +4714,7 @@
4541
4714
  "tool.more": "More",
4542
4715
  "group.rows": "Rows",
4543
4716
  "group.content": "Content",
4717
+ "group.elements": "Elements",
4544
4718
  "group.select": "Add",
4545
4719
  "panel.title": "{kind} settings",
4546
4720
  "panel.close": "Close",