@themarioga/grid-editor 7.2.0 → 8.0.0-beta.2

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 (97) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +96 -30
  3. package/UPGRADING.md +86 -0
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +149 -6
  6. package/dist/grideditor.d.ts +18 -0
  7. package/dist/grideditor.esm.js +257 -48
  8. package/dist/grideditor.jquery.js +0 -13
  9. package/dist/grideditor.jquery.min.js +1 -1
  10. package/dist/grideditor.jquery.min.js.map +3 -3
  11. package/dist/grideditor.js +257 -48
  12. package/dist/grideditor.min.css +1 -1
  13. package/dist/grideditor.min.css.map +1 -1
  14. package/dist/grideditor.min.js +2 -2
  15. package/dist/grideditor.min.js.map +3 -3
  16. package/dist/locales/grideditor.es.esm.js +80 -6
  17. package/dist/locales/grideditor.es.js +80 -6
  18. package/dist/locales/grideditor.es.min.js +1 -1
  19. package/dist/locales/grideditor.es.min.js.map +2 -2
  20. package/dist/plugins/grideditor.accordion.min.js.map +2 -2
  21. package/dist/plugins/grideditor.alignment.esm.js +11 -38
  22. package/dist/plugins/grideditor.alignment.js +11 -38
  23. package/dist/plugins/grideditor.alignment.min.js +1 -1
  24. package/dist/plugins/grideditor.alignment.min.js.map +3 -3
  25. package/dist/plugins/grideditor.card.min.js.map +1 -1
  26. package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
  27. package/dist/plugins/grideditor.ckeditor.js +0 -5
  28. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  29. package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
  30. package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
  31. package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
  32. package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
  33. package/dist/plugins/grideditor.elements.min.js.map +2 -2
  34. package/dist/plugins/grideditor.gutters.min.js.map +1 -1
  35. package/dist/plugins/grideditor.order.min.js.map +1 -1
  36. package/dist/plugins/grideditor.popup.min.js.map +1 -1
  37. package/dist/plugins/grideditor.sections.min.js.map +2 -2
  38. package/dist/plugins/grideditor.style.esm.js +1926 -0
  39. package/dist/plugins/grideditor.style.js +1923 -0
  40. package/dist/plugins/grideditor.style.min.js +4 -0
  41. package/dist/plugins/grideditor.style.min.js.map +7 -0
  42. package/dist/plugins/grideditor.summernote.min.js.map +2 -2
  43. package/dist/plugins/grideditor.tabs.min.js.map +2 -2
  44. package/dist/plugins/grideditor.tinymce.esm.js +1 -8
  45. package/dist/plugins/grideditor.tinymce.js +1 -8
  46. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  47. package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
  48. package/docs/events.md +4 -6
  49. package/docs/locale-keys.md +99 -15
  50. package/docs/plugins.md +47 -23
  51. package/example/ckeditor.html +0 -5
  52. package/example/index.html +17 -2
  53. package/example/style.html +163 -0
  54. package/example/utilities.html +21 -16
  55. package/package.json +1 -1
  56. package/src/js/dom.js +1 -2
  57. package/src/js/grideditor.jquery.js +7 -28
  58. package/src/js/grideditor.js +336 -67
  59. package/src/js/locales/grideditor.es.js +80 -6
  60. package/src/js/plugins/grideditor.alignment.js +21 -50
  61. package/src/js/plugins/grideditor.ckeditor.js +10 -23
  62. package/src/js/plugins/grideditor.style.js +185 -0
  63. package/src/js/plugins/grideditor.summernote.js +4 -5
  64. package/src/js/plugins/grideditor.tinymce.js +4 -17
  65. package/src/js/style/accordion.js +168 -0
  66. package/src/js/style/catalog.js +76 -0
  67. package/src/js/style/custom.js +84 -0
  68. package/src/js/style/display.js +229 -0
  69. package/src/js/style/drawerflow.js +118 -0
  70. package/src/js/style/fields.js +382 -0
  71. package/src/js/style/flex.js +156 -0
  72. package/src/js/{plugins/grideditor.float.js → style/float.js} +6 -16
  73. package/src/js/style/options.js +60 -0
  74. package/src/js/style/sections.js +298 -0
  75. package/src/js/{plugins/grideditor.spacing.js → style/spacing.js} +7 -19
  76. package/src/js/style/sticky.js +39 -0
  77. package/src/js/{plugins/grideditor.textalign.js → style/textalign.js} +6 -14
  78. package/src/js/text/grideditor.text.js +1 -1
  79. package/src/less/grideditor.less +151 -10
  80. package/types/grideditor.d.ts +18 -0
  81. package/dist/plugins/grideditor.float.esm.js +0 -34
  82. package/dist/plugins/grideditor.float.js +0 -41
  83. package/dist/plugins/grideditor.float.min.js +0 -1
  84. package/dist/plugins/grideditor.float.min.js.map +0 -7
  85. package/dist/plugins/grideditor.spacing.esm.js +0 -318
  86. package/dist/plugins/grideditor.spacing.js +0 -323
  87. package/dist/plugins/grideditor.spacing.min.js +0 -1
  88. package/dist/plugins/grideditor.spacing.min.js.map +0 -7
  89. package/dist/plugins/grideditor.textalign.esm.js +0 -40
  90. package/dist/plugins/grideditor.textalign.js +0 -47
  91. package/dist/plugins/grideditor.textalign.min.js +0 -1
  92. package/dist/plugins/grideditor.textalign.min.js.map +0 -7
  93. package/dist/plugins/grideditor.visibility.esm.js +0 -158
  94. package/dist/plugins/grideditor.visibility.js +0 -163
  95. package/dist/plugins/grideditor.visibility.min.js +0 -1
  96. package/dist/plugins/grideditor.visibility.min.js.map +0 -7
  97. package/src/js/plugins/grideditor.visibility.js +0 -171
@@ -341,7 +341,6 @@ var ALL_VIEW_LABEL_KEY = "view.all";
341
341
  var VIEW_KEYS = [ALL_VIEW].concat(BREAKPOINTS.map(function(tier) {
342
342
  return tier.key;
343
343
  }));
344
- var LEGACY_VIEW_INDEXES = ["lg", "sm", "xs"];
345
344
  var MAX_COL_SIZE = 12;
346
345
  var MAX_COL_OFFSET = 11;
347
346
  var FLEX_SIZES = ["equal", "auto"];
@@ -414,10 +413,6 @@ var NESTED_SETTINGS = {
414
413
  // Scroll the page when a drag reaches its edge
415
414
  }
416
415
  };
417
- var REMOVED_SETTINGS = {
418
- sortable_options: "drag",
419
- resizable_options: "resize"
420
- };
421
416
  var warned = {};
422
417
  var editorCounter = 0;
423
418
  var instances = /* @__PURE__ */ new WeakMap();
@@ -571,7 +566,7 @@ function build(instance, baseElem, optionsOrMethod) {
571
566
  "element_classes": [],
572
567
  // Preset class toggles on an element's settings panel
573
568
  // content_types, text_tools and text_classes are the text editor
574
- // plugins' settings since 6.0: see grideditor.text.js
569
+ // plugins' settings: see grideditor.text.js
575
570
  "container_classes": [],
576
571
  // The same, on a container's panel
577
572
  "pane_classes": [],
@@ -619,14 +614,6 @@ function build(instance, baseElem, optionsOrMethod) {
619
614
  Object.keys(NESTED_SETTINGS).forEach(function(name) {
620
615
  settings[name] = Object.assign({}, NESTED_SETTINGS[name], settings[name]);
621
616
  });
622
- Object.keys(REMOVED_SETTINGS).forEach(function(name) {
623
- if (optionsOrMethod && optionsOrMethod[name] !== void 0) {
624
- warn(translate(settings, "warning.setting_removed", {
625
- setting: name,
626
- replacement: REMOVED_SETTINGS[name]
627
- }));
628
- }
629
- });
630
617
  var canvas, mainControls, wrapper, addRowGroup, addContainerGroup, layoutDropdown, htmlTextArea;
631
618
  var curView = settings.default_view;
632
619
  var confirmDialog = null;
@@ -659,6 +646,7 @@ function build(instance, baseElem, optionsOrMethod) {
659
646
  instance.settings = settingsCopy();
660
647
  removeConfirmModal();
661
648
  removeSettingsPanels();
649
+ removeDialog();
662
650
  mainControls.remove();
663
651
  createMainControls();
664
652
  reset();
@@ -1609,6 +1597,9 @@ function build(instance, baseElem, optionsOrMethod) {
1609
1597
  if (openSettingsState && !attached(openSettingsState.node)) {
1610
1598
  closeSettings();
1611
1599
  }
1600
+ if (dialogState && dialogState.home && !attached(dialogState.home)) {
1601
+ closeDialog();
1602
+ }
1612
1603
  runFilter(true);
1613
1604
  addClass(canvas, "ge-editing");
1614
1605
  toggleClass(canvas, "ge-drag-drawer", settings.drag_handle === "drawer");
@@ -1632,9 +1623,11 @@ function build(instance, baseElem, optionsOrMethod) {
1632
1623
  plugins("onBeforeDeinit");
1633
1624
  closeSizePicker();
1634
1625
  hideDropMarker();
1626
+ closeDialog();
1635
1627
  all(canvas, ".ge-tools-drawer").forEach(function(drawer) {
1636
1628
  drawer.remove();
1637
1629
  });
1630
+ pluginFields.clear();
1638
1631
  unwrapTexts();
1639
1632
  plugins("onDeinit");
1640
1633
  clearPreviews(canvas);
@@ -1670,6 +1663,7 @@ function build(instance, baseElem, optionsOrMethod) {
1670
1663
  deinit();
1671
1664
  removeConfirmModal();
1672
1665
  removeSettingsPanels();
1666
+ removeDialog();
1673
1667
  mainControls.remove();
1674
1668
  htmlTextArea.remove();
1675
1669
  lifetime.abort();
@@ -1766,6 +1760,12 @@ function build(instance, baseElem, optionsOrMethod) {
1766
1760
  setUtility,
1767
1761
  utilityField,
1768
1762
  bareStyle,
1763
+ // The host's own style, under the preview
1764
+ hostStyle,
1765
+ setHostStyle,
1766
+ // A modal of the editor's own, over the settings
1767
+ openDialog,
1768
+ closeDialog,
1769
1769
  rowFromLayout: rowFromLayoutValue,
1770
1770
  nodeHtml,
1771
1771
  // A text editor has rewritten a content area, so whatever the
@@ -2002,6 +2002,7 @@ function build(instance, baseElem, optionsOrMethod) {
2002
2002
  renderUtilities(section);
2003
2003
  });
2004
2004
  }
2005
+ renderPluginFields(node);
2005
2006
  refreshPreviews(node);
2006
2007
  }
2007
2008
  function utilityNodes(scope) {
@@ -2068,6 +2069,61 @@ function build(instance, baseElem, optionsOrMethod) {
2068
2069
  dropEmptyStyle(node);
2069
2070
  });
2070
2071
  }
2072
+ function hostDeclaration(node) {
2073
+ var scratch = document.createElement("div");
2074
+ var was = {};
2075
+ scratch.style.cssText = node.style.cssText;
2076
+ try {
2077
+ was = JSON.parse(node.getAttribute(PREVIEW_ATTR)) || {};
2078
+ } catch (error) {
2079
+ }
2080
+ Object.keys(was).forEach(function(property) {
2081
+ var before = was[property];
2082
+ if (before && before[0]) {
2083
+ scratch.style.setProperty(property, before[0], before[1]);
2084
+ } else {
2085
+ scratch.style.removeProperty(property);
2086
+ }
2087
+ });
2088
+ return scratch.style;
2089
+ }
2090
+ function hostStyle(node, property) {
2091
+ var declaration = hostDeclaration(node);
2092
+ if (property === void 0) {
2093
+ return declaration.cssText;
2094
+ }
2095
+ return {
2096
+ value: declaration.getPropertyValue(property),
2097
+ priority: declaration.getPropertyPriority(property)
2098
+ };
2099
+ }
2100
+ function setHostStyle(node, property, value, priority) {
2101
+ value = value === null || value === void 0 ? "" : String(value).trim();
2102
+ if (priority === void 0) {
2103
+ priority = hostStyle(node, property).priority;
2104
+ }
2105
+ if (value !== "") {
2106
+ var check = document.createElement("div").style;
2107
+ check.setProperty(property, value, priority || "");
2108
+ if (check.getPropertyValue(property) === "") {
2109
+ return false;
2110
+ }
2111
+ }
2112
+ var previewed = node.hasAttribute(PREVIEW_ATTR);
2113
+ if (previewed) {
2114
+ clearPreviews(node);
2115
+ }
2116
+ if (value === "") {
2117
+ node.style.removeProperty(property);
2118
+ } else {
2119
+ node.style.setProperty(property, value, priority || "");
2120
+ }
2121
+ dropEmptyStyle(node);
2122
+ if (previewed) {
2123
+ refreshPreviews(node);
2124
+ }
2125
+ return true;
2126
+ }
2071
2127
  function createUtilitiesSection(node) {
2072
2128
  var kind = kindOf(node);
2073
2129
  var fields = familiesFor(kind).filter(function(family) {
@@ -2124,8 +2180,25 @@ function build(instance, baseElem, optionsOrMethod) {
2124
2180
  }
2125
2181
  var field = createField(node, family);
2126
2182
  renderField(field, node);
2183
+ pluginFields.set(field, node);
2127
2184
  return field;
2128
2185
  }
2186
+ var pluginFields = /* @__PURE__ */ new Map();
2187
+ function renderPluginFields(node) {
2188
+ pluginFields.forEach(function(fieldNode, field) {
2189
+ if (!field.isConnected) {
2190
+ pluginFields.delete(field);
2191
+ return;
2192
+ }
2193
+ if (node && fieldNode !== node) {
2194
+ return;
2195
+ }
2196
+ if (closest(field, ".ge-utilities")) {
2197
+ return;
2198
+ }
2199
+ renderField(field, fieldNode);
2200
+ });
2201
+ }
2129
2202
  function renderUtilities(section) {
2130
2203
  var node = sectionNodes.get(section);
2131
2204
  children(section, ".ge-utilities-toggle").forEach(function(toggle2) {
@@ -2669,12 +2742,50 @@ function build(instance, baseElem, optionsOrMethod) {
2669
2742
  });
2670
2743
  classGroup.appendChild(btn);
2671
2744
  });
2745
+ pluginSections(container).forEach(function(section) {
2746
+ detailsDiv.appendChild(section);
2747
+ });
2672
2748
  var utilities = createUtilitiesSection(container);
2673
2749
  if (utilities) {
2674
2750
  detailsDiv.appendChild(utilities);
2675
2751
  }
2676
2752
  return detailsDiv;
2677
2753
  }
2754
+ function pluginSections(node) {
2755
+ var kind = kindOf(node);
2756
+ var mode = panelMode();
2757
+ var sections = [];
2758
+ [CONTAINERS, FEATURES, UTILITIES].forEach(function(registry) {
2759
+ Object.keys(registry).forEach(function(name) {
2760
+ var plugin = registry[name];
2761
+ var section = plugin.panelSection ? plugin.panelSection(node, kind) : null;
2762
+ if (!section || !section.body) {
2763
+ return;
2764
+ }
2765
+ var holder = element("div", { "class": "ge-panel-section", "data-ge-plugin": name });
2766
+ if (mode === "offcanvas" || mode === "modal") {
2767
+ holder.appendChild(section.body);
2768
+ } else {
2769
+ var label = t(section.labelKey);
2770
+ var open = holder.appendChild(element("button", {
2771
+ type: "button",
2772
+ "class": "btn btn-sm btn-outline-secondary ge-panel-section-open"
2773
+ }, label));
2774
+ hide(section.body);
2775
+ holder.appendChild(section.body);
2776
+ open.addEventListener("click", function() {
2777
+ openDialog(
2778
+ section.titleKey ? t(section.titleKey, { kind: kindLabel(node) }) : label,
2779
+ section.body,
2780
+ open
2781
+ );
2782
+ });
2783
+ }
2784
+ sections.push(holder);
2785
+ });
2786
+ });
2787
+ return sections;
2788
+ }
2678
2789
  var PANEL_MODES = ["offcanvas", "popover", "modal", "inline"];
2679
2790
  var settingsPanels = {};
2680
2791
  var openSettingsState = null;
@@ -2722,7 +2833,7 @@ function build(instance, baseElem, optionsOrMethod) {
2722
2833
  addClass(node, "ge-settings-target");
2723
2834
  var signal = { signal: listening.signal };
2724
2835
  document.addEventListener("keydown", function(e) {
2725
- if (e.key === "Escape") {
2836
+ if (e.key === "Escape" && !dialogState) {
2726
2837
  closeSettings();
2727
2838
  }
2728
2839
  }, signal);
@@ -2745,15 +2856,20 @@ function build(instance, baseElem, optionsOrMethod) {
2745
2856
  openSettingsState.observer.observe(details);
2746
2857
  }
2747
2858
  on(document, "mousedown touchstart", function(e) {
2748
- if (!panel.contains(e.target) && !gear.contains(e.target)) {
2859
+ if (!dialogState && !panel.contains(e.target) && !gear.contains(e.target)) {
2749
2860
  closeSettings();
2750
2861
  }
2751
2862
  }, signal);
2752
2863
  } else {
2753
- showModal(panel);
2864
+ showModal(panel, function() {
2865
+ if (openSettingsState && openSettingsState.mode === "modal") {
2866
+ closeSettings();
2867
+ }
2868
+ });
2754
2869
  }
2755
2870
  }
2756
2871
  function closeSettings() {
2872
+ closeDialog();
2757
2873
  var open = openSettingsState;
2758
2874
  if (!open) {
2759
2875
  return;
@@ -2831,10 +2947,9 @@ function build(instance, baseElem, optionsOrMethod) {
2831
2947
  settingsPanels[mode].remove();
2832
2948
  }
2833
2949
  });
2834
- if (settingsBackdrop) {
2835
- settingsBackdrop.remove();
2836
- settingsBackdrop = null;
2837
- }
2950
+ Object.keys(settingsPanels).forEach(function(mode) {
2951
+ removeBackdrop(settingsPanels[mode]);
2952
+ });
2838
2953
  settingsPanels = {};
2839
2954
  }
2840
2955
  function placePopover(panel, gear) {
@@ -2865,25 +2980,30 @@ function build(instance, baseElem, optionsOrMethod) {
2865
2980
  left: Math.max(gap, Math.min(tool.left + tool.width / 2 - left - 8, width - 24))
2866
2981
  });
2867
2982
  }
2868
- var settingsBackdrop = null;
2869
- function showModal(panel) {
2983
+ function showModal(panel, dismissed) {
2870
2984
  var Modal = modalLibrary();
2985
+ var state = modalState.get(panel);
2986
+ if (!state) {
2987
+ state = { wanted: null, busy: false, backdrop: null, dismissed };
2988
+ modalState.set(panel, state);
2989
+ }
2990
+ state.dismissed = dismissed;
2871
2991
  if (!Modal) {
2872
- settingsBackdrop = element("div", { "class": "modal-backdrop fade show ge-settings-backdrop" });
2873
- settingsBackdrop.addEventListener("click", function() {
2874
- closeSettings();
2875
- });
2876
- document.body.appendChild(settingsBackdrop);
2992
+ if (!state.backdrop) {
2993
+ state.backdrop = element("div", { "class": "modal-backdrop fade show ge-settings-backdrop" });
2994
+ state.backdrop.addEventListener("click", function() {
2995
+ state.dismissed();
2996
+ });
2997
+ document.body.appendChild(state.backdrop);
2998
+ }
2877
2999
  addClass(panel, "show");
2878
3000
  panel.style.display = "block";
2879
3001
  panel.removeAttribute("aria-hidden");
2880
3002
  return;
2881
3003
  }
2882
3004
  var modal = Modal.getOrCreateInstance(panel);
2883
- var state = modalState.get(panel);
2884
- if (!state) {
2885
- state = { wanted: null, busy: false };
2886
- modalState.set(panel, state);
3005
+ if (!state.watched) {
3006
+ state.watched = true;
2887
3007
  trackModal(panel);
2888
3008
  panel.addEventListener("hide.bs.modal", function() {
2889
3009
  if (state.wanted === "open") {
@@ -2900,9 +3020,9 @@ function build(instance, baseElem, optionsOrMethod) {
2900
3020
  panel.addEventListener("hidden.bs.modal", function() {
2901
3021
  state.busy = false;
2902
3022
  if (state.wanted === "open") {
2903
- showModal(panel);
2904
- } else if (openSettingsState && openSettingsState.mode === "modal") {
2905
- closeSettings();
3023
+ showModal(panel, state.dismissed);
3024
+ } else {
3025
+ state.dismissed();
2906
3026
  }
2907
3027
  });
2908
3028
  }
@@ -2914,23 +3034,117 @@ function build(instance, baseElem, optionsOrMethod) {
2914
3034
  }
2915
3035
  function hideModal(panel) {
2916
3036
  var Modal = modalLibrary();
3037
+ var state = modalState.get(panel);
3038
+ if (!state) {
3039
+ return;
3040
+ }
3041
+ state.wanted = "closed";
2917
3042
  if (!Modal) {
2918
- if (settingsBackdrop) {
2919
- settingsBackdrop.remove();
2920
- settingsBackdrop = null;
3043
+ if (state.backdrop) {
3044
+ state.backdrop.remove();
3045
+ state.backdrop = null;
2921
3046
  }
2922
3047
  removeClass(panel, "show");
2923
3048
  panel.style.removeProperty("display");
2924
3049
  panel.setAttribute("aria-hidden", "true");
2925
3050
  return;
2926
3051
  }
2927
- var state = modalState.get(panel) || { wanted: null, busy: false };
2928
- state.wanted = "closed";
2929
3052
  if (!state.busy && hasClass(panel, "show")) {
2930
3053
  state.busy = true;
2931
3054
  Modal.getOrCreateInstance(panel).hide();
2932
3055
  }
2933
3056
  }
3057
+ function removeBackdrop(panel) {
3058
+ var state = modalState.get(panel);
3059
+ if (state && state.backdrop) {
3060
+ state.backdrop.remove();
3061
+ state.backdrop = null;
3062
+ }
3063
+ }
3064
+ var dialogPanel = null;
3065
+ var dialogState = null;
3066
+ function dialog() {
3067
+ if (dialogPanel) {
3068
+ return dialogPanel;
3069
+ }
3070
+ dialogPanel = create('<div class="modal fade ge-dialog" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"><div class="modal-content"><div class="modal-header"><h5 class="modal-title ge-dialog-title"></h5></div><div class="modal-body ge-dialog-body"></div><div class="modal-footer"></div></div></div></div>');
3071
+ one(dialogPanel, ".modal-header").appendChild(element("button", {
3072
+ type: "button",
3073
+ "class": "btn-close ge-dialog-close",
3074
+ "aria-label": t("panel.close")
3075
+ }));
3076
+ one(dialogPanel, ".modal-footer").appendChild(element("button", {
3077
+ type: "button",
3078
+ "class": "btn btn-primary ge-dialog-close"
3079
+ }, t("panel.done")));
3080
+ delegate(dialogPanel, "click", ".ge-dialog-close", function(e) {
3081
+ e.preventDefault();
3082
+ closeDialog();
3083
+ });
3084
+ return document.body.appendChild(dialogPanel);
3085
+ }
3086
+ function openDialog(title, body, opener) {
3087
+ closeDialog();
3088
+ var panel = dialog();
3089
+ var listening = new AbortController();
3090
+ dialogState = {
3091
+ body,
3092
+ home: body.parentElement,
3093
+ next: body.nextElementSibling,
3094
+ opener: opener || document.activeElement,
3095
+ listening
3096
+ };
3097
+ one(panel, ".ge-dialog-title").textContent = title;
3098
+ one(panel, ".ge-dialog-body").appendChild(body);
3099
+ show(body);
3100
+ if (!modalLibrary()) {
3101
+ document.addEventListener("keydown", function(e) {
3102
+ if (e.key === "Escape") {
3103
+ closeDialog();
3104
+ }
3105
+ }, { signal: listening.signal });
3106
+ }
3107
+ Object.keys(settingsPanels).forEach(function(mode) {
3108
+ addClass(settingsPanels[mode], "ge-under-dialog");
3109
+ });
3110
+ showModal(panel, function() {
3111
+ closeDialog();
3112
+ });
3113
+ }
3114
+ function closeDialog() {
3115
+ var open = dialogState;
3116
+ if (!open) {
3117
+ return;
3118
+ }
3119
+ dialogState = null;
3120
+ open.listening.abort();
3121
+ hideModal(dialogPanel);
3122
+ Object.keys(settingsPanels).forEach(function(mode) {
3123
+ removeClass(settingsPanels[mode], "ge-under-dialog");
3124
+ });
3125
+ hide(open.body);
3126
+ if (open.home && attached(open.home)) {
3127
+ if (open.next && open.next.parentElement === open.home) {
3128
+ open.home.insertBefore(open.body, open.next);
3129
+ } else {
3130
+ open.home.appendChild(open.body);
3131
+ }
3132
+ } else {
3133
+ open.body.remove();
3134
+ }
3135
+ if (open.opener && attached(open.opener) && open.opener.focus) {
3136
+ open.opener.focus();
3137
+ }
3138
+ }
3139
+ function removeDialog() {
3140
+ closeDialog();
3141
+ if (!dialogPanel) {
3142
+ return;
3143
+ }
3144
+ removeBackdrop(dialogPanel);
3145
+ retireModal(dialogPanel);
3146
+ dialogPanel = null;
3147
+ }
2934
3148
  function kindLabel(node) {
2935
3149
  var kind = kindOf(node);
2936
3150
  if (CONTAINERS[kind] && CONTAINERS[kind].labelKey) {
@@ -3779,10 +3993,6 @@ function build(instance, baseElem, optionsOrMethod) {
3779
3993
  one(layoutDropdown, "button").textContent = t(labelKeyFor(view));
3780
3994
  }
3781
3995
  function viewKey(view) {
3782
- if (typeof view == "number") {
3783
- warnOnceHere("changeView-index", "changeView(" + view + "): layout modes are identified by breakpoint key now, so pass one of " + JSON.stringify(VIEW_KEYS) + ". Numeric indexes still work, but they mean what they meant in 2.x (" + LEGACY_VIEW_INDEXES.join(", ") + ") and will be dropped.");
3784
- return LEGACY_VIEW_INDEXES[view] || null;
3785
- }
3786
3996
  return VIEW_KEYS.indexOf(view) === -1 ? null : view;
3787
3997
  }
3788
3998
  function changeView(view) {
@@ -3801,6 +4011,7 @@ function build(instance, baseElem, optionsOrMethod) {
3801
4011
  renderUtilities(section);
3802
4012
  });
3803
4013
  });
4014
+ renderPluginFields(null);
3804
4015
  refreshPreviews(canvas);
3805
4016
  plugins("onViewChange", key);
3806
4017
  emit("view-change", { canvas, breakpoint: key, from, to: key });
@@ -3889,7 +4100,7 @@ GridEditor.t = translate;
3889
4100
  GridEditor._plainHtml = plainHtml;
3890
4101
  GridEditor.Sortable = null;
3891
4102
  GridEditor.bootstrap = null;
3892
- GridEditor.version = false ? "dev" : "7.2.0";
4103
+ GridEditor.version = false ? "dev" : "8.0.0-beta.2";
3893
4104
  GridEditor.locales = {
3894
4105
  en: {
3895
4106
  "tool.move": "Move",
@@ -3959,14 +4170,12 @@ GridEditor.locales = {
3959
4170
  "utility.inherit": "Inherit: {value} (from {breakpoint})",
3960
4171
  "utility.varies": "Changes at {breakpoints}; choosing here replaces that",
3961
4172
  "error.sortable_missing": "SortableJS not available! Make sure you loaded the Sortable js file; dragging is off without it.",
3962
- "warning.setting_removed": "The {setting} setting was removed in 4.0. Use {replacement} instead.",
3963
4173
  "warning.already_editing": "This element already has an editor: that one is handed back, with the options it was made with.",
3964
4174
  "warning.destroyed": "{method}() was called on an editor that has been destroyed, and does nothing.",
3965
4175
  "warning.duplicate_build": "grideditor.js was loaded twice: the first GridEditor is kept.",
3966
- "warning.plugin_6x": 'The "{name}" plugin is written for grid-editor 6 and is not loaded. Plugins register on GridEditor since 7.0: see UPGRADING.md.',
3967
4176
  "warning.adapter_no_jquery": "grideditor.jquery.js needs jQuery 4, and there is no jQuery on the page: the jQuery API is not there.",
3968
4177
  "error.tinymce_missing": "tinyMCE not available! Make sure you loaded the tinyMCE js file.",
3969
- "error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file: CKEditor 4 is no longer supported.",
4178
+ "error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file.",
3970
4179
  "error.summernote_missing": "Summernote not available! Make sure you loaded jQuery and the Summernote js file."
3971
4180
  }
3972
4181
  };
@@ -192,13 +192,6 @@
192
192
  return result;
193
193
  };
194
194
  });
195
- function warnAboutLegacyPlugins() {
196
- ["containers", "features", "utilities", "texts"].forEach(function(registry) {
197
- Object.keys(legacy[registry]).forEach(function(name) {
198
- warnOnce("plugin-6x:" + registry + ":" + name, english("warning.plugin_6x", { name }));
199
- });
200
- });
201
- }
202
195
  function dispatchMethod(set, name, args) {
203
196
  var descriptor = METHODS[name];
204
197
  if (!descriptor) {
@@ -235,18 +228,12 @@
235
228
  if (typeof optionsOrMethod == "string") {
236
229
  return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));
237
230
  }
238
- warnAboutLegacyPlugins();
239
231
  var options = adaptOptions(optionsOrMethod);
240
232
  this.each(function() {
241
233
  GridEditor.create(this, options);
242
234
  });
243
235
  return this;
244
236
  };
245
- var legacy = { containers: {}, features: {}, utilities: {}, texts: {} };
246
- $.fn.gridEditor.containers = legacy.containers;
247
- $.fn.gridEditor.features = legacy.features;
248
- $.fn.gridEditor.utilities = legacy.utilities;
249
- $.fn.gridEditor.texts = legacy.texts;
250
237
  $.fn.gridEditor.locales = GridEditor.locales;
251
238
  $.fn.gridEditor.t = GridEditor.t;
252
239
  }
@@ -1 +1 @@
1
- (()=>{var u=window.GridEditor;if(!u||typeof u.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");var n=window.jQuery,j=function(a,c){return u.t({locale:"en"},a,c)},_={};function h(a,c){_[a]||(_[a]=!0,window.console&&window.console.warn&&window.console.warn("grid-editor: "+c))}!n||!n.fn?h("no-jquery",j("warning.adapter_no_jquery")):k();function k(){var a={getHtml:{value:!0},getPlainHtml:{value:!0},init:{},deinit:{},reset:{},destroy:{},changeView:{},getView:{value:!0},createRow:{value:!0},createColumn:{value:!0},createElement:{value:!0},createText:{value:!0},createSection:{value:!0},createContainer:{value:!0},addTab:{value:!0},addAccordionItem:{value:!0},setLocale:{},getUtility:{value:!0},setUtility:{value:!0}},c=["row_tools","col_tools","element_tools","container_tools","tab_tools","accordion_tools","text_tools"];function w(r){return!!r&&r.nodeType===1}function l(r){return r instanceof n?r[0]||null:r}function p(r){if(r instanceof n)return l(r);if(r&&typeof r=="object"&&!Array.isArray(r)&&!w(r)){var t={};return Object.keys(r).forEach(function(e){t[e]=l(r[e])}),t}return r}function y(r){return w(r)?n(r):r}var d=new WeakMap;function v(r){if(!r||typeof r!="object")return r;if(d.has(r))return d.get(r);var t=Object.assign({},r);return["node","parent","canvas"].forEach(function(e){e in r&&(t[e]=n(r[e]||[]))}),r.container&&(t.container=n(r.container)),Array.isArray(r.nodes)&&(t.node=n(r.nodes)),["from","to"].forEach(function(e){var i=r[e];i&&typeof i=="object"&&"parent"in i&&(t[e]=Object.assign({},i,{parent:n(i.parent||[])}))}),d.set(r,t),t}var m=n.event.dispatch;n.event.dispatch=function(r){return arguments.length===1&&r instanceof window.CustomEvent&&typeof r.type=="string"&&r.type.indexOf("grideditor:")===0?m.call(this,r,v(r.detail)):m.apply(this,arguments)};function b(r){return function(t){return r.call(this,n.event.fix(t))}}function E(r){if(!r||!r.on)return r;var t;return typeof r.on=="function"?t=b(r.on):(t={},Object.keys(r.on).forEach(function(e){t[e]=b(r.on[e])})),Object.assign({},r,{on:t})}function x(r){return function(t,e){var i=typeof r=="string"?window[r]:r;return i(n(t),e)}}function O(r){if(r=Object.assign({},r||{}),r.callbacks){var t={};Object.keys(r.callbacks).forEach(function(i){var o=r.callbacks[i];t[i]=typeof o=="function"?function(s){return o(v(s))}:o}),r.callbacks=t}if(r.custom_filter&&r.custom_filter.length){var e=typeof r.custom_filter=="string"||typeof r.custom_filter=="function"?[r.custom_filter]:Array.prototype.slice.call(r.custom_filter);r.custom_filter=e.map(x)}return c.forEach(function(i){Array.isArray(r[i])&&(r[i]=r[i].map(E))}),r.source_textarea=l(r.source_textarea),r}function A(r){var t={canvas:n(r.canvas)};return Object.keys(a).forEach(function(e){t[e]=function(){var i=r[e].apply(r,Array.prototype.map.call(arguments,p));return i===r?void 0:y(i)}}),Object.defineProperty(t,"settings",{enumerable:!0,get:function(){return r.settings}}),t}u._created.push(function(r){n.data(r.canvas,"grideditor",A(r));var t=r.destroy;r.destroy=function(){var e=t.apply(this,arguments);return n.removeData(r.canvas,"grideditor"),e}});function T(){["containers","features","utilities","texts"].forEach(function(r){Object.keys(f[r]).forEach(function(t){h("plugin-6x:"+r+":"+t,j("warning.plugin_6x",{name:t}))})})}function H(r,t,e){var i=a[t];if(!i)return h("method:"+t,'unknown method "'+t+'"'),r;if(e=e.map(p),i.value){var o=r.first();if(!o.length)return null;var s=u.get(o[0]);return s?y(s[t].apply(s,e)):t==="getHtml"?o.html():t==="getPlainHtml"?u._plainHtml(o.html()):null}return r.each(function(){var g=u.get(this);g&&g[t].apply(g,e)}),r}n.fn.gridEditor=function(r){if(typeof r=="string")return H(this,r,Array.prototype.slice.call(arguments,1));T();var t=O(r);return this.each(function(){u.create(this,t)}),this};var f={containers:{},features:{},utilities:{},texts:{}};n.fn.gridEditor.containers=f.containers,n.fn.gridEditor.features=f.features,n.fn.gridEditor.utilities=f.utilities,n.fn.gridEditor.texts=f.texts,n.fn.gridEditor.locales=u.locales,n.fn.gridEditor.t=u.t}})();
1
+ (()=>{var u=window.GridEditor;if(!u||typeof u.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");var i=window.jQuery,x=function(c,a){return u.t({locale:"en"},c,a)},m={};function b(c,a){m[c]||(m[c]=!0,window.console&&window.console.warn&&window.console.warn("grid-editor: "+a))}!i||!i.fn?b("no-jquery",x("warning.adapter_no_jquery")):T();function T(){var c={getHtml:{value:!0},getPlainHtml:{value:!0},init:{},deinit:{},reset:{},destroy:{},changeView:{},getView:{value:!0},createRow:{value:!0},createColumn:{value:!0},createElement:{value:!0},createText:{value:!0},createSection:{value:!0},createContainer:{value:!0},addTab:{value:!0},addAccordionItem:{value:!0},setLocale:{},getUtility:{value:!0},setUtility:{value:!0}},a=["row_tools","col_tools","element_tools","container_tools","tab_tools","accordion_tools","text_tools"];function g(r){return!!r&&r.nodeType===1}function l(r){return r instanceof i?r[0]||null:r}function h(r){if(r instanceof i)return l(r);if(r&&typeof r=="object"&&!Array.isArray(r)&&!g(r)){var t={};return Object.keys(r).forEach(function(e){t[e]=l(r[e])}),t}return r}function w(r){return g(r)?i(r):r}var s=new WeakMap;function p(r){if(!r||typeof r!="object")return r;if(s.has(r))return s.get(r);var t=Object.assign({},r);return["node","parent","canvas"].forEach(function(e){e in r&&(t[e]=i(r[e]||[]))}),r.container&&(t.container=i(r.container)),Array.isArray(r.nodes)&&(t.node=i(r.nodes)),["from","to"].forEach(function(e){var n=r[e];n&&typeof n=="object"&&"parent"in n&&(t[e]=Object.assign({},n,{parent:i(n.parent||[])}))}),s.set(r,t),t}var y=i.event.dispatch;i.event.dispatch=function(r){return arguments.length===1&&r instanceof window.CustomEvent&&typeof r.type=="string"&&r.type.indexOf("grideditor:")===0?y.call(this,r,p(r.detail)):y.apply(this,arguments)};function v(r){return function(t){return r.call(this,i.event.fix(t))}}function _(r){if(!r||!r.on)return r;var t;return typeof r.on=="function"?t=v(r.on):(t={},Object.keys(r.on).forEach(function(e){t[e]=v(r.on[e])})),Object.assign({},r,{on:t})}function j(r){return function(t,e){var n=typeof r=="string"?window[r]:r;return n(i(t),e)}}function E(r){if(r=Object.assign({},r||{}),r.callbacks){var t={};Object.keys(r.callbacks).forEach(function(n){var o=r.callbacks[n];t[n]=typeof o=="function"?function(f){return o(p(f))}:o}),r.callbacks=t}if(r.custom_filter&&r.custom_filter.length){var e=typeof r.custom_filter=="string"||typeof r.custom_filter=="function"?[r.custom_filter]:Array.prototype.slice.call(r.custom_filter);r.custom_filter=e.map(j)}return a.forEach(function(n){Array.isArray(r[n])&&(r[n]=r[n].map(_))}),r.source_textarea=l(r.source_textarea),r}function O(r){var t={canvas:i(r.canvas)};return Object.keys(c).forEach(function(e){t[e]=function(){var n=r[e].apply(r,Array.prototype.map.call(arguments,h));return n===r?void 0:w(n)}}),Object.defineProperty(t,"settings",{enumerable:!0,get:function(){return r.settings}}),t}u._created.push(function(r){i.data(r.canvas,"grideditor",O(r));var t=r.destroy;r.destroy=function(){var e=t.apply(this,arguments);return i.removeData(r.canvas,"grideditor"),e}});function A(r,t,e){var n=c[t];if(!n)return b("method:"+t,'unknown method "'+t+'"'),r;if(e=e.map(h),n.value){var o=r.first();if(!o.length)return null;var f=u.get(o[0]);return f?w(f[t].apply(f,e)):t==="getHtml"?o.html():t==="getPlainHtml"?u._plainHtml(o.html()):null}return r.each(function(){var d=u.get(this);d&&d[t].apply(d,e)}),r}i.fn.gridEditor=function(r){if(typeof r=="string")return A(this,r,Array.prototype.slice.call(arguments,1));var t=E(r);return this.each(function(){u.create(this,t)}),this},i.fn.gridEditor.locales=u.locales,i.fn.gridEditor.t=u.t}})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/js/register.js", "../src/js/grideditor.jquery.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 jQuery API of grid-editor 6, on top of the 7.0 editor.\n *\n * grid-editor is plain DOM since 7.0. A page written for 6.x - one that\n * calls $(el).gridEditor(...), listens with $(el).on('grideditor:...') and\n * reads jQuery objects out of the payloads - loads jQuery 4 and this file\n * after grideditor.js, and runs unchanged:\n *\n * <script src=\"jquery.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/grideditor.jquery.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.tabs.min.js\"></script>\n *\n * What it keeps is the host's side of 6.x. Plugins are not: a plugin\n * written for 6.x registered on $.fn.gridEditor.containers, .features,\n * .utilities or .texts, and is warned about and left out, since the plugin\n * contract hands out elements now. UPGRADING.md says how to port one.\n *\n * Every value 6.x gave host code as a jQuery object is one again: the event\n * payloads and the callbacks' arguments, what the create* methods return,\n * the handle $(el).data('grideditor') gives, the canvas custom_filter gets,\n * and the event a host tool's handler gets. What the host hands in may be a\n * jQuery object wherever 6.x took one.\n */\nimport { GridEditor } from './grideditor.js';\n\nvar $ = window.jQuery;\n\nvar english = function(key, params) { return GridEditor.t({ locale: 'en' }, key, params); };\n\nvar warned = {};\n\nfunction warnOnce(key, message) {\n if (warned[key]) { return; }\n warned[key] = true;\n if (window.console && window.console.warn) { window.console.warn('grid-editor: ' + message); }\n}\n\nif (!$ || !$.fn) {\n warnOnce('no-jquery', english('warning.adapter_no_jquery'));\n} else {\n install();\n}\n\nfunction install() {\n\n /**\n * Every method 6.x dispatched, and which hand back something other than\n * the jQuery set: those run against the first element only, and do not\n * chain.\n */\n var METHODS = {\n getHtml: { value: true },\n getPlainHtml: { value: true },\n init: {},\n deinit: {},\n reset: {},\n destroy: {},\n changeView: {},\n getView: { value: true },\n createRow: { value: true },\n createColumn: { value: true },\n createElement: { value: true },\n createText: { value: true },\n createSection: { value: true },\n createContainer: { value: true },\n addTab: { value: true },\n addAccordionItem: { value: true },\n setLocale: {},\n getUtility: { value: true },\n setUtility: { value: true },\n };\n\n /** The *_tools settings, whose handlers 6.x bound with jQuery. */\n var TOOL_SETTINGS = ['row_tools', 'col_tools', 'element_tools', 'container_tools',\n 'tab_tools', 'accordion_tools', 'text_tools'];\n\n function isElement(value) {\n return !!value && value.nodeType === 1;\n }\n\n /** What the host handed in, as the editor takes it: a jQuery object is its first element. */\n function unwrap(value) {\n if (value instanceof $) { return value[0] || null; }\n return value;\n }\n\n /** An argument, and the options object an argument may be, unwrapped one level down. */\n function unwrapArgument(value) {\n if (value instanceof $) { return unwrap(value); }\n\n if (value && typeof value === 'object' && !Array.isArray(value) && !isElement(value)) {\n var copy = {};\n Object.keys(value).forEach(function(key) { copy[key] = unwrap(value[key]); });\n return copy;\n }\n\n return value;\n }\n\n /** What the editor handed back, as 6.x did: an element is a jQuery object. */\n function wrapResult(value) {\n return isElement(value) ? $(value) : value;\n }\n\n /**\n * A payload as 6.x built it: its nodes jQuery objects, and an empty set\n * where there is no node - a detached node's parent. The same payload\n * wraps to the same object, so every listener of one notification sees\n * one payload, as they did.\n */\n var wrappedPayloads = new WeakMap();\n\n function wrapPayload(payload) {\n if (!payload || typeof payload !== 'object') { return payload; }\n if (wrappedPayloads.has(payload)) { return wrappedPayloads.get(payload); }\n\n var copy = Object.assign({}, payload);\n\n ['node', 'parent', 'canvas'].forEach(function(key) {\n if (key in payload) { copy[key] = $(payload[key] || []); }\n });\n if (payload.container) { copy.container = $(payload.container); }\n // edit-html writes any number of nodes, which 6.x gave as one set\n if (Array.isArray(payload.nodes)) { copy.node = $(payload.nodes); }\n ['from', 'to'].forEach(function(key) {\n var position = payload[key];\n if (position && typeof position === 'object' && 'parent' in position) {\n copy[key] = Object.assign({}, position, { parent: $(position.parent || []) });\n }\n });\n\n wrappedPayloads.set(payload, copy);\n return copy;\n }\n\n /**\n * The events, as jQuery handlers had them: (event, payload).\n *\n * The editor dispatches DOM events, which jQuery hands its handlers with\n * no second argument. Its dispatcher is where every one of them passes,\n * delegated ones too, so that is where the payload goes back in: once,\n * for each handler, and preventDefault() on the jQuery event is\n * preventDefault() on the editor's.\n */\n var dispatch = $.event.dispatch;\n $.event.dispatch = function(nativeEvent) {\n if (arguments.length === 1 && nativeEvent instanceof window.CustomEvent &&\n typeof nativeEvent.type === 'string' && nativeEvent.type.indexOf('grideditor:') === 0) {\n return dispatch.call(this, nativeEvent, wrapPayload(nativeEvent.detail));\n }\n\n return dispatch.apply(this, arguments);\n };\n\n /** A handler of a host's tool, given a jQuery event as 6.x gave it. */\n function jqueryHandler(handler) {\n return function(event) {\n return handler.call(this, $.event.fix(event));\n };\n }\n\n function adaptTool(tool) {\n if (!tool || !tool.on) { return tool; }\n\n var on;\n if (typeof tool.on === 'function') {\n on = jqueryHandler(tool.on);\n } else {\n on = {};\n Object.keys(tool.on).forEach(function(name) { on[name] = jqueryHandler(tool.on[name]); });\n }\n\n return Object.assign({}, tool, { on: on });\n }\n\n /** A custom_filter, as a function of a jQuery canvas; a name is looked up when it runs. */\n function adaptFilter(filter) {\n return function(canvas, isInit) {\n var func = typeof filter === 'string' ? window[filter] : filter;\n return func($(canvas), isInit);\n };\n }\n\n /** The host's 6.x options, as the editor takes them. */\n function adaptOptions(options) {\n options = Object.assign({}, options || {});\n\n if (options.callbacks) {\n var callbacks = {};\n Object.keys(options.callbacks).forEach(function(name) {\n var callback = options.callbacks[name];\n callbacks[name] = typeof callback === 'function'\n ? function(payload) { return callback(wrapPayload(payload)); }\n : callback;\n });\n options.callbacks = callbacks;\n }\n\n if (options.custom_filter && options.custom_filter.length) {\n var filters = typeof options.custom_filter === 'string' || typeof options.custom_filter === 'function'\n ? [options.custom_filter]\n : Array.prototype.slice.call(options.custom_filter);\n options.custom_filter = filters.map(adaptFilter);\n }\n\n TOOL_SETTINGS.forEach(function(name) {\n if (Array.isArray(options[name])) { options[name] = options[name].map(adaptTool); }\n });\n\n options.source_textarea = unwrap(options.source_textarea);\n\n return options;\n }\n\n /**\n * The handle $(el).data('grideditor') gave in 6.x: the same methods, with\n * jQuery going in and coming out, and the canvas as a jQuery object.\n */\n function handleFor(instance) {\n var handle = { canvas: $(instance.canvas) };\n\n Object.keys(METHODS).forEach(function(name) {\n handle[name] = function() {\n var result = instance[name].apply(instance, Array.prototype.map.call(arguments, unwrapArgument));\n return result === instance ? undefined : wrapResult(result);\n };\n });\n\n Object.defineProperty(handle, 'settings', {\n enumerable: true,\n get: function() { return instance.settings; },\n });\n\n return handle;\n }\n\n /**\n * Every editor gets its 6.x handle, whoever made it: $(el).gridEditor()\n * or new GridEditor(el). It goes with the editor.\n */\n GridEditor._created.push(function(instance) {\n $.data(instance.canvas, 'grideditor', handleFor(instance));\n\n var destroy = instance.destroy;\n instance.destroy = function() {\n var result = destroy.apply(this, arguments);\n $.removeData(instance.canvas, 'grideditor');\n return result;\n };\n });\n\n /** Plugins registered the 6.x way: said once each, and never called. */\n function warnAboutLegacyPlugins() {\n ['containers', 'features', 'utilities', 'texts'].forEach(function(registry) {\n Object.keys(legacy[registry]).forEach(function(name) {\n warnOnce('plugin-6x:' + registry + ':' + name, english('warning.plugin_6x', { name: name }));\n });\n });\n }\n\n function dispatchMethod(set, name, args) {\n var descriptor = METHODS[name];\n\n if (!descriptor) {\n warnOnce('method:' + name, 'unknown method \"' + name + '\"');\n return set;\n }\n\n args = args.map(unwrapArgument);\n\n if (descriptor.value) {\n var element = set.first();\n if (!element.length) { return null; }\n\n var instance = GridEditor.get(element[0]);\n if (!instance) {\n if (name === 'getHtml') { return element.html(); }\n if (name === 'getPlainHtml') { return GridEditor._plainHtml(element.html()); }\n return null;\n }\n\n return wrapResult(instance[name].apply(instance, args));\n }\n\n set.each(function() {\n var found = GridEditor.get(this);\n if (found) { found[name].apply(found, args); }\n });\n\n return set;\n }\n\n /**\n * $(el).gridEditor(options): an editor on each element that has none.\n * $(el).gridEditor('method', ...): a method, 6.x style.\n */\n $.fn.gridEditor = function(optionsOrMethod) {\n if (typeof optionsOrMethod == 'string') {\n return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));\n }\n\n warnAboutLegacyPlugins();\n\n var options = adaptOptions(optionsOrMethod);\n\n this.each(function() {\n GridEditor.create(this, options);\n });\n\n return this;\n };\n\n // Where a 6.x plugin registers. Kept, so one does not throw as it\n // loads, and read only to say it is not used.\n var legacy = { containers: {}, features: {}, utilities: {}, texts: {} };\n $.fn.gridEditor.containers = legacy.containers;\n $.fn.gridEditor.features = legacy.features;\n $.fn.gridEditor.utilities = legacy.utilities;\n $.fn.gridEditor.texts = legacy.texts;\n\n // Strings are the same thing in both: a 6.x locale file loads unchanged\n $.fn.gridEditor.locales = GridEditor.locales;\n $.fn.gridEditor.t = GridEditor.t;\n}\n"],
5
- "mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECa9C,IAAIC,EAAI,OAAO,OAEXC,EAAU,SAASC,EAAKC,EAAQ,CAAE,OAAOC,EAAW,EAAE,CAAE,OAAQ,IAAK,EAAGF,EAAKC,CAAM,CAAG,EAEtFE,EAAS,CAAC,EAEd,SAASC,EAASJ,EAAKK,EAAS,CACxBF,EAAOH,CAAG,IACdG,EAAOH,CAAG,EAAI,GACV,OAAO,SAAW,OAAO,QAAQ,MAAQ,OAAO,QAAQ,KAAK,gBAAkBK,CAAO,EAC9F,CAEI,CAACP,GAAK,CAACA,EAAE,GACTM,EAAS,YAAaL,EAAQ,2BAA2B,CAAC,EAE1DO,EAAQ,EAGZ,SAASA,GAAU,CAOf,IAAIC,EAAU,CACV,QAAkB,CAAE,MAAO,EAAK,EAChC,aAAkB,CAAE,MAAO,EAAK,EAChC,KAAkB,CAAC,EACnB,OAAkB,CAAC,EACnB,MAAkB,CAAC,EACnB,QAAkB,CAAC,EACnB,WAAkB,CAAC,EACnB,QAAkB,CAAE,MAAO,EAAK,EAChC,UAAkB,CAAE,MAAO,EAAK,EAChC,aAAkB,CAAE,MAAO,EAAK,EAChC,cAAkB,CAAE,MAAO,EAAK,EAChC,WAAkB,CAAE,MAAO,EAAK,EAChC,cAAkB,CAAE,MAAO,EAAK,EAChC,gBAAkB,CAA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AS,eAAyBzB,EAAW,WAAWgD,EAAQ,KAAK,CAAC,EACnE,IAIf,CAEA,OAAAH,EAAI,KAAK,UAAW,CAChB,IAAII,EAAQjD,EAAW,IAAI,IAAI,EAC3BiD,GAASA,EAAMxB,CAAI,EAAE,MAAMwB,EAAOH,CAAI,CAC9C,CAAC,EAEMD,CACX,CAMAjD,EAAE,GAAG,WAAa,SAASsD,EAAiB,CACxC,GAAI,OAAOA,GAAmB,SAC1B,OAAON,EAAe,KAAMM,EAAiB,MAAM,UAAU,MAAM,KAAK,UAAW,CAAC,CAAC,EAGzFT,EAAuB,EAEvB,IAAIT,EAAUD,EAAamB,CAAe,EAE1C,YAAK,KAAK,UAAW,CACjBlD,EAAW,OAAO,KAAMgC,CAAO,CACnC,CAAC,EAEM,IACX,EAIA,IAAIW,EAAS,CAAE,WAAY,CAAC,EAAG,SAAU,CAAC,EAAG,UAAW,CAAC,EAAG,MAAO,CAAC,CAAE,EACtE/C,EAAE,GAAG,WAAW,WAAa+C,EAAO,WACpC/C,EAAE,GAAG,WAAW,SAAW+C,EAAO,SAClC/C,EAAE,GAAG,WAAW,UAAY+C,EAAO,UACnC/C,EAAE,GAAG,WAAW,MAAQ+C,EAAO,MAG/B/C,EAAE,GAAG,WAAW,QAAUI,EAAW,QACrCJ,EAAE,GAAG,WAAW,EAAII,EAAW,CACnC",
6
- "names": ["GridEditor", "$", "english", "key", "params", "GridEditor", "warned", "warnOnce", "message", "install", "METHODS", "TOOL_SETTINGS", "isElement", "value", "unwrap", "unwrapArgument", "copy", "wrapResult", "wrappedPayloads", "wrapPayload", "payload", "position", "dispatch", "nativeEvent", "jqueryHandler", "handler", "event", "adaptTool", "tool", "on", "name", "adaptFilter", "filter", "canvas", "isInit", "func", "adaptOptions", "options", "callbacks", "callback", "filters", "handleFor", "instance", "handle", "result", "destroy", "warnAboutLegacyPlugins", "registry", "legacy", "dispatchMethod", "set", "args", "descriptor", "element", "found", "optionsOrMethod"]
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 jQuery API of grid-editor 6, on top of the plain DOM editor.\n *\n * A page written for 6.x - one that calls $(el).gridEditor(...), listens\n * with $(el).on('grideditor:...') and reads jQuery objects out of the\n * payloads - loads jQuery 4 and this file after grideditor.js, and runs\n * unchanged:\n *\n * <script src=\"jquery.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/grideditor.jquery.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.tabs.min.js\"></script>\n *\n * What it keeps is the host's side of 6.x. Plugins are not: they register\n * on GridEditor, and the plugin contract hands out elements.\n *\n * Every value 6.x gave host code as a jQuery object is one again: the event\n * payloads and the callbacks' arguments, what the create* methods return,\n * the handle $(el).data('grideditor') gives, the canvas custom_filter gets,\n * and the event a host tool's handler gets. What the host hands in may be a\n * jQuery object wherever 6.x took one.\n */\nimport { GridEditor } from './grideditor.js';\n\nvar $ = window.jQuery;\n\nvar english = function(key, params) { return GridEditor.t({ locale: 'en' }, key, params); };\n\nvar warned = {};\n\nfunction warnOnce(key, message) {\n if (warned[key]) { return; }\n warned[key] = true;\n if (window.console && window.console.warn) { window.console.warn('grid-editor: ' + message); }\n}\n\nif (!$ || !$.fn) {\n warnOnce('no-jquery', english('warning.adapter_no_jquery'));\n} else {\n install();\n}\n\nfunction install() {\n\n /**\n * Every method 6.x dispatched, and which hand back something other than\n * the jQuery set: those run against the first element only, and do not\n * chain.\n */\n var METHODS = {\n getHtml: { value: true },\n getPlainHtml: { value: true },\n init: {},\n deinit: {},\n reset: {},\n destroy: {},\n changeView: {},\n getView: { value: true },\n createRow: { value: true },\n createColumn: { value: true },\n createElement: { value: true },\n createText: { value: true },\n createSection: { value: true },\n createContainer: { value: true },\n addTab: { value: true },\n addAccordionItem: { value: true },\n setLocale: {},\n getUtility: { value: true },\n setUtility: { value: true },\n };\n\n /** The *_tools settings, whose handlers 6.x bound with jQuery. */\n var TOOL_SETTINGS = ['row_tools', 'col_tools', 'element_tools', 'container_tools',\n 'tab_tools', 'accordion_tools', 'text_tools'];\n\n function isElement(value) {\n return !!value && value.nodeType === 1;\n }\n\n /** What the host handed in, as the editor takes it: a jQuery object is its first element. */\n function unwrap(value) {\n if (value instanceof $) { return value[0] || null; }\n return value;\n }\n\n /** An argument, and the options object an argument may be, unwrapped one level down. */\n function unwrapArgument(value) {\n if (value instanceof $) { return unwrap(value); }\n\n if (value && typeof value === 'object' && !Array.isArray(value) && !isElement(value)) {\n var copy = {};\n Object.keys(value).forEach(function(key) { copy[key] = unwrap(value[key]); });\n return copy;\n }\n\n return value;\n }\n\n /** What the editor handed back, as 6.x did: an element is a jQuery object. */\n function wrapResult(value) {\n return isElement(value) ? $(value) : value;\n }\n\n /**\n * A payload as 6.x built it: its nodes jQuery objects, and an empty set\n * where there is no node - a detached node's parent. The same payload\n * wraps to the same object, so every listener of one notification sees\n * one payload, as they did.\n */\n var wrappedPayloads = new WeakMap();\n\n function wrapPayload(payload) {\n if (!payload || typeof payload !== 'object') { return payload; }\n if (wrappedPayloads.has(payload)) { return wrappedPayloads.get(payload); }\n\n var copy = Object.assign({}, payload);\n\n ['node', 'parent', 'canvas'].forEach(function(key) {\n if (key in payload) { copy[key] = $(payload[key] || []); }\n });\n if (payload.container) { copy.container = $(payload.container); }\n // edit-html writes any number of nodes, which 6.x gave as one set\n if (Array.isArray(payload.nodes)) { copy.node = $(payload.nodes); }\n ['from', 'to'].forEach(function(key) {\n var position = payload[key];\n if (position && typeof position === 'object' && 'parent' in position) {\n copy[key] = Object.assign({}, position, { parent: $(position.parent || []) });\n }\n });\n\n wrappedPayloads.set(payload, copy);\n return copy;\n }\n\n /**\n * The events, as jQuery handlers had them: (event, payload).\n *\n * The editor dispatches DOM events, which jQuery hands its handlers with\n * no second argument. Its dispatcher is where every one of them passes,\n * delegated ones too, so that is where the payload goes back in: once,\n * for each handler, and preventDefault() on the jQuery event is\n * preventDefault() on the editor's.\n */\n var dispatch = $.event.dispatch;\n $.event.dispatch = function(nativeEvent) {\n if (arguments.length === 1 && nativeEvent instanceof window.CustomEvent &&\n typeof nativeEvent.type === 'string' && nativeEvent.type.indexOf('grideditor:') === 0) {\n return dispatch.call(this, nativeEvent, wrapPayload(nativeEvent.detail));\n }\n\n return dispatch.apply(this, arguments);\n };\n\n /** A handler of a host's tool, given a jQuery event as 6.x gave it. */\n function jqueryHandler(handler) {\n return function(event) {\n return handler.call(this, $.event.fix(event));\n };\n }\n\n function adaptTool(tool) {\n if (!tool || !tool.on) { return tool; }\n\n var on;\n if (typeof tool.on === 'function') {\n on = jqueryHandler(tool.on);\n } else {\n on = {};\n Object.keys(tool.on).forEach(function(name) { on[name] = jqueryHandler(tool.on[name]); });\n }\n\n return Object.assign({}, tool, { on: on });\n }\n\n /** A custom_filter, as a function of a jQuery canvas; a name is looked up when it runs. */\n function adaptFilter(filter) {\n return function(canvas, isInit) {\n var func = typeof filter === 'string' ? window[filter] : filter;\n return func($(canvas), isInit);\n };\n }\n\n /** The host's 6.x options, as the editor takes them. */\n function adaptOptions(options) {\n options = Object.assign({}, options || {});\n\n if (options.callbacks) {\n var callbacks = {};\n Object.keys(options.callbacks).forEach(function(name) {\n var callback = options.callbacks[name];\n callbacks[name] = typeof callback === 'function'\n ? function(payload) { return callback(wrapPayload(payload)); }\n : callback;\n });\n options.callbacks = callbacks;\n }\n\n if (options.custom_filter && options.custom_filter.length) {\n var filters = typeof options.custom_filter === 'string' || typeof options.custom_filter === 'function'\n ? [options.custom_filter]\n : Array.prototype.slice.call(options.custom_filter);\n options.custom_filter = filters.map(adaptFilter);\n }\n\n TOOL_SETTINGS.forEach(function(name) {\n if (Array.isArray(options[name])) { options[name] = options[name].map(adaptTool); }\n });\n\n options.source_textarea = unwrap(options.source_textarea);\n\n return options;\n }\n\n /**\n * The handle $(el).data('grideditor') gave in 6.x: the same methods, with\n * jQuery going in and coming out, and the canvas as a jQuery object.\n */\n function handleFor(instance) {\n var handle = { canvas: $(instance.canvas) };\n\n Object.keys(METHODS).forEach(function(name) {\n handle[name] = function() {\n var result = instance[name].apply(instance, Array.prototype.map.call(arguments, unwrapArgument));\n return result === instance ? undefined : wrapResult(result);\n };\n });\n\n Object.defineProperty(handle, 'settings', {\n enumerable: true,\n get: function() { return instance.settings; },\n });\n\n return handle;\n }\n\n /**\n * Every editor gets its 6.x handle, whoever made it: $(el).gridEditor()\n * or new GridEditor(el). It goes with the editor.\n */\n GridEditor._created.push(function(instance) {\n $.data(instance.canvas, 'grideditor', handleFor(instance));\n\n var destroy = instance.destroy;\n instance.destroy = function() {\n var result = destroy.apply(this, arguments);\n $.removeData(instance.canvas, 'grideditor');\n return result;\n };\n });\n\n function dispatchMethod(set, name, args) {\n var descriptor = METHODS[name];\n\n if (!descriptor) {\n warnOnce('method:' + name, 'unknown method \"' + name + '\"');\n return set;\n }\n\n args = args.map(unwrapArgument);\n\n if (descriptor.value) {\n var element = set.first();\n if (!element.length) { return null; }\n\n var instance = GridEditor.get(element[0]);\n if (!instance) {\n if (name === 'getHtml') { return element.html(); }\n if (name === 'getPlainHtml') { return GridEditor._plainHtml(element.html()); }\n return null;\n }\n\n return wrapResult(instance[name].apply(instance, args));\n }\n\n set.each(function() {\n var found = GridEditor.get(this);\n if (found) { found[name].apply(found, args); }\n });\n\n return set;\n }\n\n /**\n * $(el).gridEditor(options): an editor on each element that has none.\n * $(el).gridEditor('method', ...): a method, 6.x style.\n */\n $.fn.gridEditor = function(optionsOrMethod) {\n if (typeof optionsOrMethod == 'string') {\n return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));\n }\n\n var options = adaptOptions(optionsOrMethod);\n\n this.each(function() {\n GridEditor.create(this, options);\n });\n\n return this;\n };\n\n // Strings are the same thing in both: a 6.x locale file loads unchanged\n $.fn.gridEditor.locales = GridEditor.locales;\n $.fn.gridEditor.t = GridEditor.t;\n}\n"],
5
+ "mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECW9C,IAAIC,EAAI,OAAO,OAEXC,EAAU,SAASC,EAAKC,EAAQ,CAAE,OAAOC,EAAW,EAAE,CAAE,OAAQ,IAAK,EAAGF,EAAKC,CAAM,CAAG,EAEtFE,EAAS,CAAC,EAEd,SAASC,EAASJ,EAAKK,EAAS,CACxBF,EAAOH,CAAG,IACdG,EAAOH,CAAG,EAAI,GACV,OAAO,SAAW,OAAO,QAAQ,MAAQ,OAAO,QAAQ,KAAK,gBAAkBK,CAAO,EAC9F,CAEI,CAACP,GAAK,CAACA,EAAE,GACTM,EAAS,YAAaL,EAAQ,2BAA2B,CAAC,EAE1DO,EAAQ,EAGZ,SAASA,GAAU,CAOf,IAAIC,EAAU,CACV,QAAkB,CAAE,MAAO,EAAK,EAChC,aAAkB,CAAE,MAAO,EAAK,EAChC,KAAkB,CAAC,EACnB,OAAkB,CAAC,EACnB,MAAkB,CAAC,EACnB,QAAkB,CAAC,EACnB,WAAkB,CAAC,EACnB,QAAkB,CAAE,MAAO,EAAK,EAChC,UAAkB,CAAE,MAAO,EAAK,EAChC,aAAkB,CAAE,MAAO,EAAK,EAChC,cAAkB,CAAE,MAAO,EAAK,EAChC,WAAkB,CAAE,MAAO,EAAK,EAChC,cAAkB,CAAE,MAAO,EAAK,EAChC,gBAAkB,CAAE,MAAO,EAAK,EAChC,OAAkB,CAAE,MAAO,EAAK,EAChC,iBAAkB,CAAE,MAAO,EAAK,EAChC,UAAkB,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AAIf,EAAUD,EAAagB,CAAe,EAE1C,YAAK,KAAK,UAAW,CACjB/C,EAAW,OAAO,KAAMgC,CAAO,CACnC,CAAC,EAEM,IACX,EAGApC,EAAE,GAAG,WAAW,QAAUI,EAAW,QACrCJ,EAAE,GAAG,WAAW,EAAII,EAAW,CACnC",
6
+ "names": ["GridEditor", "$", "english", "key", "params", "GridEditor", "warned", "warnOnce", "message", "install", "METHODS", "TOOL_SETTINGS", "isElement", "value", "unwrap", "unwrapArgument", "copy", "wrapResult", "wrappedPayloads", "wrapPayload", "payload", "position", "dispatch", "nativeEvent", "jqueryHandler", "handler", "event", "adaptTool", "tool", "on", "name", "adaptFilter", "filter", "canvas", "isInit", "func", "adaptOptions", "options", "callbacks", "callback", "filters", "handleFor", "instance", "handle", "result", "destroy", "dispatchMethod", "set", "args", "descriptor", "element", "found", "optionsOrMethod"]
7
7
  }