@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +131 -10
  3. package/UPGRADING.md +55 -0
  4. package/dist/grideditor.css +466 -0
  5. package/dist/grideditor.min.css +1 -1
  6. package/dist/grideditor.min.css.map +1 -1
  7. package/dist/jquery.grideditor.bundle.min.js +2 -2
  8. package/dist/jquery.grideditor.js +741 -126
  9. package/dist/jquery.grideditor.min.js +1 -1
  10. package/dist/jquery.grideditor.min.js.map +1 -1
  11. package/dist/locales/grideditor.es.js +30 -0
  12. package/dist/locales/grideditor.es.min.js +1 -1
  13. package/dist/locales/grideditor.es.min.js.map +1 -1
  14. package/dist/plugins/grideditor.clipboard.js +274 -0
  15. package/dist/plugins/grideditor.clipboard.min.js +2 -0
  16. package/dist/plugins/grideditor.clipboard.min.js.map +1 -0
  17. package/dist/plugins/grideditor.float.js +56 -0
  18. package/dist/plugins/grideditor.float.min.js +2 -0
  19. package/dist/plugins/grideditor.float.min.js.map +1 -0
  20. package/dist/plugins/grideditor.sections.js +199 -0
  21. package/dist/plugins/grideditor.sections.min.js +2 -0
  22. package/dist/plugins/grideditor.sections.min.js.map +1 -0
  23. package/dist/plugins/grideditor.textalign.js +60 -0
  24. package/dist/plugins/grideditor.textalign.min.js +2 -0
  25. package/dist/plugins/grideditor.textalign.min.js.map +1 -0
  26. package/docs/events.md +17 -3
  27. package/docs/locale-keys.md +49 -1
  28. package/docs/plugins.md +45 -3
  29. package/example/autocols.html +137 -0
  30. package/example/breakpoints.html +7 -5
  31. package/example/clipboard.html +99 -0
  32. package/example/index.html +24 -2
  33. package/example/utilities.html +22 -1
  34. package/example/wrap_content.html +66 -16
  35. package/package.json +1 -1
  36. package/src/js/jquery.grideditor.js +742 -127
  37. package/src/js/locales/grideditor.es.js +30 -0
  38. package/src/js/plugins/grideditor.clipboard.js +274 -0
  39. package/src/js/plugins/grideditor.float.js +56 -0
  40. package/src/js/plugins/grideditor.sections.js +199 -0
  41. package/src/js/plugins/grideditor.textalign.js +60 -0
  42. 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
- // Initialize grid editor
24
- $('#myGrid').gridEditor({
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
- // Get resulting html
30
- var html = $('#myGrid').gridEditor('getHtml');
31
- console.log(html);
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 id="myGrid">
44
- <h1>Hello!</h1>
45
- <p>Test</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 &mdash; 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&rsquo;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>
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "comment": "A scoped package publishes restricted unless it is told otherwise.",
35
35
  "access": "public"
36
36
  },
37
- "version": "4.1.0",
37
+ "version": "5.1.0",
38
38
  "main": "dist/jquery.grideditor.js",
39
39
  "files": [
40
40
  "dist",