@themarioga/grid-editor 4.1.0 → 5.1.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/CHANGELOG.md +80 -0
- package/README.md +131 -10
- package/UPGRADING.md +55 -0
- package/dist/grideditor.css +466 -0
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/jquery.grideditor.bundle.min.js +2 -2
- package/dist/jquery.grideditor.js +741 -126
- package/dist/jquery.grideditor.min.js +1 -1
- package/dist/jquery.grideditor.min.js.map +1 -1
- package/dist/locales/grideditor.es.js +30 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +1 -1
- package/dist/plugins/grideditor.clipboard.js +274 -0
- package/dist/plugins/grideditor.clipboard.min.js +2 -0
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -0
- package/dist/plugins/grideditor.float.js +56 -0
- package/dist/plugins/grideditor.float.min.js +2 -0
- package/dist/plugins/grideditor.float.min.js.map +1 -0
- package/dist/plugins/grideditor.sections.js +199 -0
- package/dist/plugins/grideditor.sections.min.js +2 -0
- package/dist/plugins/grideditor.sections.min.js.map +1 -0
- package/dist/plugins/grideditor.textalign.js +60 -0
- package/dist/plugins/grideditor.textalign.min.js +2 -0
- package/dist/plugins/grideditor.textalign.min.js.map +1 -0
- package/docs/events.md +17 -3
- package/docs/locale-keys.md +49 -1
- package/docs/plugins.md +45 -3
- package/example/autocols.html +137 -0
- package/example/breakpoints.html +7 -5
- package/example/clipboard.html +99 -0
- package/example/index.html +24 -2
- package/example/utilities.html +22 -1
- package/example/wrap_content.html +66 -16
- package/package.json +1 -1
- package/src/js/jquery.grideditor.js +742 -127
- package/src/js/locales/grideditor.es.js +30 -0
- package/src/js/plugins/grideditor.clipboard.js +274 -0
- package/src/js/plugins/grideditor.float.js +56 -0
- package/src/js/plugins/grideditor.sections.js +199 -0
- package/src/js/plugins/grideditor.textalign.js +60 -0
- package/src/less/grideditor.less +138 -0
|
@@ -2,37 +2,50 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
<!-- CSS dependencies -->
|
|
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
10
|
<!-- Javascript dependencies -->
|
|
11
11
|
<script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
|
|
12
12
|
<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
13
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.8.6/tinymce.min.js"></script>
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
<!-- Grid editor CSS -->
|
|
16
16
|
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
17
17
|
<!-- Grid editor javascript -->
|
|
18
18
|
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
19
19
|
<script src="../dist/jquery.grideditor.min.js"></script>
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
<script>
|
|
22
22
|
$(function() {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var grid = $('#myGrid');
|
|
24
|
+
|
|
25
|
+
// 1. The markup as the page wrote it, captured before the editor
|
|
26
|
+
// touches it
|
|
27
|
+
$('#before').text(grid.html().trim());
|
|
28
|
+
|
|
29
|
+
// 2. The editor finds no .row in there, so it wraps everything
|
|
30
|
+
// into one row with a single full-width column
|
|
31
|
+
grid.gridEditor({
|
|
25
32
|
new_row_layouts: [[12], [6, 6], [9, 3], [3, 9]],
|
|
26
33
|
content_types: ['tinymce'],
|
|
27
34
|
});
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
|
|
36
|
+
// 3. What getHtml hands back: the same content, now a grid, with
|
|
37
|
+
// the marking the editor needs to read it back
|
|
38
|
+
// 4. What getPlainHtml hands back: the same, without that marking
|
|
39
|
+
function showResult() {
|
|
40
|
+
$('#after').text(grid.gridEditor('getHtml').trim());
|
|
41
|
+
$('#plain').text(grid.gridEditor('getPlainHtml').trim());
|
|
42
|
+
}
|
|
43
|
+
showResult();
|
|
44
|
+
$('#refresh').on('click', showResult);
|
|
32
45
|
});
|
|
33
46
|
</script>
|
|
34
|
-
|
|
35
|
-
<title>Grid Editor example</title>
|
|
47
|
+
|
|
48
|
+
<title>Grid Editor example - wrapped content</title>
|
|
36
49
|
</head>
|
|
37
50
|
<body>
|
|
38
51
|
<!-- Back to the demo index -->
|
|
@@ -40,10 +53,47 @@
|
|
|
40
53
|
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
41
54
|
</div>
|
|
42
55
|
|
|
43
|
-
<div
|
|
44
|
-
<
|
|
45
|
-
<p>
|
|
56
|
+
<div class="container py-3">
|
|
57
|
+
<h2>Wrapped content</h2>
|
|
58
|
+
<p class="text-body-secondary">
|
|
59
|
+
The editor below was started on plain markup — a heading, a
|
|
60
|
+
paragraph and a list, with no <code>.row</code> or
|
|
61
|
+
<code>.col-*</code> anywhere. Grid editor does not refuse it: it
|
|
62
|
+
wraps all of it into one row with a single
|
|
63
|
+
<code>col-lg-12</code> column, and from there it is an ordinary
|
|
64
|
+
grid. Add rows, split the column, edit the text, then press
|
|
65
|
+
<em>Refresh</em> to see the html that comes out: as
|
|
66
|
+
<code>getHtml</code> returns it, to save and edit again, and as
|
|
67
|
+
<code>getPlainHtml</code> returns it, to publish.
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<h5 class="mt-4">1. The markup in the page</h5>
|
|
71
|
+
<pre class="bg-body-tertiary border rounded p-3 small"><code id="before"></code></pre>
|
|
72
|
+
|
|
73
|
+
<h5 class="mt-4">2. The editor, started on that markup</h5>
|
|
74
|
+
<div id="myGrid">
|
|
75
|
+
<h1>Hello!</h1>
|
|
76
|
+
<p>This page was written as plain html, with no Bootstrap grid.</p>
|
|
77
|
+
<ul>
|
|
78
|
+
<li>No row</li>
|
|
79
|
+
<li>No column</li>
|
|
80
|
+
</ul>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<h5 class="mt-4 d-flex align-items-center gap-2">
|
|
84
|
+
3. The result of <code>getHtml</code>
|
|
85
|
+
<button id="refresh" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-clockwise"></i> Refresh</button>
|
|
86
|
+
</h5>
|
|
87
|
+
<pre class="bg-body-tertiary border rounded p-3 small"><code id="after"></code></pre>
|
|
88
|
+
|
|
89
|
+
<h5 class="mt-4">4. The result of <code>getPlainHtml</code></h5>
|
|
90
|
+
<p class="text-body-secondary small">
|
|
91
|
+
The same markup without the editor’s <code>ge-*</code> classes,
|
|
92
|
+
<code>column</code> class and <code>data-ge-*</code> attributes.
|
|
93
|
+
For publishing: the editor cannot read it back as it was.
|
|
94
|
+
</p>
|
|
95
|
+
<pre class="bg-body-tertiary border rounded p-3 small"><code id="plain"></code></pre>
|
|
46
96
|
</div>
|
|
47
97
|
|
|
48
98
|
</body>
|
|
49
|
-
</html>
|
|
99
|
+
</html>
|