@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.
- package/AUTO_SAVE.md +2 -2
- package/BUILDING.md +45 -29
- package/CHANGELOG.md +47 -0
- package/README.md +137 -85
- package/UPGRADING.md +119 -0
- package/dist/grideditor.bundle.min.js +14 -0
- package/dist/grideditor.d.ts +335 -0
- package/dist/grideditor.esm.js +3977 -0
- package/dist/grideditor.jquery.js +253 -0
- package/dist/grideditor.jquery.min.js +1 -0
- package/dist/grideditor.jquery.min.js.map +7 -0
- package/dist/grideditor.js +3983 -0
- package/dist/grideditor.min.js +6 -0
- package/dist/grideditor.min.js.map +7 -0
- package/dist/locales/grideditor.es.esm.js +158 -0
- package/dist/locales/grideditor.es.js +164 -168
- package/dist/locales/grideditor.es.min.js +6 -2
- package/dist/locales/grideditor.es.min.js.map +7 -1
- package/dist/plugins/grideditor.accordion.esm.js +294 -0
- package/dist/plugins/grideditor.accordion.js +286 -180
- package/dist/plugins/grideditor.accordion.min.js +1 -2
- package/dist/plugins/grideditor.accordion.min.js.map +7 -1
- package/dist/plugins/grideditor.alignment.esm.js +55 -0
- package/dist/plugins/grideditor.alignment.js +58 -77
- package/dist/plugins/grideditor.alignment.min.js +1 -2
- package/dist/plugins/grideditor.alignment.min.js.map +7 -1
- package/dist/plugins/grideditor.card.esm.js +73 -0
- package/dist/plugins/grideditor.card.js +74 -64
- package/dist/plugins/grideditor.card.min.js +1 -2
- package/dist/plugins/grideditor.card.min.js.map +7 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +500 -0
- package/dist/plugins/grideditor.ckeditor.js +484 -449
- package/dist/plugins/grideditor.ckeditor.min.js +1 -2
- package/dist/plugins/grideditor.ckeditor.min.js.map +7 -1
- package/dist/plugins/grideditor.clipboard.esm.js +326 -0
- package/dist/plugins/grideditor.clipboard.js +298 -235
- package/dist/plugins/grideditor.clipboard.min.js +1 -2
- package/dist/plugins/grideditor.clipboard.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror-inline.esm.js +205 -0
- package/dist/plugins/grideditor.codemirror-inline.js +188 -168
- package/dist/plugins/grideditor.codemirror-inline.min.js +1 -2
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +7 -1
- package/dist/plugins/grideditor.codemirror.esm.js +63 -0
- package/dist/plugins/grideditor.codemirror.js +60 -71
- package/dist/plugins/grideditor.codemirror.min.js +1 -2
- package/dist/plugins/grideditor.codemirror.min.js.map +7 -1
- package/dist/plugins/grideditor.elements.esm.js +271 -0
- package/dist/plugins/grideditor.elements.js +256 -149
- package/dist/plugins/grideditor.elements.min.js +1 -2
- package/dist/plugins/grideditor.elements.min.js.map +7 -1
- package/dist/plugins/grideditor.float.esm.js +34 -0
- package/dist/plugins/grideditor.float.js +37 -52
- package/dist/plugins/grideditor.float.min.js +1 -2
- package/dist/plugins/grideditor.float.min.js.map +7 -1
- package/dist/plugins/grideditor.gutters.esm.js +143 -0
- package/dist/plugins/grideditor.gutters.js +134 -131
- package/dist/plugins/grideditor.gutters.min.js +1 -2
- package/dist/plugins/grideditor.gutters.min.js.map +7 -1
- package/dist/plugins/grideditor.order.esm.js +189 -0
- package/dist/plugins/grideditor.order.js +170 -182
- package/dist/plugins/grideditor.order.min.js +1 -2
- package/dist/plugins/grideditor.order.min.js.map +7 -1
- package/dist/plugins/grideditor.popup.esm.js +187 -0
- package/dist/plugins/grideditor.popup.js +183 -134
- package/dist/plugins/grideditor.popup.min.js +1 -2
- package/dist/plugins/grideditor.popup.min.js.map +7 -1
- package/dist/plugins/grideditor.sections.esm.js +271 -0
- package/dist/plugins/grideditor.sections.js +250 -173
- package/dist/plugins/grideditor.sections.min.js +1 -2
- package/dist/plugins/grideditor.sections.min.js.map +7 -1
- package/dist/plugins/grideditor.spacing.esm.js +318 -0
- package/dist/plugins/grideditor.spacing.js +296 -272
- package/dist/plugins/grideditor.spacing.min.js +1 -2
- package/dist/plugins/grideditor.spacing.min.js.map +7 -1
- package/dist/plugins/grideditor.summernote.esm.js +509 -0
- package/dist/plugins/grideditor.summernote.js +493 -427
- package/dist/plugins/grideditor.summernote.min.js +1 -2
- package/dist/plugins/grideditor.summernote.min.js.map +7 -1
- package/dist/plugins/grideditor.tabs.esm.js +237 -0
- package/dist/plugins/grideditor.tabs.js +233 -139
- package/dist/plugins/grideditor.tabs.min.js +1 -2
- package/dist/plugins/grideditor.tabs.min.js.map +7 -1
- package/dist/plugins/grideditor.textalign.esm.js +40 -0
- package/dist/plugins/grideditor.textalign.js +43 -56
- package/dist/plugins/grideditor.textalign.min.js +1 -2
- package/dist/plugins/grideditor.textalign.min.js.map +7 -1
- package/dist/plugins/grideditor.tinymce.esm.js +519 -0
- package/dist/plugins/grideditor.tinymce.js +502 -490
- package/dist/plugins/grideditor.tinymce.min.js +1 -2
- package/dist/plugins/grideditor.tinymce.min.js.map +7 -1
- package/dist/plugins/grideditor.visibility.esm.js +158 -0
- package/dist/plugins/grideditor.visibility.js +140 -149
- package/dist/plugins/grideditor.visibility.min.js +1 -2
- package/dist/plugins/grideditor.visibility.min.js.map +7 -1
- package/docs/events.md +47 -21
- package/docs/locale-keys.md +6 -0
- package/docs/plugins.md +47 -25
- package/example/adapter.html +112 -0
- package/example/attributes.html +85 -61
- package/example/autocols.html +9 -9
- package/example/autosave.html +13 -14
- package/example/basic.html +4 -5
- package/example/breakpoints.html +5 -6
- package/example/ckeditor.html +4 -5
- package/example/clipboard.html +11 -10
- package/example/codemirror.html +9 -7
- package/example/containers.html +7 -8
- package/example/custom_editor.html +53 -34
- package/example/elements.html +10 -11
- package/example/index.html +16 -2
- package/example/locale.html +6 -7
- package/example/plugins.html +44 -29
- package/example/summernote.html +6 -5
- package/example/utilities.html +17 -13
- package/example/wrap_content.html +9 -9
- package/package.json +43 -12
- package/src/js/dom.js +401 -0
- package/src/js/grideditor.classic.js +16 -0
- package/src/js/grideditor.jquery.js +325 -0
- package/src/js/{jquery.grideditor.js → grideditor.js} +1284 -1124
- package/src/js/locales/grideditor.es.js +163 -156
- package/src/js/plugins/grideditor.accordion.js +97 -77
- package/src/js/plugins/grideditor.alignment.js +5 -7
- package/src/js/plugins/grideditor.card.js +23 -23
- package/src/js/plugins/grideditor.ckeditor.js +107 -106
- package/src/js/plugins/grideditor.clipboard.js +49 -37
- package/src/js/plugins/grideditor.codemirror-inline.js +50 -37
- package/src/js/plugins/grideditor.codemirror.js +9 -10
- package/src/js/plugins/grideditor.elements.js +57 -33
- package/src/js/plugins/grideditor.float.js +4 -6
- package/src/js/plugins/grideditor.gutters.js +20 -15
- package/src/js/plugins/grideditor.order.js +28 -25
- package/src/js/plugins/grideditor.popup.js +63 -51
- package/src/js/plugins/grideditor.sections.js +39 -32
- package/src/js/plugins/grideditor.spacing.js +42 -45
- package/src/js/plugins/grideditor.summernote.js +112 -76
- package/src/js/plugins/grideditor.tabs.js +65 -57
- package/src/js/plugins/grideditor.textalign.js +4 -6
- package/src/js/plugins/grideditor.tinymce.js +147 -139
- package/src/js/plugins/grideditor.visibility.js +24 -25
- package/src/js/register.js +18 -0
- package/src/js/text/grideditor.text.js +77 -56
- package/types/grideditor.d.ts +335 -0
- package/dist/jquery.grideditor.bundle.min.js +0 -10
- package/dist/jquery.grideditor.js +0 -4927
- package/dist/jquery.grideditor.min.js +0 -2
- package/dist/jquery.grideditor.min.js.map +0 -1
package/example/locale.html
CHANGED
|
@@ -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
|
|
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/
|
|
18
|
+
<script src="../dist/grideditor.min.js"></script>
|
|
20
19
|
<script src="../dist/locales/grideditor.es.js"></script>
|
|
21
20
|
|
|
22
21
|
<script>
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
36
|
-
|
|
34
|
+
document.getElementById('language').addEventListener('change', function() {
|
|
35
|
+
editor.setLocale(this.value);
|
|
37
36
|
});
|
|
38
37
|
});
|
|
39
38
|
</script>
|
package/example/plugins.html
CHANGED
|
@@ -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/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
;
|
|
55
|
-
|
|
56
|
-
|
|
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.
|
|
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
|
-
})(
|
|
81
|
+
})();
|
|
73
82
|
</script>
|
|
74
83
|
|
|
75
84
|
<script>
|
|
76
|
-
|
|
85
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
77
86
|
// Show the plugin written above as the page's own source
|
|
78
|
-
|
|
87
|
+
document.getElementById('callout-source').textContent =
|
|
88
|
+
document.getElementById('callout-plugin').textContent.trim().replace(/^ {8}/gm, '');
|
|
79
89
|
|
|
80
90
|
function activePlugins() {
|
|
81
|
-
return
|
|
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
|
-
|
|
86
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
Object.keys(
|
|
98
|
-
Object.keys(
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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();
|
package/example/summernote.html
CHANGED
|
@@ -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/
|
|
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
|
-
|
|
29
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
29
30
|
// Initialize grid editor
|
|
30
|
-
|
|
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 =
|
|
47
|
+
var html = editor.getHtml();
|
|
47
48
|
console.log(html);
|
|
48
49
|
});
|
|
49
50
|
</script>
|
package/example/utilities.html
CHANGED
|
@@ -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/
|
|
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
|
-
|
|
31
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
32
|
+
var grid = document.getElementById('myGrid');
|
|
33
|
+
var editor;
|
|
34
|
+
|
|
33
35
|
function start(panel) {
|
|
34
|
-
|
|
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(
|
|
49
|
+
start(document.getElementById('panel').value);
|
|
48
50
|
|
|
49
51
|
// The same canvas, started again with its settings elsewhere
|
|
50
|
-
|
|
51
|
-
var html =
|
|
52
|
-
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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/
|
|
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
|
-
|
|
25
|
-
var grid =
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
43
|
-
|
|
42
|
+
show('after', editor.getHtml());
|
|
43
|
+
show('plain', editor.getPlainHtml());
|
|
44
44
|
}
|
|
45
45
|
showResult();
|
|
46
|
-
|
|
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,
|
|
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": "
|
|
38
|
-
"main": "dist/
|
|
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",
|