@themarioga/grid-editor 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/AUTO_SAVE.md +2 -2
  2. package/BUILDING.md +45 -29
  3. package/CHANGELOG.md +47 -0
  4. package/README.md +137 -85
  5. package/UPGRADING.md +119 -0
  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 -168
  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 +484 -449
  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 +493 -427
  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 +502 -490
  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 +6 -0
  97. package/docs/plugins.md +47 -25
  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 -156
  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 +77 -56
  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
@@ -8,20 +8,19 @@
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
9
 
10
10
  <!-- Javascript dependencies -->
11
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
12
11
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
13
12
 
14
13
  <!-- Grid editor CSS -->
15
14
  <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
16
15
  <!-- Grid editor javascript, then the locales the page offers. English is
17
- built into the plugin; every other language is a file of its own. -->
16
+ built into the editor; every other language is a file of its own. -->
18
17
  <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
19
- <script src="../dist/jquery.grideditor.min.js"></script>
18
+ <script src="../dist/grideditor.min.js"></script>
20
19
  <script src="../dist/locales/grideditor.es.js"></script>
21
20
 
22
21
  <script>
23
- $(function() {
24
- $('#myGrid').gridEditor({
22
+ document.addEventListener('DOMContentLoaded', function() {
23
+ var editor = new GridEditor('#myGrid', {
25
24
  new_row_layouts: [[12], [6,6], [9,3]],
26
25
  content_types: [],
27
26
  locale: 'es',
@@ -32,8 +31,8 @@
32
31
  });
33
32
 
34
33
  // Switching language at runtime re-renders the controls
35
- $('#language').on('change', function() {
36
- $('#myGrid').gridEditor('setLocale', this.value);
34
+ document.getElementById('language').addEventListener('change', function() {
35
+ editor.setLocale(this.value);
37
36
  });
38
37
  });
39
38
  </script>
@@ -8,7 +8,6 @@
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
9
 
10
10
  <!-- Javascript dependencies -->
11
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
12
11
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
13
12
 
14
13
  <!-- Grid editor CSS -->
@@ -17,7 +16,7 @@
17
16
  <!-- The editor, and the plugins this page offers. Loading a file is what
18
17
  makes its feature available; nothing here is in the main bundle. -->
19
18
  <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
20
- <script src="../dist/jquery.grideditor.min.js"></script>
19
+ <script src="../dist/grideditor.min.js"></script>
21
20
  <script src="../dist/plugins/grideditor.tabs.min.js"></script>
22
21
  <script src="../dist/plugins/grideditor.accordion.min.js"></script>
23
22
  <script src="../dist/plugins/grideditor.popup.min.js"></script>
@@ -27,17 +26,17 @@
27
26
  <!-- And one written here, to show what a plugin of your own takes. It is
28
27
  a container type: a bootstrap alert whose body is an editable region. -->
29
28
  <script id="callout-plugin">
30
- (function($) {
29
+ (function() {
31
30
 
32
31
  // A plugin brings its own strings
33
- $.extend($.fn.gridEditor.locales.en, {
32
+ Object.assign(GridEditor.locales.en, {
34
33
  'container.add_callout': 'Callout',
35
34
  'container.callout_title': 'Heads up',
36
35
  });
37
36
 
38
37
  // Registered under the type it builds, and called once per editor
39
- // with the handle it works through
40
- $.fn.gridEditor.containers.callout = function(ge) {
38
+ // with the handle it works through. The handle hands out elements.
39
+ GridEditor.containers.callout = function(ge) {
41
40
 
42
41
  return {
43
42
  // The toolbar button's label
@@ -46,21 +45,31 @@
46
45
  // A detached container. data-ge-container is what the
47
46
  // editor recognises: never a class, so restyling is free.
48
47
  create: function(options) {
49
- var callout = $('<div class="alert alert-primary" role="alert" />')
50
- .append($('<h4 class="alert-heading" />')
51
- .append($('<span class="ge-pane-label" />')
52
- .text(options.title || ge.t('container.callout_title'))))
53
- .append(ge.defaultRegion())
54
- ;
55
-
56
- return $('<div />').attr('data-ge-container', 'callout').append(callout);
48
+ var label = document.createElement('span');
49
+ label.className = 'ge-pane-label';
50
+ label.textContent = options.title || ge.t('container.callout_title');
51
+
52
+ var heading = document.createElement('h4');
53
+ heading.className = 'alert-heading';
54
+ heading.appendChild(label);
55
+
56
+ var callout = document.createElement('div');
57
+ callout.className = 'alert alert-primary';
58
+ callout.setAttribute('role', 'alert');
59
+ callout.appendChild(heading);
60
+ callout.appendChild(ge.defaultRegion());
61
+
62
+ var container = document.createElement('div');
63
+ container.setAttribute('data-ge-container', 'callout');
64
+ container.appendChild(callout);
65
+ return container;
57
66
  },
58
67
 
59
68
  // Editing furniture on, and off again. Anything mark()
60
69
  // adds, unmark() has to take away: what is left is what
61
70
  // getHtml hands back.
62
71
  mark: function(container) {
63
- ge.makeLabelEditable(ge.labelIn(container.find('.alert-heading')));
72
+ ge.makeLabelEditable(ge.labelIn(container.querySelector('.alert-heading')));
64
73
  },
65
74
 
66
75
  unmark: function(container) {
@@ -69,21 +78,26 @@
69
78
  };
70
79
  };
71
80
 
72
- })(jQuery);
81
+ })();
73
82
  </script>
74
83
 
75
84
  <script>
76
- $(function() {
85
+ document.addEventListener('DOMContentLoaded', function() {
77
86
  // Show the plugin written above as the page's own source
78
- $('#callout-source').text($('#callout-plugin').text().trim().replace(/^ {8}/gm, ''));
87
+ document.getElementById('callout-source').textContent =
88
+ document.getElementById('callout-plugin').textContent.trim().replace(/^ {8}/gm, '');
79
89
 
80
90
  function activePlugins() {
81
- return $('.plugin-choice:checked').map(function() { return this.value; }).get();
91
+ return Array.prototype.map.call(document.querySelectorAll('.plugin-choice:checked'), function(box) {
92
+ return box.value;
93
+ });
82
94
  }
83
95
 
84
96
  function start() {
85
- $('#myGrid').gridEditor('destroy');
86
- $('#myGrid').gridEditor({
97
+ var running = GridEditor.get('#myGrid');
98
+ if (running) { running.destroy(); }
99
+
100
+ new GridEditor('#myGrid', {
87
101
  new_row_layouts: [[12], [6, 6]],
88
102
  content_types: [],
89
103
 
@@ -92,16 +106,17 @@
92
106
  plugins: activePlugins(),
93
107
  });
94
108
 
95
- $('#in-use').text(activePlugins().join(', ') || 'none');
96
- $('#registered').text(
97
- Object.keys($.fn.gridEditor.containers).concat(
98
- Object.keys($.fn.gridEditor.features)).sort().join(', ')
99
- );
109
+ document.getElementById('in-use').textContent = activePlugins().join(', ') || 'none';
110
+ document.getElementById('registered').textContent =
111
+ Object.keys(GridEditor.containers).concat(
112
+ Object.keys(GridEditor.features)).sort().join(', ');
100
113
  }
101
114
 
102
- $('.plugin-choice').on('change', start);
103
- $('#output').on('click', function() {
104
- $('#html').text($('#myGrid').gridEditor('getHtml'));
115
+ document.querySelectorAll('.plugin-choice').forEach(function(box) {
116
+ box.addEventListener('change', start);
117
+ });
118
+ document.getElementById('output').addEventListener('click', function() {
119
+ document.getElementById('html').textContent = GridEditor.get('#myGrid').getHtml();
105
120
  });
106
121
 
107
122
  start();
@@ -7,7 +7,8 @@
7
7
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
9
 
10
- <!-- Javascript dependencies -->
10
+ <!-- Javascript dependencies. jQuery is summernote's: the editor itself
11
+ does not need it, and this page loads no jQuery adapter -->
11
12
  <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
12
13
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
13
14
 
@@ -20,14 +21,14 @@
20
21
  <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
21
22
  <!-- Grid editor javascript -->
22
23
  <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
23
- <script src="../dist/jquery.grideditor.min.js"></script>
24
+ <script src="../dist/grideditor.min.js"></script>
24
25
  <!-- The text editor is a plugin of its own, loaded after the editor -->
25
26
  <script src="../dist/plugins/grideditor.summernote.min.js"></script>
26
27
 
27
28
  <script>
28
- $(function() {
29
+ document.addEventListener('DOMContentLoaded', function() {
29
30
  // Initialize grid editor
30
- $('#myGrid').gridEditor({
31
+ var editor = new GridEditor('#myGrid', {
31
32
  new_row_layouts: [[12], [6, 6], [9, 3], [3, 9]],
32
33
  content_types: ['summernote'],
33
34
  summernote: {
@@ -43,7 +44,7 @@
43
44
  });
44
45
 
45
46
  // Get resulting html
46
- var html = $('#myGrid').gridEditor('getHtml');
47
+ var html = editor.getHtml();
47
48
  console.log(html);
48
49
  });
49
50
  </script>
@@ -8,7 +8,6 @@
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
9
 
10
10
  <!-- Javascript dependencies -->
11
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
12
11
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
13
12
 
14
13
  <!-- Grid editor CSS -->
@@ -17,7 +16,7 @@
17
16
  <!-- The editor, and the utility plugins. Each is a file of its own, and
18
17
  loading it is what puts its field in the settings panels. -->
19
18
  <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
20
- <script src="../dist/jquery.grideditor.min.js"></script>
19
+ <script src="../dist/grideditor.min.js"></script>
21
20
  <script src="../dist/plugins/grideditor.visibility.min.js"></script>
22
21
  <script src="../dist/plugins/grideditor.order.min.js"></script>
23
22
  <script src="../dist/plugins/grideditor.alignment.min.js"></script>
@@ -29,9 +28,12 @@
29
28
  <script src="../dist/plugins/grideditor.float.min.js"></script>
30
29
 
31
30
  <script>
32
- $(function() {
31
+ document.addEventListener('DOMContentLoaded', function() {
32
+ var grid = document.getElementById('myGrid');
33
+ var editor;
34
+
33
35
  function start(panel) {
34
- $('#myGrid').gridEditor({
36
+ editor = new GridEditor(grid, {
35
37
  new_row_layouts: [[12], [6,6], [4,4,4], [8,4]],
36
38
  content_types: [],
37
39
 
@@ -44,24 +46,26 @@
44
46
  settings_panel: panel,
45
47
  });
46
48
  }
47
- start($('#panel').val());
49
+ start(document.getElementById('panel').value);
48
50
 
49
51
  // The same canvas, started again with its settings elsewhere
50
- $('#panel').on('change', function() {
51
- var html = $('#myGrid').gridEditor('getHtml');
52
- $('#myGrid').gridEditor('destroy').html(html);
52
+ document.getElementById('panel').addEventListener('change', function() {
53
+ var html = editor.getHtml();
54
+ editor.destroy();
55
+ grid.innerHTML = html;
53
56
  start(this.value);
54
57
  });
55
58
 
56
59
  // Every change to a utility is announced, like any other operation
57
- $('#myGrid').on('grideditor:after-utility', function(e, payload) {
58
- $('#last').text(payload.family + ' at ' + payload.breakpoint + ': ' +
60
+ grid.addEventListener('grideditor:after-utility', function(e) {
61
+ var payload = e.detail;
62
+ document.getElementById('last').textContent = payload.family + ' at ' + payload.breakpoint + ': ' +
59
63
  (payload.from === null ? 'default' : payload.from) + ' → ' +
60
- (payload.to === null ? 'inherit' : payload.to));
64
+ (payload.to === null ? 'inherit' : payload.to);
61
65
  });
62
66
 
63
- $('#output').on('click', function() {
64
- $('#html').text($('#myGrid').gridEditor('getHtml'));
67
+ document.getElementById('output').addEventListener('click', function() {
68
+ document.getElementById('html').textContent = editor.getHtml();
65
69
  });
66
70
  });
67
71
  </script>
@@ -8,7 +8,6 @@
8
8
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
9
9
 
10
10
  <!-- Javascript dependencies -->
11
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
12
11
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
13
12
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.8.6/tinymce.min.js"></script>
14
13
 
@@ -16,21 +15,22 @@
16
15
  <link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
17
16
  <!-- Grid editor javascript -->
18
17
  <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
19
- <script src="../dist/jquery.grideditor.min.js"></script>
18
+ <script src="../dist/grideditor.min.js"></script>
20
19
  <!-- The text editor is a plugin of its own, loaded after the editor -->
21
20
  <script src="../dist/plugins/grideditor.tinymce.min.js"></script>
22
21
 
23
22
  <script>
24
- $(function() {
25
- var grid = $('#myGrid');
23
+ document.addEventListener('DOMContentLoaded', function() {
24
+ var grid = document.getElementById('myGrid');
25
+ var show = function(id, text) { document.getElementById(id).textContent = text.trim(); };
26
26
 
27
27
  // 1. The markup as the page wrote it, captured before the editor
28
28
  // touches it
29
- $('#before').text(grid.html().trim());
29
+ show('before', grid.innerHTML);
30
30
 
31
31
  // 2. The editor finds no .row in there, so it wraps everything
32
32
  // into one row with a single full-width column
33
- grid.gridEditor({
33
+ var editor = new GridEditor(grid, {
34
34
  new_row_layouts: [[12], [6, 6], [9, 3], [3, 9]],
35
35
  content_types: ['tinymce'],
36
36
  });
@@ -39,11 +39,11 @@
39
39
  // the marking the editor needs to read it back
40
40
  // 4. What getPlainHtml hands back: the same, without that marking
41
41
  function showResult() {
42
- $('#after').text(grid.gridEditor('getHtml').trim());
43
- $('#plain').text(grid.gridEditor('getPlainHtml').trim());
42
+ show('after', editor.getHtml());
43
+ show('plain', editor.getPlainHtml());
44
44
  }
45
45
  showResult();
46
- $('#refresh').on('click', showResult);
46
+ document.getElementById('refresh').addEventListener('click', showResult);
47
47
  });
48
48
  </script>
49
49
 
package/package.json CHANGED
@@ -3,29 +3,28 @@
3
3
  "build": "grunt",
4
4
  "lint": "eslint .",
5
5
  "start": "npm run watch",
6
- "test": "node test/run.js",
6
+ "test": "tsc -p test/types && node test/run.js",
7
7
  "test:vendor": "node test/vendor/update.js",
8
- "watch": "grunt watch"
8
+ "watch": "grunt watch",
9
+ "test:types": "tsc -p test/types"
9
10
  },
10
11
  "repository": {
11
12
  "type": "git",
12
13
  "url": "git+https://github.com/themarioga/grid-editor.git"
13
14
  },
14
15
  "devDependencies": {
16
+ "esbuild": "^0.28.2",
15
17
  "eslint": "^9.39.5",
16
18
  "grunt": "^1.6.3",
17
19
  "grunt-cli": "^1.5.0",
18
- "grunt-contrib-clean": "^2.0.1",
19
- "grunt-contrib-concat": "^2.1.0",
20
- "grunt-contrib-copy": "^1.0.0",
21
20
  "grunt-contrib-cssmin": "^5.0.0",
22
21
  "grunt-contrib-less": "^3.0.0",
23
- "grunt-contrib-uglify": "^5.2.2",
24
22
  "grunt-contrib-watch": "^1.1.0",
25
- "sortablejs": "^1.15.6"
23
+ "sortablejs": "^1.15.6",
24
+ "typescript": "^7.0.2"
26
25
  },
27
26
  "name": "@themarioga/grid-editor",
28
- "description": "Visual javascript editor for the bootstrap grid system, written as a jQuery plugin.",
27
+ "description": "Visual javascript editor for the bootstrap grid system, in plain DOM: no jQuery needed.",
29
28
  "bugs": {
30
29
  "url": "https://github.com/themarioga/grid-editor/issues"
31
30
  },
@@ -34,10 +33,44 @@
34
33
  "comment": "A scoped package publishes restricted unless it is told otherwise.",
35
34
  "access": "public"
36
35
  },
37
- "version": "6.0.0",
38
- "main": "dist/jquery.grideditor.js",
36
+ "version": "7.0.0",
37
+ "main": "dist/grideditor.js",
38
+ "module": "dist/grideditor.esm.js",
39
+ "types": "dist/grideditor.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/grideditor.d.ts",
43
+ "import": "./dist/grideditor.esm.js",
44
+ "default": "./dist/grideditor.js"
45
+ },
46
+ "./jquery": "./dist/grideditor.jquery.js",
47
+ "./plugins/*": {
48
+ "import": "./dist/plugins/grideditor.*.esm.js",
49
+ "default": "./dist/plugins/grideditor.*.js"
50
+ },
51
+ "./locales/*": {
52
+ "import": "./dist/locales/grideditor.*.esm.js",
53
+ "default": "./dist/locales/grideditor.*.js"
54
+ },
55
+ "./css": "./dist/grideditor.css",
56
+ "./css/min": "./dist/grideditor.min.css",
57
+ "./dist/*": "./dist/*",
58
+ "./package.json": "./package.json"
59
+ },
60
+ "sideEffects": [
61
+ "./dist/plugins/*",
62
+ "./dist/locales/*",
63
+ "./dist/grideditor.js",
64
+ "./dist/grideditor.min.js",
65
+ "./dist/grideditor.bundle.min.js",
66
+ "./dist/grideditor.jquery.js",
67
+ "./dist/grideditor.jquery.min.js",
68
+ "*.css",
69
+ "./src/js/**/*.js"
70
+ ],
39
71
  "files": [
40
72
  "dist",
73
+ "types",
41
74
  "src",
42
75
  "docs",
43
76
  "example",
@@ -50,8 +83,6 @@
50
83
  "example": "example"
51
84
  },
52
85
  "keywords": [
53
- "jquery-plugin",
54
- "ecosystem:jquery",
55
86
  "bootstrap5",
56
87
  "grid",
57
88
  "bootstrap-grid",