@themarioga/grid-editor 6.0.0-beta.5 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/AUTO_SAVE.md +2 -2
  2. package/BUILDING.md +45 -29
  3. package/CHANGELOG.md +54 -0
  4. package/README.md +140 -89
  5. package/UPGRADING.md +146 -2
  6. package/dist/grideditor.bundle.min.js +14 -0
  7. package/dist/grideditor.d.ts +335 -0
  8. package/dist/grideditor.esm.js +3977 -0
  9. package/dist/grideditor.jquery.js +253 -0
  10. package/dist/grideditor.jquery.min.js +1 -0
  11. package/dist/grideditor.jquery.min.js.map +7 -0
  12. package/dist/grideditor.js +3983 -0
  13. package/dist/grideditor.min.js +6 -0
  14. package/dist/grideditor.min.js.map +7 -0
  15. package/dist/locales/grideditor.es.esm.js +158 -0
  16. package/dist/locales/grideditor.es.js +164 -170
  17. package/dist/locales/grideditor.es.min.js +6 -2
  18. package/dist/locales/grideditor.es.min.js.map +7 -1
  19. package/dist/plugins/grideditor.accordion.esm.js +294 -0
  20. package/dist/plugins/grideditor.accordion.js +286 -180
  21. package/dist/plugins/grideditor.accordion.min.js +1 -2
  22. package/dist/plugins/grideditor.accordion.min.js.map +7 -1
  23. package/dist/plugins/grideditor.alignment.esm.js +55 -0
  24. package/dist/plugins/grideditor.alignment.js +58 -77
  25. package/dist/plugins/grideditor.alignment.min.js +1 -2
  26. package/dist/plugins/grideditor.alignment.min.js.map +7 -1
  27. package/dist/plugins/grideditor.card.esm.js +73 -0
  28. package/dist/plugins/grideditor.card.js +74 -64
  29. package/dist/plugins/grideditor.card.min.js +1 -2
  30. package/dist/plugins/grideditor.card.min.js.map +7 -1
  31. package/dist/plugins/grideditor.ckeditor.esm.js +500 -0
  32. package/dist/plugins/grideditor.ckeditor.js +482 -493
  33. package/dist/plugins/grideditor.ckeditor.min.js +1 -2
  34. package/dist/plugins/grideditor.ckeditor.min.js.map +7 -1
  35. package/dist/plugins/grideditor.clipboard.esm.js +326 -0
  36. package/dist/plugins/grideditor.clipboard.js +298 -235
  37. package/dist/plugins/grideditor.clipboard.min.js +1 -2
  38. package/dist/plugins/grideditor.clipboard.min.js.map +7 -1
  39. package/dist/plugins/grideditor.codemirror-inline.esm.js +205 -0
  40. package/dist/plugins/grideditor.codemirror-inline.js +188 -168
  41. package/dist/plugins/grideditor.codemirror-inline.min.js +1 -2
  42. package/dist/plugins/grideditor.codemirror-inline.min.js.map +7 -1
  43. package/dist/plugins/grideditor.codemirror.esm.js +63 -0
  44. package/dist/plugins/grideditor.codemirror.js +60 -71
  45. package/dist/plugins/grideditor.codemirror.min.js +1 -2
  46. package/dist/plugins/grideditor.codemirror.min.js.map +7 -1
  47. package/dist/plugins/grideditor.elements.esm.js +271 -0
  48. package/dist/plugins/grideditor.elements.js +256 -149
  49. package/dist/plugins/grideditor.elements.min.js +1 -2
  50. package/dist/plugins/grideditor.elements.min.js.map +7 -1
  51. package/dist/plugins/grideditor.float.esm.js +34 -0
  52. package/dist/plugins/grideditor.float.js +37 -52
  53. package/dist/plugins/grideditor.float.min.js +1 -2
  54. package/dist/plugins/grideditor.float.min.js.map +7 -1
  55. package/dist/plugins/grideditor.gutters.esm.js +143 -0
  56. package/dist/plugins/grideditor.gutters.js +134 -131
  57. package/dist/plugins/grideditor.gutters.min.js +1 -2
  58. package/dist/plugins/grideditor.gutters.min.js.map +7 -1
  59. package/dist/plugins/grideditor.order.esm.js +189 -0
  60. package/dist/plugins/grideditor.order.js +170 -182
  61. package/dist/plugins/grideditor.order.min.js +1 -2
  62. package/dist/plugins/grideditor.order.min.js.map +7 -1
  63. package/dist/plugins/grideditor.popup.esm.js +187 -0
  64. package/dist/plugins/grideditor.popup.js +183 -134
  65. package/dist/plugins/grideditor.popup.min.js +1 -2
  66. package/dist/plugins/grideditor.popup.min.js.map +7 -1
  67. package/dist/plugins/grideditor.sections.esm.js +271 -0
  68. package/dist/plugins/grideditor.sections.js +250 -173
  69. package/dist/plugins/grideditor.sections.min.js +1 -2
  70. package/dist/plugins/grideditor.sections.min.js.map +7 -1
  71. package/dist/plugins/grideditor.spacing.esm.js +318 -0
  72. package/dist/plugins/grideditor.spacing.js +296 -272
  73. package/dist/plugins/grideditor.spacing.min.js +1 -2
  74. package/dist/plugins/grideditor.spacing.min.js.map +7 -1
  75. package/dist/plugins/grideditor.summernote.esm.js +509 -0
  76. package/dist/plugins/grideditor.summernote.js +491 -471
  77. package/dist/plugins/grideditor.summernote.min.js +1 -2
  78. package/dist/plugins/grideditor.summernote.min.js.map +7 -1
  79. package/dist/plugins/grideditor.tabs.esm.js +237 -0
  80. package/dist/plugins/grideditor.tabs.js +233 -139
  81. package/dist/plugins/grideditor.tabs.min.js +1 -2
  82. package/dist/plugins/grideditor.tabs.min.js.map +7 -1
  83. package/dist/plugins/grideditor.textalign.esm.js +40 -0
  84. package/dist/plugins/grideditor.textalign.js +43 -56
  85. package/dist/plugins/grideditor.textalign.min.js +1 -2
  86. package/dist/plugins/grideditor.textalign.min.js.map +7 -1
  87. package/dist/plugins/grideditor.tinymce.esm.js +519 -0
  88. package/dist/plugins/grideditor.tinymce.js +500 -534
  89. package/dist/plugins/grideditor.tinymce.min.js +1 -2
  90. package/dist/plugins/grideditor.tinymce.min.js.map +7 -1
  91. package/dist/plugins/grideditor.visibility.esm.js +158 -0
  92. package/dist/plugins/grideditor.visibility.js +140 -149
  93. package/dist/plugins/grideditor.visibility.min.js +1 -2
  94. package/dist/plugins/grideditor.visibility.min.js.map +7 -1
  95. package/docs/events.md +47 -21
  96. package/docs/locale-keys.md +7 -4
  97. package/docs/plugins.md +49 -27
  98. package/example/adapter.html +112 -0
  99. package/example/attributes.html +85 -61
  100. package/example/autocols.html +9 -9
  101. package/example/autosave.html +13 -14
  102. package/example/basic.html +4 -5
  103. package/example/breakpoints.html +5 -6
  104. package/example/ckeditor.html +4 -5
  105. package/example/clipboard.html +11 -10
  106. package/example/codemirror.html +9 -7
  107. package/example/containers.html +7 -8
  108. package/example/custom_editor.html +53 -34
  109. package/example/elements.html +10 -11
  110. package/example/index.html +16 -2
  111. package/example/locale.html +6 -7
  112. package/example/plugins.html +44 -29
  113. package/example/summernote.html +6 -5
  114. package/example/utilities.html +17 -13
  115. package/example/wrap_content.html +9 -9
  116. package/package.json +43 -12
  117. package/src/js/dom.js +401 -0
  118. package/src/js/grideditor.classic.js +16 -0
  119. package/src/js/grideditor.jquery.js +325 -0
  120. package/src/js/{jquery.grideditor.js → grideditor.js} +1284 -1124
  121. package/src/js/locales/grideditor.es.js +163 -158
  122. package/src/js/plugins/grideditor.accordion.js +97 -77
  123. package/src/js/plugins/grideditor.alignment.js +5 -7
  124. package/src/js/plugins/grideditor.card.js +23 -23
  125. package/src/js/plugins/grideditor.ckeditor.js +107 -106
  126. package/src/js/plugins/grideditor.clipboard.js +49 -37
  127. package/src/js/plugins/grideditor.codemirror-inline.js +50 -37
  128. package/src/js/plugins/grideditor.codemirror.js +9 -10
  129. package/src/js/plugins/grideditor.elements.js +57 -33
  130. package/src/js/plugins/grideditor.float.js +4 -6
  131. package/src/js/plugins/grideditor.gutters.js +20 -15
  132. package/src/js/plugins/grideditor.order.js +28 -25
  133. package/src/js/plugins/grideditor.popup.js +63 -51
  134. package/src/js/plugins/grideditor.sections.js +39 -32
  135. package/src/js/plugins/grideditor.spacing.js +42 -45
  136. package/src/js/plugins/grideditor.summernote.js +112 -76
  137. package/src/js/plugins/grideditor.tabs.js +65 -57
  138. package/src/js/plugins/grideditor.textalign.js +4 -6
  139. package/src/js/plugins/grideditor.tinymce.js +147 -139
  140. package/src/js/plugins/grideditor.visibility.js +24 -25
  141. package/src/js/register.js +18 -0
  142. package/src/js/text/grideditor.text.js +81 -106
  143. package/types/grideditor.d.ts +335 -0
  144. package/dist/jquery.grideditor.bundle.min.js +0 -10
  145. package/dist/jquery.grideditor.js +0 -4927
  146. package/dist/jquery.grideditor.min.js +0 -2
  147. package/dist/jquery.grideditor.min.js.map +0 -1
@@ -7,161 +7,169 @@
7
7
  * factory is called with, described in docs/plugins.md.
8
8
  *
9
9
  * <script src="tinymce/tinymce.min.js"></script>
10
- * <script src="dist/jquery.grideditor.min.js"></script>
10
+ * <script src="dist/grideditor.min.js"></script>
11
11
  * <script src="dist/plugins/grideditor.tinymce.min.js"></script>
12
12
  *
13
13
  * Up to 5.x the main bundle carried a copy of this file; since 6.0 it is
14
- * loaded on its own, like every plugin. The built file starts with what
15
- * every text editor shares - text blocks, the Text button and the Add text
16
- * tool, createText, making the host's plain content a text - from
17
- * src/js/text/grideditor.text.js, installed once however many editors a
18
- * page loads.
14
+ * loaded on its own, like every plugin. It imports what every text editor
15
+ * shares - text blocks, the Text button, createText, making the host's plain
16
+ * content a text - from src/js/text/grideditor.text.js, which the build puts
17
+ * in its classic script, installed once however many editors a page loads.
19
18
  */
20
- (function($) {
21
-
22
- $.extend($.fn.gridEditor.locales.en, {
23
- 'text.tinymce': 'tinyMCE',
19
+ import { GridEditor } from '../grideditor.js';
20
+ import * as dom from '../dom.js';
21
+ import '../text/grideditor.text.js';
22
+
23
+ Object.assign(GridEditor.locales.en, {
24
+ 'text.tinymce': 'tinyMCE',
25
+ 'warning.oninit_removed': 'tinyMCE\'s oninit option was removed in 7.0 and is ignored: use init_instance_callback.',
26
+ });
27
+
28
+ // tinyMCE snapshots the target element's attributes when an inline editor is
29
+ // created and restores them on remove(), so this has to run *after* remove()
30
+ // to keep the grid editor's own class and tinyMCE's leftovers off the element.
31
+ function cleanUp(contentArea) {
32
+ dom.removeClass(contentArea, 'active ge-rte-active');
33
+ ['id', 'style', 'spellcheck', 'contenteditable', 'data-mce-style'].forEach(function(name) {
34
+ contentArea.removeAttribute(name);
24
35
  });
36
+ }
37
+
38
+ var INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';
39
+
40
+ // What this file remembers about a content area: its editor, and whether a
41
+ // deinit came before that editor was ready
42
+ var editors = new WeakMap();
43
+ var pendingRemove = new WeakSet();
44
+
45
+ // Said once per page, however many editors are on it
46
+ var warnedOninit = false;
47
+
48
+ GridEditor.texts.tinymce = function(ge) {
49
+ return {
50
+ labelKey: 'text.tinymce',
51
+ initialContent: INITIAL_CONTENT,
52
+ missingKey: 'error.tinymce_missing',
53
+
54
+ available: function() { return !!window.tinymce; },
55
+
56
+ start: function(contentAreas) {
57
+ var settings = ge.settings;
58
+ var userConfig = (settings.tinymce && settings.tinymce.config) ? settings.tinymce.config : {};
59
+
60
+ // 'oninit' was the pre-6 name for init_instance_callback, honoured
61
+ // through 6.x and gone in 7.0
62
+ if (userConfig.oninit && !warnedOninit) {
63
+ warnedOninit = true;
64
+ ge.warn(ge.t('warning.oninit_removed'));
65
+ }
66
+
67
+ contentAreas.forEach(function(contentArea) {
68
+ if (dom.hasClass(contentArea, 'active')) { return; }
69
+
70
+ if (contentArea.innerHTML == INITIAL_CONTENT) {
71
+ contentArea.innerHTML = '';
72
+ }
73
+ dom.addClass(contentArea, 'active');
74
+
75
+ var configuration = Object.assign({
76
+ // tinyMCE's own "Upgrade" badge in the menubar. Off by
77
+ // default because an inline editor here is a column of
78
+ // someone's page, not tinyMCE's own interface; a host that
79
+ // wants it back passes promotion: true.
80
+ promotion: false,
81
+ }, userConfig, {
82
+ target: contentArea,
83
+ inline: true,
84
+ init_instance_callback: function(editor) {
85
+ // deinit ran before this init finished, so tear it down again
86
+ if (pendingRemove.has(contentArea)) {
87
+ pendingRemove.delete(contentArea);
88
+ editor.remove();
89
+ // deinit already ran and cannot clean up after this
90
+ // late remove(), so do it here instead
91
+ cleanUp(contentArea);
92
+ return;
93
+ }
25
94
 
26
- // tinyMCE snapshots the target element's attributes when an inline editor is
27
- // created and restores them on remove(), so this has to run *after* remove()
28
- // to keep the grid editor's own class and tinyMCE's leftovers off the element.
29
- function cleanUp(contentArea) {
30
- contentArea
31
- .removeClass('active')
32
- .removeClass('ge-rte-active')
33
- .removeAttr('id')
34
- .removeAttr('style')
35
- .removeAttr('spellcheck')
36
- .removeAttr('contenteditable')
37
- .removeAttr('data-mce-style')
38
- ;
39
- }
40
-
41
- var INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';
42
-
43
- $.fn.gridEditor.texts.tinymce = function(ge) {
44
- return {
45
- labelKey: 'text.tinymce',
46
- initialContent: INITIAL_CONTENT,
47
- missingKey: 'error.tinymce_missing',
48
-
49
- available: function() { return !!window.tinymce; },
50
-
51
- start: function(contentAreas) {
52
- var settings = ge.settings;
53
- var userConfig = (settings.tinymce && settings.tinymce.config) ? settings.tinymce.config : {};
54
-
55
- contentAreas.each(function() {
56
- var contentArea = $(this);
57
- if (contentArea.hasClass('active')) { return; }
58
-
59
- if (contentArea.html() == INITIAL_CONTENT) {
60
- contentArea.html('');
61
- }
62
- contentArea.addClass('active');
63
-
64
- var configuration = $.extend({
65
- // tinyMCE's own "Upgrade" badge in the menubar. Off by
66
- // default because an inline editor here is a column of
67
- // someone's page, not tinyMCE's own interface; a host that
68
- // wants it back passes promotion: true.
69
- promotion: false,
70
- }, userConfig, {
71
- target: this,
72
- inline: true,
73
- init_instance_callback: function(editor) {
74
- // deinit ran before this init finished, so tear it down again
75
- if (contentArea.data('ge-tinymce-pending-remove')) {
76
- contentArea.removeData('ge-tinymce-pending-remove');
77
- editor.remove();
78
- // deinit already ran and cannot clean up after this
79
- // late remove(), so do it here instead
80
- cleanUp(contentArea);
81
- return;
82
- }
83
-
84
- contentArea.data('ge-tinymce', editor);
85
-
86
- // The editor rewrote what is inside this content area
87
- // while it took it over, so whatever the grid editor
88
- // had in there is gone. Saying so lets it put its own
89
- // furniture back.
90
- ge.textReady(contentArea);
95
+ editors.set(contentArea, editor);
91
96
 
92
- // Undo and redo rewrite it too, from snapshots that
93
- // leave out whatever is marked data-mce-bogus - an
94
- // element's drawer among them - so it goes back in
95
- // after each of those as well
96
- editor.on('Undo Redo', function() {
97
- ge.textReady(contentArea);
98
- });
97
+ // The editor rewrote what is inside this content area
98
+ // while it took it over, so whatever the grid editor
99
+ // had in there is gone. Saying so lets it put its own
100
+ // furniture back.
101
+ ge.textReady(contentArea);
99
102
 
100
- // The inline toolbar is laid out against the element's
101
- // geometry at the moment tinyMCE draws it, and an
102
- // element that has just appeared - a tab pane, an
103
- // accordion body, a column whose width is still
104
- // settling - may not have its own width yet. Asking
105
- // for the ui again once the browser has laid the frame
106
- // out measures it as it now is, instead of leaving a
107
- // toolbar wrapped into a narrow column.
103
+ // Undo and redo rewrite it too, from snapshots that
104
+ // leave out whatever is marked data-mce-bogus - an
105
+ // element's drawer among them - so it goes back in
106
+ // after each of those as well
107
+ editor.on('Undo Redo', function() {
108
+ ge.textReady(contentArea);
109
+ });
110
+
111
+ // The inline toolbar is laid out against the element's
112
+ // geometry at the moment tinyMCE draws it, and an
113
+ // element that has just appeared - a tab pane, an
114
+ // accordion body, a column whose width is still
115
+ // settling - may not have its own width yet. Asking
116
+ // for the ui again once the browser has laid the frame
117
+ // out measures it as it now is, instead of leaving a
118
+ // toolbar wrapped into a narrow column.
119
+ window.requestAnimationFrame(function() {
120
+ if (editor.removed || !editor.ui || !editor.ui.show) { return; }
121
+
122
+ editor.ui.show();
123
+ });
124
+
125
+ // And again whenever the user comes back to this
126
+ // editor: by then the element may have been resized,
127
+ // hidden and shown again - a tab switched away from
128
+ // and back, a column made narrower - and the toolbar
129
+ // is only ever as right as its last measurement.
130
+ editor.on('focus', function() {
108
131
  window.requestAnimationFrame(function() {
109
132
  if (editor.removed || !editor.ui || !editor.ui.show) { return; }
110
133
 
111
134
  editor.ui.show();
112
135
  });
136
+ });
113
137
 
114
- // And again whenever the user comes back to this
115
- // editor: by then the element may have been resized,
116
- // hidden and shown again - a tab switched away from
117
- // and back, a column made narrower - and the toolbar
118
- // is only ever as right as its last measurement.
119
- editor.on('focus', function() {
120
- window.requestAnimationFrame(function() {
121
- if (editor.removed || !editor.ui || !editor.ui.show) { return; }
122
-
123
- editor.ui.show();
124
- });
125
- });
138
+ // Bring focus to text field
139
+ editor.focus();
126
140
 
127
- // Bring focus to text field
128
- editor.focus();
129
-
130
- // Call the original callbacks, if any were passed in the config
131
- if (userConfig.init_instance_callback) {
132
- userConfig.init_instance_callback.call(this, editor);
133
- }
134
- // 'oninit' is the pre-6 name, honoured so existing configs keep working
135
- if (userConfig.oninit) {
136
- userConfig.oninit.call(this, editor);
137
- }
141
+ // Call the original callback, if one was passed in the config
142
+ if (userConfig.init_instance_callback) {
143
+ userConfig.init_instance_callback.call(this, editor);
138
144
  }
139
- });
140
- // We always edit the element we were handed, so a selector in the
141
- // user config would only fight with target
142
- delete configuration.selector;
143
-
144
- window.tinymce.init(configuration);
145
- });
146
- },
147
-
148
- stop: function(contentAreas) {
149
- contentAreas.filter('.active').each(function() {
150
- var contentArea = $(this);
151
- var editor = contentArea.data('ge-tinymce');
152
-
153
- if (editor) {
154
- contentArea.removeData('ge-tinymce');
155
- editor.remove();
156
- } else {
157
- // tinymce.init() is asynchronous, so the editor may not exist
158
- // yet. Leave a note for init_instance_callback to remove it.
159
- contentArea.data('ge-tinymce-pending-remove', true);
160
145
  }
161
-
162
- cleanUp(contentArea);
163
146
  });
164
- },
165
- };
147
+ // We always edit the element we were handed, so a selector in the
148
+ // user config would only fight with target
149
+ delete configuration.selector;
150
+ delete configuration.oninit;
151
+
152
+ window.tinymce.init(configuration);
153
+ });
154
+ },
155
+
156
+ stop: function(contentAreas) {
157
+ contentAreas.filter(function(contentArea) {
158
+ return dom.hasClass(contentArea, 'active');
159
+ }).forEach(function(contentArea) {
160
+ var editor = editors.get(contentArea);
161
+
162
+ if (editor) {
163
+ editors.delete(contentArea);
164
+ editor.remove();
165
+ } else {
166
+ // tinymce.init() is asynchronous, so the editor may not exist
167
+ // yet. Leave a note for init_instance_callback to remove it.
168
+ pendingRemove.add(contentArea);
169
+ }
170
+
171
+ cleanUp(contentArea);
172
+ });
173
+ },
166
174
  };
167
- })(jQuery);
175
+ };
@@ -8,7 +8,7 @@
8
8
  * block). What it can ask the editor for is the handle its factory is called
9
9
  * with, described in docs/plugins.md.
10
10
  *
11
- * <script src="dist/jquery.grideditor.min.js"></script>
11
+ * <script src="dist/grideditor.min.js"></script>
12
12
  * <script src="dist/plugins/grideditor.visibility.min.js"></script>
13
13
  *
14
14
  * A hidden node is never hidden from the editor, which would leave nothing to
@@ -18,9 +18,10 @@
18
18
  * utilities.visibility.drawer: false leaves the eye out of the drawers, and
19
19
  * the panel field is the only control.
20
20
  */
21
- (function($) {
21
+ import { GridEditor } from '../grideditor.js';
22
+ import * as dom from '../dom.js';
22
23
 
23
- $.extend($.fn.gridEditor.locales.en, {
24
+ Object.assign(GridEditor.locales.en, {
24
25
  'utility.visibility': 'Visibility',
25
26
  'utility.visibility_hidden': 'Hidden',
26
27
  'utility.visibility_shown': 'Shown',
@@ -34,9 +35,9 @@ var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s
34
35
 
35
36
  var NODES = '.row, .column, .ge-content, .ge-element, [data-ge-container]';
36
37
 
37
- $.fn.gridEditor.utilities.visibility = function(ge) {
38
+ GridEditor.utilities.visibility = function(ge) {
38
39
 
39
- var options = $.extend({ drawer: true }, ge.settings.utilities.visibility);
40
+ var options = Object.assign({ drawer: true }, ge.settings.utilities.visibility);
40
41
 
41
42
  /** What "shown" is written as on this kind of node. */
42
43
  function shown(kind) {
@@ -45,7 +46,7 @@ $.fn.gridEditor.utilities.visibility = function(ge) {
45
46
 
46
47
  function applies(node, kind) {
47
48
  return kind === 'row' || kind === 'column' || kind === 'element' || kind === 'text' || kind === 'plain' ||
48
- node.is('[data-ge-container]');
49
+ dom.is(node, '[data-ge-container]');
49
50
  }
50
51
 
51
52
  function hiddenAt(node, view) {
@@ -103,38 +104,38 @@ $.fn.gridEditor.utilities.visibility = function(ge) {
103
104
  * and data-ge-hidden-in carries the badge text for the all view.
104
105
  */
105
106
  function mark(scope) {
106
- scope.find(NODES).addBack(NODES).each(function() {
107
- var node = $(this);
107
+ dom.selfAndAll(scope, NODES).forEach(function(node) {
108
108
  var kind = ge.kindOf(node);
109
- var carries = applies(node, kind) && CLASS_PATTERN.test(node.attr('class') || '');
109
+ var carries = applies(node, kind) && CLASS_PATTERN.test(node.getAttribute('class') || '');
110
110
  var tiers = carries ? hiddenTiers(node) : [];
111
111
  var here = carries && hiddenHere(node);
112
112
  var partly = carries && ge.view() === 'all' && tiers.length > 0 && !here;
113
113
 
114
- node.toggleClass('ge-visibility', carries).toggleClass('ge-hidden-in-view', here);
114
+ dom.toggleClass(node, 'ge-visibility', carries);
115
+ dom.toggleClass(node, 'ge-hidden-in-view', here);
115
116
 
116
117
  if (partly) {
117
- node.attr('data-ge-hidden-in', ge.t('badge.hidden_in', { breakpoints: tiers.join(', ') }));
118
+ node.setAttribute('data-ge-hidden-in', ge.t('badge.hidden_in', { breakpoints: tiers.join(', ') }));
118
119
  } else {
119
- node.removeAttr('data-ge-hidden-in');
120
+ node.removeAttribute('data-ge-hidden-in');
120
121
  }
121
122
 
122
- node.children('.ge-tools-drawer').children('.ge-visibility-tool').each(function() {
123
- $(this)
124
- .attr('title', here ? ge.t('tool.show_in_view') : ge.t('tool.hide_in_view'))
125
- .find('i').attr('class', here ? 'bi bi-eye-slash' : 'bi bi-eye');
123
+ dom.children(node, '.ge-tools-drawer').forEach(function(drawer) {
124
+ dom.children(drawer, '.ge-visibility-tool').forEach(function(tool) {
125
+ tool.setAttribute('title', here ? ge.t('tool.show_in_view') : ge.t('tool.hide_in_view'));
126
+ dom.all(tool, 'i').forEach(function(icon) {
127
+ icon.setAttribute('class', here ? 'bi bi-eye-slash' : 'bi bi-eye');
128
+ });
129
+ });
126
130
  });
127
131
  });
128
132
  }
129
133
 
130
134
  function unmark() {
131
- ge.canvas.find('.ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]').each(function() {
132
- var node = $(this)
133
- .removeClass('ge-visibility ge-hidden-in-view')
134
- .removeAttr('data-ge-hidden-in')
135
- ;
136
-
137
- if (!node.attr('class')) { node.removeAttr('class'); }
135
+ dom.all(ge.canvas, '.ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]').forEach(function(node) {
136
+ dom.removeClass(node, 'ge-visibility ge-hidden-in-view');
137
+ node.removeAttribute('data-ge-hidden-in');
138
+ dom.dropEmptyClass(node);
138
139
  });
139
140
  }
140
141
 
@@ -168,5 +169,3 @@ $.fn.gridEditor.utilities.visibility = function(ge) {
168
169
  onDeinit: unmark,
169
170
  };
170
171
  };
171
-
172
- })(jQuery);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * What a plugin's or a locale's classic script imports in place of the
3
+ * editor: the GridEditor the page already loaded.
4
+ *
5
+ * The build points `import { GridEditor } from '../grideditor.js'` here for
6
+ * the classic scripts, so each registers on the editor the page has rather
7
+ * than bringing its own. Loaded before the editor there is nothing to
8
+ * register on, and saying so is better than a TypeError three calls later.
9
+ */
10
+ var GridEditor = window.GridEditor;
11
+
12
+ if (!GridEditor || typeof GridEditor.get !== 'function') {
13
+ throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +
14
+ 'its locales and grideditor.jquery.js');
15
+ }
16
+
17
+ export { GridEditor };
18
+ export default GridEditor;