@themarioga/grid-editor 9.0.0-beta.6 → 9.0.0-beta.8
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 +38 -0
- package/README.md +54 -27
- package/UPGRADING.md +1 -1
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +24 -3
- package/dist/grideditor.d.ts +27 -2
- package/dist/grideditor.esm.js +64 -7
- package/dist/grideditor.js +64 -7
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +2 -0
- package/dist/locales/grideditor.es.js +2 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.esm.js +9 -0
- package/dist/plugins/grideditor.accordion.js +9 -0
- package/dist/plugins/grideditor.accordion.min.js +1 -1
- package/dist/plugins/grideditor.accordion.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js +1 -1
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.carousel.esm.js +3 -0
- package/dist/plugins/grideditor.carousel.js +3 -0
- package/dist/plugins/grideditor.carousel.min.js +1 -1
- package/dist/plugins/grideditor.carousel.min.js.map +3 -3
- package/dist/plugins/grideditor.ckeditor.esm.js +9 -0
- package/dist/plugins/grideditor.ckeditor.js +9 -0
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.esm.js +44 -7
- package/dist/plugins/grideditor.clipboard.js +44 -7
- package/dist/plugins/grideditor.clipboard.min.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.esm.js +3 -0
- package/dist/plugins/grideditor.elements.js +3 -0
- package/dist/plugins/grideditor.elements.min.js +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +3 -3
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.history.esm.js +1 -1
- package/dist/plugins/grideditor.history.js +1 -1
- package/dist/plugins/grideditor.history.min.js +1 -1
- package/dist/plugins/grideditor.history.min.js.map +2 -2
- package/dist/plugins/grideditor.inline-style.esm.js +66 -3
- package/dist/plugins/grideditor.inline-style.js +66 -3
- package/dist/plugins/grideditor.inline-style.min.js +4 -4
- package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
- package/dist/plugins/grideditor.offcanvas.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.esm.js +9 -0
- package/dist/plugins/grideditor.sections.js +9 -0
- package/dist/plugins/grideditor.sections.min.js +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +3 -3
- package/dist/plugins/grideditor.summernote.esm.js +9 -0
- package/dist/plugins/grideditor.summernote.js +9 -0
- package/dist/plugins/grideditor.summernote.min.js +1 -1
- package/dist/plugins/grideditor.summernote.min.js.map +3 -3
- package/dist/plugins/grideditor.tabs.esm.js +3 -0
- package/dist/plugins/grideditor.tabs.js +3 -0
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/dist/plugins/grideditor.tinymce.esm.js +9 -0
- package/dist/plugins/grideditor.tinymce.js +9 -0
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +6 -1
- package/docs/locale-keys.md +2 -0
- package/docs/plugins.md +9 -7
- package/example/adapter.html +11 -1
- package/example/clipboard.html +7 -4
- package/example/{autocols.html → columns.html} +61 -20
- package/example/containers.html +13 -2
- package/example/{attributes.html → custom-plugins.html} +130 -12
- package/example/elements.html +13 -2
- package/example/history.html +6 -3
- package/example/index.html +30 -81
- package/example/playground.html +840 -0
- package/example/style.html +291 -0
- package/example/text-editors.html +320 -0
- package/package.json +1 -1
- package/src/js/dom.js +6 -0
- package/src/js/grideditor.js +69 -7
- package/src/js/inline-style/accordion.js +4 -3
- package/src/js/inline-style/fields.js +56 -3
- package/src/js/inline-style/options.js +12 -0
- package/src/js/locales/grideditor.es.js +2 -0
- package/src/js/plugins/grideditor.clipboard.js +61 -11
- package/src/js/plugins/grideditor.history.js +3 -3
- package/src/js/plugins/grideditor.inline-style.js +10 -0
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +26 -3
- package/types/grideditor.d.ts +27 -2
- package/example/breakpoints.html +0 -100
- package/example/ckeditor.html +0 -110
- package/example/custom_editor.html +0 -212
- package/example/inline-style.html +0 -163
- package/example/plugins.html +0 -251
- package/example/summernote.html +0 -114
- package/example/utilities.html +0 -200
package/example/breakpoints.html
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
|
|
6
|
-
<!-- CSS dependencies -->
|
|
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
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
|
|
9
|
-
|
|
10
|
-
<!-- Javascript dependencies -->
|
|
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>
|
|
12
|
-
|
|
13
|
-
<!-- Grid editor CSS -->
|
|
14
|
-
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
|
-
<!-- Grid editor javascript -->
|
|
16
|
-
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
17
|
-
<script src="../dist/grideditor.min.js"></script>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
21
|
-
var editor = new GridEditor('#myGrid', {
|
|
22
|
-
new_row_layouts: [[12], [6,6], [4,4,4], [8,4]],
|
|
23
|
-
content_types: [],
|
|
24
|
-
|
|
25
|
-
// The default: a size or offset change is written once, as the
|
|
26
|
-
// class with no breakpoint, and replaces what the breakpoints
|
|
27
|
-
// said. Switch the dropdown to a single breakpoint to tune
|
|
28
|
-
// that one on its own.
|
|
29
|
-
default_view: 'all',
|
|
30
|
-
|
|
31
|
-
// A host that wants the old three-mode feel can offer three
|
|
32
|
-
// layout_modes: ['all', 'lg', 'sm', 'xs'],
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
document.getElementById('output').addEventListener('click', function() {
|
|
36
|
-
document.getElementById('html').textContent = editor.getHtml();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<title>Grid Editor breakpoints example</title>
|
|
42
|
-
</head>
|
|
43
|
-
<body>
|
|
44
|
-
<!-- Back to the demo index -->
|
|
45
|
-
<div class="container pt-3">
|
|
46
|
-
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<div class="container">
|
|
51
|
-
|
|
52
|
-
<div class="row my-3">
|
|
53
|
-
<div class="col-lg-8">
|
|
54
|
-
<h1 class="h4">Six breakpoints, and "all sizes"</h1>
|
|
55
|
-
<p class="form-text">
|
|
56
|
-
The dropdown on the right of the toolbar picks the layout
|
|
57
|
-
mode. In <strong>All sizes</strong> the canvas renders as
|
|
58
|
-
the browser would, and the width and indent tools write one
|
|
59
|
-
class for every size (<code>col-4</code>), replacing what
|
|
60
|
-
the breakpoints had. Pick a single breakpoint and the
|
|
61
|
-
canvas narrows to that tier's width, that tier's classes
|
|
62
|
-
become the effective ones whatever your window is doing,
|
|
63
|
-
and the tools write only that tier.
|
|
64
|
-
</p>
|
|
65
|
-
<p class="form-text">
|
|
66
|
-
The row below starts with a different size per tier, so
|
|
67
|
-
switching modes visibly changes it: 3 units on phone, 4 on
|
|
68
|
-
tablet, 6 on desktop, 8 on widescreen. The second row shows
|
|
69
|
-
offsets, which are indented per tier in the same way.
|
|
70
|
-
</p>
|
|
71
|
-
<button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
|
|
72
|
-
<pre id="html" class="form-text"></pre>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div id="myGrid">
|
|
77
|
-
|
|
78
|
-
<div class="row">
|
|
79
|
-
<div class="col-3 col-sm-4 col-md-5 col-lg-6 col-xl-7 col-xxl-8">
|
|
80
|
-
<h2 class="h5">Sized per tier</h2>
|
|
81
|
-
<p>3 on phone, 4 on tablet, 5 on small desktop, 6 on desktop, 7 on large, 8 on widescreen.</p>
|
|
82
|
-
</div>
|
|
83
|
-
<div class="col-9 col-sm-8 col-md-7 col-lg-6 col-xl-5 col-xxl-4">
|
|
84
|
-
<h2 class="h5">And the rest of the row</h2>
|
|
85
|
-
<p>The two columns always add up to twelve units.</p>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div class="row">
|
|
90
|
-
<div class="col-8 offset-2 col-lg-4 offset-lg-8">
|
|
91
|
-
<h2 class="h5">Indented</h2>
|
|
92
|
-
<p>Centred on phone, pushed to the right on desktop.</p>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
</div> <!-- /#myGrid -->
|
|
97
|
-
</div> <!-- /.container -->
|
|
98
|
-
|
|
99
|
-
</body>
|
|
100
|
-
</html>
|
package/example/ckeditor.html
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
|
|
6
|
-
<!-- CSS dependencies -->
|
|
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
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
|
|
9
|
-
|
|
10
|
-
<!-- Javascript dependencies -->
|
|
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>
|
|
12
|
-
|
|
13
|
-
<!-- CKEditor 5: its browser build, and its stylesheet -->
|
|
14
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ckeditor5@48.5.2/dist/browser/ckeditor5.css">
|
|
15
|
-
<script src="https://cdn.jsdelivr.net/npm/ckeditor5@48.5.2/dist/browser/ckeditor5.umd.js"></script>
|
|
16
|
-
|
|
17
|
-
<!-- Grid editor CSS -->
|
|
18
|
-
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
19
|
-
<!-- Grid editor javascript -->
|
|
20
|
-
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
21
|
-
<script src="../dist/grideditor.min.js"></script>
|
|
22
|
-
<!-- The text editor is a plugin of its own, loaded after the editor -->
|
|
23
|
-
<script src="../dist/plugins/grideditor.ckeditor.min.js"></script>
|
|
24
|
-
|
|
25
|
-
<script>
|
|
26
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
27
|
-
// Initialize grid editor
|
|
28
|
-
var editor = new GridEditor('#myGrid', {
|
|
29
|
-
new_row_layouts: [[12], [6, 6], [9, 3]],
|
|
30
|
-
content_types: ['ckeditor'],
|
|
31
|
-
ckeditor: {
|
|
32
|
-
// Anything InlineEditor.create takes, over the plugin's
|
|
33
|
-
// own defaults: its plugins, toolbar and headings
|
|
34
|
-
config: {
|
|
35
|
-
// CKEditor 5 is GPL-2.0-or-later: 'GPL' accepts that
|
|
36
|
-
// licence. A commercial licence passes its own key.
|
|
37
|
-
licenseKey: 'GPL',
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Get resulting html
|
|
43
|
-
var html = editor.getHtml();
|
|
44
|
-
console.log(html);
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<title>Grid Editor example</title>
|
|
49
|
-
</head>
|
|
50
|
-
<body>
|
|
51
|
-
<!-- Back to the demo index -->
|
|
52
|
-
<div class="container pt-3">
|
|
53
|
-
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<div class="container">
|
|
58
|
-
<div id="myGrid">
|
|
59
|
-
|
|
60
|
-
<div class="row">
|
|
61
|
-
<div class="col-md-12">
|
|
62
|
-
<h1>Lorem ipsum dolor sit amet, consectetur</h1>
|
|
63
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit exercitationem eaque aperiam rem quia quibusdam dolor ducimus quo similique eos pariatur nostrum aliquam nam eius, doloremque quis voluptatum unde. Porro voluptates aspernatur voluptate ipsam, magni vero. Accusamus, iusto tempore id!</p>
|
|
64
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quae laboriosam, excepturi quas.</p>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="row">
|
|
69
|
-
<div class="col-md-4">
|
|
70
|
-
<h2>Lorem ipsum dolor</h2>
|
|
71
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea facilis vel aliquam aspernatur dolor placeat totam saepe perferendis. Odio quia vel sed eveniet cupiditate, illum doloremque sint veniam eum? Corporis?</p>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="col-md-4">
|
|
74
|
-
<h2>Pariatur reprehenderit</h2>
|
|
75
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo adipisci ipsa, consequuntur cum, sunt dolores veniam. Enim inventore in dolore deserunt vitae sequi nemo!</p>
|
|
76
|
-
</div>
|
|
77
|
-
<div class="col-md-4">
|
|
78
|
-
<h2>Pariatur reprehenderit</h2>
|
|
79
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea excepturi ducimus numquam aut error corporis aspernatur ipsum quos eius culpa!</p>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<div class="row">
|
|
84
|
-
<div class="col-md-8">
|
|
85
|
-
<h2>Lorem ipsum dolor.</h2>
|
|
86
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro distinctio atque molestiae optio, consequuntur? Iusto ratione cumque dolor aut dolore!</p>
|
|
87
|
-
|
|
88
|
-
<div class="row">
|
|
89
|
-
<div class="col-md-6">
|
|
90
|
-
<hr>
|
|
91
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis facilis molestias voluptatum laudantium fuga ratione tempora rem dolor dicta rerum vero ut, suscipit ex qui amet quam vel cupiditate quaerat minus assumenda reiciendis, similique omnis delectus! Autem, repudiandae cumque eaque?</p>
|
|
92
|
-
</div>
|
|
93
|
-
<div class="col-md-6">
|
|
94
|
-
<hr>
|
|
95
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet molestiae quaerat illum, consequuntur iusto aspernatur quam provident? Possimus!</p>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<div class="col-md-4">
|
|
101
|
-
<h2>Lusto ratione</h2>
|
|
102
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis fugit quasi officiis id laudantium error aut ut aperiam dicta saepe non vel, cupiditate illum ipsam velit deleniti natus incidunt impedit molestias dolore quos dolores enim. Aliquid ipsam eaque consequuntur quaerat, suscipit a in. Praesentium repudiandae quibusdam recusandae sequi eligendi quos, dignissimos, officiis officia minima necessitatibus eaque consequatur in id adipisci qui minus voluptatum quae debitis, quas maxime iure. Tempore vero unde quia reiciendis ad beatae voluptate omnis, ipsa expedita ab, quasi, neque. Doloribus, pariatur. Aut hic voluptate.</p>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
</div> <!-- /#myGrid -->
|
|
107
|
-
</div> <!-- /.container -->
|
|
108
|
-
|
|
109
|
-
</body>
|
|
110
|
-
</html>
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
|
|
6
|
-
<!-- CSS dependencies -->
|
|
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
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
|
|
9
|
-
|
|
10
|
-
<!-- Javascript dependencies -->
|
|
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>
|
|
12
|
-
|
|
13
|
-
<!-- Grid editor CSS -->
|
|
14
|
-
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
|
-
|
|
16
|
-
<!-- The editor, and no text editor of the shipped ones: the one this page
|
|
17
|
-
edits text with is written below -->
|
|
18
|
-
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
19
|
-
<script src="../dist/grideditor.min.js"></script>
|
|
20
|
-
|
|
21
|
-
<!-- A text editor of the page's own. It is a feature plugin like any
|
|
22
|
-
other: the core knows nothing of text, and asks the plugins through
|
|
23
|
-
textTypes which types there are. This one edits with the browser's
|
|
24
|
-
own contenteditable. -->
|
|
25
|
-
<script id="simpletext-plugin">
|
|
26
|
-
(function() {
|
|
27
|
-
|
|
28
|
-
Object.assign(GridEditor.locales.en, {
|
|
29
|
-
'simpletext.label': 'Simple text',
|
|
30
|
-
'simpletext.add': 'Simple text',
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var TYPE = 'simpletext';
|
|
34
|
-
|
|
35
|
-
GridEditor.features.simpletext = function(ge) {
|
|
36
|
-
|
|
37
|
-
/** A content area of this plugin's: its type is on it. */
|
|
38
|
-
function isOurs(area) {
|
|
39
|
-
return !!area && area.getAttribute('data-ge-content-type') === TYPE;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function start(area) {
|
|
43
|
-
if (area.classList.contains('ge-rte-active')) { return; }
|
|
44
|
-
|
|
45
|
-
area.classList.add('ge-rte-active');
|
|
46
|
-
area.setAttribute('contenteditable', 'true');
|
|
47
|
-
area.focus();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Whatever start put on the content area comes off: what is
|
|
51
|
-
// left is what getHtml saves
|
|
52
|
-
function stop(area) {
|
|
53
|
-
area.classList.remove('ge-rte-active');
|
|
54
|
-
area.removeAttribute('contenteditable');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** The content area a text block holds. */
|
|
58
|
-
function areaOf(textBlock) {
|
|
59
|
-
return textBlock.querySelector(':scope > .ge-content');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A text's drawer. The editor wraps each content area of a
|
|
64
|
-
* column in a .ge-text-block while editing, and leaves the
|
|
65
|
-
* drawer of a type a plugin declares to that plugin.
|
|
66
|
-
*/
|
|
67
|
-
function createDrawer(textBlock) {
|
|
68
|
-
var area = areaOf(textBlock);
|
|
69
|
-
var drawer = document.createElement('div');
|
|
70
|
-
drawer.className = 'ge-tools-drawer ge-text-drawer';
|
|
71
|
-
textBlock.insertBefore(drawer, textBlock.firstChild);
|
|
72
|
-
|
|
73
|
-
ge.createMoveTool(drawer);
|
|
74
|
-
ge.createTool(drawer, ge.t('tool.delete_text'), 'ge-delete-text', 'bi bi-trash', function() {
|
|
75
|
-
ge.deleteNode('text', area, ge.t('confirm.delete_text'), function(removed) {
|
|
76
|
-
stop(area);
|
|
77
|
-
// Folded away, then gone
|
|
78
|
-
var fold = textBlock.animate(
|
|
79
|
-
[{ height: textBlock.offsetHeight + 'px', opacity: 1 }, { height: '0px', opacity: 0 }],
|
|
80
|
-
{ duration: 400, easing: 'ease-in-out' }
|
|
81
|
-
);
|
|
82
|
-
textBlock.style.overflow = 'hidden';
|
|
83
|
-
fold.onfinish = function() {
|
|
84
|
-
textBlock.remove();
|
|
85
|
-
removed();
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function onClick(e) {
|
|
92
|
-
var area = e.target.closest('.ge-content');
|
|
93
|
-
if (area && ge.canvas.contains(area) && isOurs(area)) { start(area); }
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
// The types this plugin edits. The core uses them to know
|
|
98
|
-
// whose a content area is, and to offer them when the
|
|
99
|
-
// host's plain content is clicked: edit() is handed the
|
|
100
|
-
// content area once the core has written the type on it
|
|
101
|
-
textTypes: function() {
|
|
102
|
-
return [{
|
|
103
|
-
type: TYPE,
|
|
104
|
-
label: ge.t('simpletext.label'),
|
|
105
|
-
edit: function(area) {
|
|
106
|
-
var textBlock = area.parentElement;
|
|
107
|
-
if (textBlock.classList.contains('ge-text-block') &&
|
|
108
|
-
!textBlock.querySelector(':scope > .ge-tools-drawer')) {
|
|
109
|
-
createDrawer(textBlock);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
start(area);
|
|
113
|
-
},
|
|
114
|
-
}];
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// A button to make a new text, in a row of its own or
|
|
118
|
-
// where it is dropped in a column
|
|
119
|
-
toolbar: [{
|
|
120
|
-
labelKey: 'simpletext.add',
|
|
121
|
-
iconClass: 'bi bi-fonts',
|
|
122
|
-
kind: 'text',
|
|
123
|
-
inColumn: true,
|
|
124
|
-
create: function() {
|
|
125
|
-
var area = document.createElement('div');
|
|
126
|
-
area.className = 'ge-content ge-content-type-' + TYPE;
|
|
127
|
-
area.setAttribute('data-ge-content-type', TYPE);
|
|
128
|
-
area.innerHTML = '<p>Write here</p>';
|
|
129
|
-
return area;
|
|
130
|
-
},
|
|
131
|
-
}],
|
|
132
|
-
|
|
133
|
-
onInit: function() {
|
|
134
|
-
ge.canvas.querySelectorAll('.ge-text-block').forEach(function(textBlock) {
|
|
135
|
-
if (textBlock.querySelector(':scope > .ge-tools-drawer')) { return; }
|
|
136
|
-
if (isOurs(areaOf(textBlock))) { createDrawer(textBlock); }
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// One listener, however many times the canvas is initialized
|
|
140
|
-
ge.canvas.removeEventListener('click', onClick);
|
|
141
|
-
ge.canvas.addEventListener('click', onClick);
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
// Before the drawers and the text blocks come off
|
|
145
|
-
onBeforeDeinit: function() {
|
|
146
|
-
ge.canvas.querySelectorAll('.ge-content').forEach(function(area) {
|
|
147
|
-
if (isOurs(area)) { stop(area); }
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
onDeinit: function() {
|
|
152
|
-
ge.canvas.removeEventListener('click', onClick);
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
})();
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<script>
|
|
161
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
162
|
-
var editor = new GridEditor('#myGrid', {
|
|
163
|
-
new_row_layouts: [[12], [6, 6], [4, 4, 4]],
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
document.getElementById('output').addEventListener('click', function() {
|
|
167
|
-
document.getElementById('html').textContent = editor.getHtml();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
</script>
|
|
171
|
-
|
|
172
|
-
<title>Grid Editor example - a text editor of your own</title>
|
|
173
|
-
</head>
|
|
174
|
-
<body>
|
|
175
|
-
<!-- Back to the demo index -->
|
|
176
|
-
<div class="container pt-3">
|
|
177
|
-
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
<div class="container py-3">
|
|
181
|
-
<h2>A text editor of your own</h2>
|
|
182
|
-
<p class="text-body-secondary">
|
|
183
|
-
No tinyMCE, CKEditor or summernote on this page: its text editor is
|
|
184
|
-
the plugin in the page's source, a few dozen lines on the browser's
|
|
185
|
-
<code>contenteditable</code>. The markup below had no text editor's
|
|
186
|
-
type on it, so the editor took it for the host's <em>plain
|
|
187
|
-
content</em>: it can be moved and deleted, and a click makes it a
|
|
188
|
-
text of this editor. The second column was saved as one already.
|
|
189
|
-
See <a href="../docs/plugins.md">docs/plugins.md</a>.
|
|
190
|
-
</p>
|
|
191
|
-
|
|
192
|
-
<div id="myGrid">
|
|
193
|
-
<div class="row">
|
|
194
|
-
<div class="col-lg-6">
|
|
195
|
-
<h3>Plain content</h3>
|
|
196
|
-
<p>Loose markup of the page's own. Click it and it is a simple text.</p>
|
|
197
|
-
</div>
|
|
198
|
-
<div class="col-lg-6">
|
|
199
|
-
<div class="ge-content ge-content-type-simpletext" data-ge-content-type="simpletext">
|
|
200
|
-
<p>A simple text, saved as one: a click edits it.</p>
|
|
201
|
-
</div>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<p class="mt-4">
|
|
207
|
-
<button type="button" class="btn btn-outline-primary btn-sm" id="output">Show getHtml</button>
|
|
208
|
-
</p>
|
|
209
|
-
<pre class="bg-body-tertiary border rounded p-3 small"><code id="html"></code></pre>
|
|
210
|
-
</div>
|
|
211
|
-
</body>
|
|
212
|
-
</html>
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
-
|
|
6
|
-
<!-- CSS dependencies -->
|
|
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
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
|
|
9
|
-
|
|
10
|
-
<!-- Javascript dependencies -->
|
|
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>
|
|
12
|
-
|
|
13
|
-
<!-- Grid editor CSS -->
|
|
14
|
-
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
|
-
|
|
16
|
-
<!-- The editor, the elements and tabs plugins so there is one of each
|
|
17
|
-
kind of node, and the inline-style plugin. -->
|
|
18
|
-
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
19
|
-
<script src="../dist/grideditor.min.js"></script>
|
|
20
|
-
<script src="../dist/plugins/grideditor.elements.min.js"></script>
|
|
21
|
-
<script src="../dist/plugins/grideditor.tabs.min.js"></script>
|
|
22
|
-
<script src="../dist/plugins/grideditor.inline-style.min.js"></script>
|
|
23
|
-
|
|
24
|
-
<script>
|
|
25
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
26
|
-
var grid = document.getElementById('myGrid');
|
|
27
|
-
var panel = document.getElementById('panel');
|
|
28
|
-
var narrow = document.getElementById('narrow');
|
|
29
|
-
var editor;
|
|
30
|
-
|
|
31
|
-
function start() {
|
|
32
|
-
editor = new GridEditor(grid, {
|
|
33
|
-
new_row_layouts: [[12], [6,6], [4,4,4], [8,4]],
|
|
34
|
-
content_types: [],
|
|
35
|
-
|
|
36
|
-
// Where a node's settings open. In a popover, or inline
|
|
37
|
-
// in the drawer, the Style accordion opens in a dialog
|
|
38
|
-
settings_panel: panel.value,
|
|
39
|
-
|
|
40
|
-
// Every section, unless the host says otherwise: this
|
|
41
|
-
// leaves out position and keeps the border section to
|
|
42
|
-
// three fields with no chips
|
|
43
|
-
inline_style: narrow.checked ? {
|
|
44
|
-
sections: {
|
|
45
|
-
position: false,
|
|
46
|
-
border: { properties: ['border-width', 'border-style', 'border-color'], catalog: false },
|
|
47
|
-
},
|
|
48
|
-
} : {},
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
start();
|
|
52
|
-
|
|
53
|
-
// The same canvas, started again with the other settings
|
|
54
|
-
function restart() {
|
|
55
|
-
var html = editor.getHtml();
|
|
56
|
-
editor.destroy();
|
|
57
|
-
grid.innerHTML = html;
|
|
58
|
-
start();
|
|
59
|
-
}
|
|
60
|
-
panel.addEventListener('change', restart);
|
|
61
|
-
narrow.addEventListener('change', restart);
|
|
62
|
-
|
|
63
|
-
document.getElementById('output').addEventListener('click', function() {
|
|
64
|
-
document.getElementById('html').textContent = editor.getHtml();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<title>Grid Editor inline style example</title>
|
|
70
|
-
</head>
|
|
71
|
-
<body>
|
|
72
|
-
<!-- Back to the demo index -->
|
|
73
|
-
<div class="container pt-3">
|
|
74
|
-
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<div class="container">
|
|
78
|
-
|
|
79
|
-
<div class="row my-3">
|
|
80
|
-
<div class="col-lg-8">
|
|
81
|
-
<h1 class="h4">Inline style</h1>
|
|
82
|
-
<p class="form-text">
|
|
83
|
-
The gear of a row, a column, a container, a tab, an element
|
|
84
|
-
or a section has a <strong>Style</strong> accordion: size,
|
|
85
|
-
spacing, border, background, text, typography, display,
|
|
86
|
-
flex, position and free css. What you type is written to the
|
|
87
|
-
node's own <code>style</code>; a value the browser does
|
|
88
|
-
not take is marked and not written.
|
|
89
|
-
</p>
|
|
90
|
-
<p class="form-text">
|
|
91
|
-
Each section also offers Bootstrap's classes for what it
|
|
92
|
-
styles, as chips: one puts its class in the classes field,
|
|
93
|
-
and pressing it again takes it off. Bootstrap's utilities
|
|
94
|
-
are <code>!important</code>, so a field whose property a
|
|
95
|
-
class on the node also sets says the class wins.
|
|
96
|
-
</p>
|
|
97
|
-
<p class="form-text">
|
|
98
|
-
The inline style is the same at every size. Padding and
|
|
99
|
-
margin, text alignment, display, flex, sticky and float
|
|
100
|
-
are Bootstrap's responsive classes, edited per breakpoint
|
|
101
|
-
in their sections: pick a breakpoint in the dropdown. A
|
|
102
|
-
node that is flex or grid has its drawer on top, out of
|
|
103
|
-
the flow, so its content is laid out as on the page.
|
|
104
|
-
</p>
|
|
105
|
-
<div class="d-flex flex-wrap align-items-center gap-3 mb-3">
|
|
106
|
-
<div class="d-flex align-items-center gap-2">
|
|
107
|
-
<label class="form-label mb-0" for="panel">A gear opens its settings in</label>
|
|
108
|
-
<select class="form-select form-select-sm w-auto" id="panel">
|
|
109
|
-
<option value="offcanvas">a side panel (offcanvas)</option>
|
|
110
|
-
<option value="popover">a popover</option>
|
|
111
|
-
<option value="modal">a modal</option>
|
|
112
|
-
<option value="inline">the drawer itself (inline)</option>
|
|
113
|
-
</select>
|
|
114
|
-
</div>
|
|
115
|
-
<div class="form-check mb-0">
|
|
116
|
-
<input class="form-check-input" type="checkbox" id="narrow">
|
|
117
|
-
<label class="form-check-label" for="narrow">Fewer sections: no position, a shorter border</label>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
<button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
|
|
121
|
-
<pre id="html" class="form-text"></pre>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div id="myGrid">
|
|
126
|
-
|
|
127
|
-
<div class="row" style="background-color: #f0f4ff; border-radius: 12px;">
|
|
128
|
-
<div class="col-12 col-md-8" style="padding-top: 1rem; padding-bottom: 1rem;">
|
|
129
|
-
<h2 class="h5">Styled inline</h2>
|
|
130
|
-
<p>This row has a background and a radius in its <code>style</code>; open its gear and look in Background and Border.</p>
|
|
131
|
-
</div>
|
|
132
|
-
<div class="col-12 col-md-4 shadow-sm rounded-3" style="box-shadow: 0 4px 12px rgba(0, 0, 0, .15)">
|
|
133
|
-
<h2 class="h5">A class and a style</h2>
|
|
134
|
-
<p>It has <code>shadow-sm</code> and an inline shadow: the class wins, and the Border section says so.</p>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<div class="row my-3">
|
|
139
|
-
<div class="col-6">
|
|
140
|
-
<div data-ge-element="callout" data-ge-label="Callout" class="p-3 border-start border-4 bg-body-tertiary" style="font-style: italic; letter-spacing: .02em">
|
|
141
|
-
An element, with a few classes from the catalog and some typography of its own.
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
<div class="col-6">
|
|
145
|
-
<p>Try Size on this column: it offers only the min- and max- widths and heights, since its width is the grid's.</p>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
|
|
149
|
-
<div class="row my-3">
|
|
150
|
-
<div class="col-12 col-md-6 d-flex flex-column flex-md-row align-items-md-center gap-3 bg-primary-subtle">
|
|
151
|
-
<p class="mb-0">A column made flex: its texts are stacked on phones and side by side from tablet up, with a gap between them.</p>
|
|
152
|
-
<p class="mb-0">Open its gear, and look in Display and Flex.</p>
|
|
153
|
-
</div>
|
|
154
|
-
<div class="col-12 col-md-6 text-bg-dark">
|
|
155
|
-
<p>This column has <code>text-bg-dark</code>, one of Bootstrap 5.3's colors in the Background section, with the subtle ones and the opacities.</p>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
</div> <!-- /#myGrid -->
|
|
160
|
-
</div> <!-- /.container -->
|
|
161
|
-
|
|
162
|
-
</body>
|
|
163
|
-
</html>
|