@themarioga/grid-editor 7.3.0 → 8.0.0-beta.3
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 +76 -0
- package/README.md +34 -30
- package/UPGRADING.md +55 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +72 -6
- package/dist/grideditor.d.ts +24 -3
- package/dist/grideditor.esm.js +7 -58
- package/dist/grideditor.jquery.js +0 -13
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +3 -3
- package/dist/grideditor.js +7 -58
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +30 -6
- package/dist/locales/grideditor.es.js +30 -6
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.esm.js +11 -38
- package/dist/plugins/grideditor.alignment.js +11 -38
- package/dist/plugins/grideditor.alignment.min.js +1 -1
- package/dist/plugins/grideditor.alignment.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
- package/dist/plugins/grideditor.ckeditor.js +0 -5
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- 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.min.js.map +2 -2
- package/dist/plugins/grideditor.gutters.min.js.map +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.min.js.map +2 -2
- package/dist/plugins/grideditor.style.esm.js +393 -60
- package/dist/plugins/grideditor.style.js +387 -56
- package/dist/plugins/grideditor.style.min.js +4 -2
- package/dist/plugins/grideditor.style.min.js.map +4 -4
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.esm.js +274 -6
- package/dist/plugins/grideditor.tabs.js +274 -6
- 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 +1 -8
- package/dist/plugins/grideditor.tinymce.js +1 -8
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +4 -6
- package/docs/locale-keys.md +35 -13
- package/docs/plugins.md +15 -35
- package/example/ckeditor.html +0 -5
- package/example/containers.html +64 -2
- package/example/index.html +5 -4
- package/example/style.html +16 -4
- package/example/utilities.html +12 -11
- package/package.json +1 -1
- package/src/js/dom.js +1 -2
- package/src/js/grideditor.jquery.js +7 -28
- package/src/js/grideditor.js +12 -81
- package/src/js/locales/grideditor.es.js +30 -6
- package/src/js/plugins/grideditor.alignment.js +21 -50
- package/src/js/plugins/grideditor.ckeditor.js +10 -23
- package/src/js/plugins/grideditor.style.js +18 -12
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tabs.js +311 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +14 -3
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/style/float.js +2 -4
- package/src/js/style/options.js +5 -20
- package/src/js/style/sections.js +42 -15
- package/src/js/style/spacing.js +2 -4
- package/src/js/style/sticky.js +39 -0
- package/src/js/style/textalign.js +2 -4
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +68 -10
- package/types/grideditor.d.ts +24 -3
- package/dist/plugins/grideditor.float.esm.js +0 -43
- package/dist/plugins/grideditor.float.js +0 -47
- package/dist/plugins/grideditor.float.min.js +0 -1
- package/dist/plugins/grideditor.float.min.js.map +0 -7
- package/dist/plugins/grideditor.spacing.esm.js +0 -327
- package/dist/plugins/grideditor.spacing.js +0 -329
- package/dist/plugins/grideditor.spacing.min.js +0 -1
- package/dist/plugins/grideditor.spacing.min.js.map +0 -7
- package/dist/plugins/grideditor.textalign.esm.js +0 -49
- package/dist/plugins/grideditor.textalign.js +0 -53
- package/dist/plugins/grideditor.textalign.min.js +0 -1
- package/dist/plugins/grideditor.textalign.min.js.map +0 -7
- package/dist/plugins/grideditor.visibility.esm.js +0 -167
- package/dist/plugins/grideditor.visibility.js +0 -169
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.float.js +0 -29
- package/src/js/plugins/grideditor.spacing.js +0 -31
- package/src/js/plugins/grideditor.textalign.js +0 -27
- package/src/js/plugins/grideditor.visibility.js +0 -32
- package/src/js/style/visibility.js +0 -160
package/example/containers.html
CHANGED
|
@@ -100,8 +100,11 @@
|
|
|
100
100
|
asked to do any of it, so there is no backdrop and no focus
|
|
101
101
|
trap to fight with. Double click a tab or item label to
|
|
102
102
|
rename it, and a card’s header and footer the same
|
|
103
|
-
way. The
|
|
104
|
-
accordion item.
|
|
103
|
+
way. The row after the popup shows two levels: tabs inside
|
|
104
|
+
an accordion item. A tabs container's gear has a Tabs
|
|
105
|
+
section for its variant - tabs, pills or underline, full
|
|
106
|
+
width, alignment, and vertical from a breakpoint up - and
|
|
107
|
+
the last row has two of them.
|
|
105
108
|
</p>
|
|
106
109
|
<button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
|
|
107
110
|
<button class="btn btn-sm btn-primary" id="authored" type="button">Open that html as a real page</button>
|
|
@@ -239,6 +242,65 @@
|
|
|
239
242
|
</div>
|
|
240
243
|
</div>
|
|
241
244
|
|
|
245
|
+
<div class="row">
|
|
246
|
+
<div class="col-lg-6">
|
|
247
|
+
<div data-ge-container="tabs" class="d-md-flex align-items-md-start">
|
|
248
|
+
<ul class="nav nav-pills flex-md-column me-md-3" role="tablist" aria-orientation="vertical">
|
|
249
|
+
<li class="nav-item" role="presentation">
|
|
250
|
+
<button class="nav-link active" type="button" role="tab" data-bs-toggle="tab" data-bs-target="#example-vtab-one" aria-controls="example-vtab-one">Profile</button>
|
|
251
|
+
</li>
|
|
252
|
+
<li class="nav-item" role="presentation">
|
|
253
|
+
<button class="nav-link" type="button" role="tab" data-bs-toggle="tab" data-bs-target="#example-vtab-two" aria-controls="example-vtab-two">Settings</button>
|
|
254
|
+
</li>
|
|
255
|
+
</ul>
|
|
256
|
+
<div class="tab-content">
|
|
257
|
+
<div class="tab-pane fade show active" id="example-vtab-one" role="tabpanel" tabindex="0">
|
|
258
|
+
<div class="row"><div class="col-lg-12">
|
|
259
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>Pills, vertical from tablet up: open the container’s gear and look in Tabs.</p></div>
|
|
260
|
+
</div></div>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="tab-pane fade" id="example-vtab-two" role="tabpanel" tabindex="0">
|
|
263
|
+
<div class="row"><div class="col-lg-12">
|
|
264
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>On a phone the pills are a row above the panes.</p></div>
|
|
265
|
+
</div></div>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
<div class="col-lg-6">
|
|
271
|
+
<div data-ge-container="tabs">
|
|
272
|
+
<ul class="nav nav-underline nav-fill" role="tablist">
|
|
273
|
+
<li class="nav-item" role="presentation">
|
|
274
|
+
<button class="nav-link active" type="button" role="tab" data-bs-toggle="tab" data-bs-target="#example-utab-one" aria-controls="example-utab-one">Week</button>
|
|
275
|
+
</li>
|
|
276
|
+
<li class="nav-item" role="presentation">
|
|
277
|
+
<button class="nav-link" type="button" role="tab" data-bs-toggle="tab" data-bs-target="#example-utab-two" aria-controls="example-utab-two">Month</button>
|
|
278
|
+
</li>
|
|
279
|
+
<li class="nav-item" role="presentation">
|
|
280
|
+
<button class="nav-link" type="button" role="tab" data-bs-toggle="tab" data-bs-target="#example-utab-three" aria-controls="example-utab-three">Year</button>
|
|
281
|
+
</li>
|
|
282
|
+
</ul>
|
|
283
|
+
<div class="tab-content">
|
|
284
|
+
<div class="tab-pane fade show active" id="example-utab-one" role="tabpanel" tabindex="0">
|
|
285
|
+
<div class="row"><div class="col-lg-12">
|
|
286
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>Underline, filling the width.</p></div>
|
|
287
|
+
</div></div>
|
|
288
|
+
</div>
|
|
289
|
+
<div class="tab-pane fade" id="example-utab-two" role="tabpanel" tabindex="0">
|
|
290
|
+
<div class="row"><div class="col-lg-12">
|
|
291
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>The second.</p></div>
|
|
292
|
+
</div></div>
|
|
293
|
+
</div>
|
|
294
|
+
<div class="tab-pane fade" id="example-utab-three" role="tabpanel" tabindex="0">
|
|
295
|
+
<div class="row"><div class="col-lg-12">
|
|
296
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>The third.</p></div>
|
|
297
|
+
</div></div>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
|
|
242
304
|
</div> <!-- /#myGrid -->
|
|
243
305
|
</div> <!-- /.container -->
|
|
244
306
|
|
package/example/index.html
CHANGED
|
@@ -44,15 +44,16 @@
|
|
|
44
44
|
</p>
|
|
45
45
|
<p class="text-body-secondary">
|
|
46
46
|
Since 4.1: utility plugins, which edit Bootstrap's responsive
|
|
47
|
-
utility classes —
|
|
47
|
+
utility classes — display, column order, alignment,
|
|
48
48
|
gutters and spacing — per breakpoint. See
|
|
49
49
|
<a href="utilities.html">Responsive utilities</a>.
|
|
50
50
|
</p>
|
|
51
51
|
<p class="text-body-secondary">
|
|
52
52
|
New in 7.3: the style plugin, inline css by section with
|
|
53
|
-
Bootstrap's classes as chips, which also carries
|
|
53
|
+
Bootstrap's classes as chips, which also carries display,
|
|
54
54
|
spacing, text alignment and float. See
|
|
55
|
-
<a href="style.html">Style</a>.
|
|
55
|
+
<a href="style.html">Style</a>. In 8.0: flex, sticky and
|
|
56
|
+
Bootstrap 5.3's colors.
|
|
56
57
|
</p>
|
|
57
58
|
|
|
58
59
|
<div class="list-group my-4">
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
<strong>Responsive utilities</strong>
|
|
135
136
|
<code class="text-body-secondary">utilities.html</code>
|
|
136
137
|
</div>
|
|
137
|
-
<span class="text-body-secondary">Bootstrap's utility classes edited per breakpoint:
|
|
138
|
+
<span class="text-body-secondary">Bootstrap's utility classes edited per breakpoint: display, flex, column order, alignment, gutters, spacing, text alignment and float</span>
|
|
138
139
|
</a>
|
|
139
140
|
|
|
140
141
|
<a class="list-group-item list-group-item-action" href="style.html">
|
package/example/style.html
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
The gear of a row, a column, a container, a tab, an element
|
|
84
84
|
or a section has a <strong>Style</strong> accordion: size,
|
|
85
85
|
spacing, border, background, text, typography, display,
|
|
86
|
-
position and free css. What you type is written to the
|
|
86
|
+
flex, position and free css. What you type is written to the
|
|
87
87
|
node's own <code>style</code>; a value the browser does
|
|
88
88
|
not take is marked and not written.
|
|
89
89
|
</p>
|
|
@@ -96,9 +96,11 @@
|
|
|
96
96
|
</p>
|
|
97
97
|
<p class="form-text">
|
|
98
98
|
The inline style is the same at every size. Padding and
|
|
99
|
-
margin, text alignment,
|
|
100
|
-
Bootstrap's responsive classes, edited per breakpoint
|
|
101
|
-
their sections: pick a breakpoint in the dropdown.
|
|
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.
|
|
102
104
|
</p>
|
|
103
105
|
<div class="d-flex flex-wrap align-items-center gap-3 mb-3">
|
|
104
106
|
<div class="d-flex align-items-center gap-2">
|
|
@@ -144,6 +146,16 @@
|
|
|
144
146
|
</div>
|
|
145
147
|
</div>
|
|
146
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
|
+
|
|
147
159
|
</div> <!-- /#myGrid -->
|
|
148
160
|
</div> <!-- /.container -->
|
|
149
161
|
|
package/example/utilities.html
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
<!-- The editor, and the utility plugins. Each is a file of its own, and
|
|
17
17
|
loading it is what puts its fields in the settings panels. The style
|
|
18
|
-
plugin carries
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
the Responsive section. -->
|
|
18
|
+
plugin carries display, flex, spacing, text alignment, sticky and
|
|
19
|
+
float, and edits them in its Style accordion - a row's justify and
|
|
20
|
+
align among them, in Flex; order, a column's align-self and gutters
|
|
21
|
+
are the grid's, and stay in the Responsive section. -->
|
|
22
22
|
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
23
23
|
<script src="../dist/grideditor.min.js"></script>
|
|
24
24
|
<script src="../dist/plugins/grideditor.order.min.js"></script>
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
change is written for that breakpoint alone; in
|
|
92
92
|
<strong>All sizes</strong> it is written once, for every
|
|
93
93
|
size. Each drawer's gear has a <strong>Style</strong>
|
|
94
|
-
accordion, whose sections hold
|
|
95
|
-
alignment and float, and a <strong>Responsive</strong>
|
|
94
|
+
accordion, whose sections hold display, flex, spacing, text
|
|
95
|
+
alignment, sticky and float, and a <strong>Responsive</strong>
|
|
96
96
|
section for the grid's utilities. Every field says what
|
|
97
97
|
the breakpoint inherits and from where.
|
|
98
98
|
</p>
|
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
</select>
|
|
107
107
|
</div>
|
|
108
108
|
<p class="form-text">
|
|
109
|
-
<strong>
|
|
109
|
+
<strong>Display:</strong> a field in the Display section,
|
|
110
|
+
and the eye in a drawer, which hides the
|
|
110
111
|
node in the view being edited. It stays on the canvas,
|
|
111
112
|
faded, so you can show it again; in All sizes a badge says
|
|
112
113
|
at which breakpoints it is hidden. The sidebar below is
|
|
@@ -119,10 +120,10 @@
|
|
|
119
120
|
comes first on phones only.
|
|
120
121
|
</p>
|
|
121
122
|
<p class="form-text">
|
|
122
|
-
<strong>Alignment:</strong>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
small desktop up.
|
|
123
|
+
<strong>Alignment:</strong> a row justifies and aligns its
|
|
124
|
+
columns with fields in the Style accordion's Flex section,
|
|
125
|
+
and a column aligns itself with a field in Responsive. The
|
|
126
|
+
third row centres its narrow column from small desktop up.
|
|
126
127
|
</p>
|
|
127
128
|
<p class="form-text">
|
|
128
129
|
<strong>Gutters:</strong> fields in a row's panel. A row
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"comment": "A scoped package publishes restricted unless it is told otherwise.",
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"version": "
|
|
36
|
+
"version": "8.0.0-beta.3",
|
|
37
37
|
"main": "dist/grideditor.js",
|
|
38
38
|
"module": "dist/grideditor.esm.js",
|
|
39
39
|
"types": "dist/grideditor.d.ts",
|
package/src/js/dom.js
CHANGED
|
@@ -314,8 +314,7 @@ export function fire(node, type) {
|
|
|
314
314
|
/* ------------------------------------------------------------------
|
|
315
315
|
* Taking a node away, visibly.
|
|
316
316
|
*
|
|
317
|
-
* The durations are the
|
|
318
|
-
* caller says otherwise. `done` runs once the node is out of sight, which is
|
|
317
|
+
* The durations are jQuery's: 400 ms unless the caller says otherwise. `done` runs once the node is out of sight, which is
|
|
319
318
|
* when the caller removes it; a node that is already out of sight is done at
|
|
320
319
|
* once, on the next task, as jQuery had it.
|
|
321
320
|
* ------------------------------------------------------------------ */
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The jQuery API of grid-editor 6, on top of the
|
|
2
|
+
* The jQuery API of grid-editor 6, on top of the plain DOM editor.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* A page written for 6.x - one that calls $(el).gridEditor(...), listens
|
|
5
|
+
* with $(el).on('grideditor:...') and reads jQuery objects out of the
|
|
6
|
+
* payloads - loads jQuery 4 and this file after grideditor.js, and runs
|
|
7
|
+
* unchanged:
|
|
8
8
|
*
|
|
9
9
|
* <script src="jquery.min.js"></script>
|
|
10
10
|
* <script src="dist/grideditor.min.js"></script>
|
|
11
11
|
* <script src="dist/grideditor.jquery.min.js"></script>
|
|
12
12
|
* <script src="dist/plugins/grideditor.tabs.min.js"></script>
|
|
13
13
|
*
|
|
14
|
-
* What it keeps is the host's side of 6.x. Plugins are not:
|
|
15
|
-
*
|
|
16
|
-
* .utilities or .texts, and is warned about and left out, since the plugin
|
|
17
|
-
* contract hands out elements now. UPGRADING.md says how to port one.
|
|
14
|
+
* What it keeps is the host's side of 6.x. Plugins are not: they register
|
|
15
|
+
* on GridEditor, and the plugin contract hands out elements.
|
|
18
16
|
*
|
|
19
17
|
* Every value 6.x gave host code as a jQuery object is one again: the event
|
|
20
18
|
* payloads and the callbacks' arguments, what the create* methods return,
|
|
@@ -250,15 +248,6 @@ function install() {
|
|
|
250
248
|
};
|
|
251
249
|
});
|
|
252
250
|
|
|
253
|
-
/** Plugins registered the 6.x way: said once each, and never called. */
|
|
254
|
-
function warnAboutLegacyPlugins() {
|
|
255
|
-
['containers', 'features', 'utilities', 'texts'].forEach(function(registry) {
|
|
256
|
-
Object.keys(legacy[registry]).forEach(function(name) {
|
|
257
|
-
warnOnce('plugin-6x:' + registry + ':' + name, english('warning.plugin_6x', { name: name }));
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
251
|
function dispatchMethod(set, name, args) {
|
|
263
252
|
var descriptor = METHODS[name];
|
|
264
253
|
|
|
@@ -300,8 +289,6 @@ function install() {
|
|
|
300
289
|
return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));
|
|
301
290
|
}
|
|
302
291
|
|
|
303
|
-
warnAboutLegacyPlugins();
|
|
304
|
-
|
|
305
292
|
var options = adaptOptions(optionsOrMethod);
|
|
306
293
|
|
|
307
294
|
this.each(function() {
|
|
@@ -311,14 +298,6 @@ function install() {
|
|
|
311
298
|
return this;
|
|
312
299
|
};
|
|
313
300
|
|
|
314
|
-
// Where a 6.x plugin registers. Kept, so one does not throw as it
|
|
315
|
-
// loads, and read only to say it is not used.
|
|
316
|
-
var legacy = { containers: {}, features: {}, utilities: {}, texts: {} };
|
|
317
|
-
$.fn.gridEditor.containers = legacy.containers;
|
|
318
|
-
$.fn.gridEditor.features = legacy.features;
|
|
319
|
-
$.fn.gridEditor.utilities = legacy.utilities;
|
|
320
|
-
$.fn.gridEditor.texts = legacy.texts;
|
|
321
|
-
|
|
322
301
|
// Strings are the same thing in both: a 6.x locale file loads unchanged
|
|
323
302
|
$.fn.gridEditor.locales = GridEditor.locales;
|
|
324
303
|
$.fn.gridEditor.t = GridEditor.t;
|
package/src/js/grideditor.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* A fork of https://github.com/Friendly-Pixel/grid-editor by Simon Epskamp,
|
|
5
5
|
* maintained at https://github.com/themarioga/grid-editor.
|
|
6
6
|
*
|
|
7
|
-
* Plain DOM
|
|
8
|
-
*
|
|
9
|
-
* see UPGRADING.md.
|
|
7
|
+
* Plain DOM: nothing here needs jQuery. A page written against the jQuery
|
|
8
|
+
* API loads grideditor.jquery.js beside this file.
|
|
10
9
|
*/
|
|
11
10
|
import * as dom from './dom.js';
|
|
12
11
|
|
|
@@ -73,8 +72,6 @@ var ALL_VIEW_LABEL_KEY = 'view.all';
|
|
|
73
72
|
/** Every view key the dropdown can offer, in the order it offers them. */
|
|
74
73
|
var VIEW_KEYS = [ALL_VIEW].concat(BREAKPOINTS.map(function(tier) { return tier.key; }));
|
|
75
74
|
|
|
76
|
-
/** What the three layout mode indexes of 2.x meant. */
|
|
77
|
-
var LEGACY_VIEW_INDEXES = ['lg', 'sm', 'xs'];
|
|
78
75
|
|
|
79
76
|
var MAX_COL_SIZE = 12;
|
|
80
77
|
var MAX_COL_OFFSET = 11;
|
|
@@ -158,12 +155,6 @@ var NESTED_SETTINGS = {
|
|
|
158
155
|
},
|
|
159
156
|
};
|
|
160
157
|
|
|
161
|
-
/** Settings 4.0 took away, and what a host should reach for instead. */
|
|
162
|
-
var REMOVED_SETTINGS = {
|
|
163
|
-
sortable_options: 'drag',
|
|
164
|
-
resizable_options: 'resize',
|
|
165
|
-
};
|
|
166
|
-
|
|
167
158
|
var warned = {};
|
|
168
159
|
|
|
169
160
|
/** Editors on the page, counted so each one's sortable groups are its own. */
|
|
@@ -372,7 +363,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
372
363
|
'element_tools' : [], // Host tools on element drawers, same shape as row_tools
|
|
373
364
|
'element_classes' : [], // Preset class toggles on an element's settings panel
|
|
374
365
|
// content_types, text_tools and text_classes are the text editor
|
|
375
|
-
// plugins' settings
|
|
366
|
+
// plugins' settings: see grideditor.text.js
|
|
376
367
|
'container_classes' : [], // The same, on a container's panel
|
|
377
368
|
'pane_classes' : [], // And on a tab's or an accordion item's
|
|
378
369
|
'container_tools' : [], // Host tools on container drawers
|
|
@@ -405,18 +396,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
405
396
|
settings[name] = Object.assign({}, NESTED_SETTINGS[name], settings[name]);
|
|
406
397
|
});
|
|
407
398
|
|
|
408
|
-
// Both handed out the drag toolkit's own options, which 4.0 stops
|
|
409
|
-
// promising: there is no widget underneath a host should be reaching
|
|
410
|
-
// for. What they were used for is a setting of the editor's now.
|
|
411
|
-
Object.keys(REMOVED_SETTINGS).forEach(function(name) {
|
|
412
|
-
if (optionsOrMethod && optionsOrMethod[name] !== undefined) {
|
|
413
|
-
warn(translate(settings, 'warning.setting_removed', {
|
|
414
|
-
setting: name,
|
|
415
|
-
replacement: REMOVED_SETTINGS[name],
|
|
416
|
-
}));
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
|
|
420
399
|
|
|
421
400
|
// Elems
|
|
422
401
|
var canvas,
|
|
@@ -432,7 +411,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
432
411
|
var sizePicker = null; // The open column size picker, if there is one
|
|
433
412
|
var sourceOpen = false; // Whether the canvas is being edited as html
|
|
434
413
|
var dropMarker = null; // The line showing where a dragged toolbar button would land
|
|
435
|
-
var warnedHere = {}; //
|
|
414
|
+
var warnedHere = {}; // Some warnings are worth saying once per instance, not once per call
|
|
436
415
|
var sortables = []; // Every list made sortable, so deinit destroys exactly those
|
|
437
416
|
var instanceId = ++editorCounter; // Scopes the sortable groups to this editor
|
|
438
417
|
var destroyed = false;
|
|
@@ -1866,35 +1845,8 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1866
1845
|
|
|
1867
1846
|
registerFamily('grid', {}, widthFamily());
|
|
1868
1847
|
if (settings.row_cols !== false) { registerFamily('grid', {}, rowColsFamily()); }
|
|
1869
|
-
// A plugin whose factory says it `replaces` others has taken
|
|
1870
|
-
// their place: an old name in the plugins setting asks for it,
|
|
1871
|
-
// and the old plugin, loaded beside it, stands down
|
|
1872
|
-
var replacedBy = {};
|
|
1873
|
-
[GridEditor.containers, GridEditor.features, GridEditor.utilities].forEach(function(registry) {
|
|
1874
|
-
Object.keys(registry).forEach(function(name) {
|
|
1875
|
-
(registry[name].replaces || []).forEach(function(old) {
|
|
1876
|
-
if (!replacedBy[old]) { replacedBy[old] = name; }
|
|
1877
|
-
});
|
|
1878
|
-
});
|
|
1879
|
-
});
|
|
1880
|
-
var named = function(name) {
|
|
1881
|
-
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1882
|
-
};
|
|
1883
|
-
var namedAsOld = function(name) {
|
|
1884
|
-
return !!settings.plugins && settings.plugins.some(function(old) { return replacedBy[old] === name; });
|
|
1885
|
-
};
|
|
1886
|
-
var standsDown = function(name) {
|
|
1887
|
-
return !!replacedBy[name] && wanted(replacedBy[name]);
|
|
1888
|
-
};
|
|
1889
1848
|
var wanted = function(name) {
|
|
1890
|
-
return !
|
|
1891
|
-
};
|
|
1892
|
-
var replaced = function(name) {
|
|
1893
|
-
if (!standsDown(name) || !named(name)) { return false; }
|
|
1894
|
-
|
|
1895
|
-
warnOnceHere('replaced:' + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] +
|
|
1896
|
-
'", which is loaded: ignoring it');
|
|
1897
|
-
return true;
|
|
1849
|
+
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1898
1850
|
};
|
|
1899
1851
|
|
|
1900
1852
|
// What the plugins setting does not choose: the text editors,
|
|
@@ -1905,16 +1857,16 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1905
1857
|
};
|
|
1906
1858
|
|
|
1907
1859
|
Object.keys(GridEditor.containers).forEach(function(type) {
|
|
1908
|
-
if (
|
|
1860
|
+
if (wanted(type)) { CONTAINERS[type] = GridEditor.containers[type](api); }
|
|
1909
1861
|
});
|
|
1910
1862
|
|
|
1911
1863
|
Object.keys(GridEditor.features).forEach(function(name) {
|
|
1912
1864
|
var factory = GridEditor.features[name];
|
|
1913
|
-
if (
|
|
1865
|
+
if (featureWanted(name, factory)) { FEATURES[name] = factory(api); }
|
|
1914
1866
|
});
|
|
1915
1867
|
|
|
1916
1868
|
Object.keys(GridEditor.utilities).forEach(function(name) {
|
|
1917
|
-
if (
|
|
1869
|
+
if (!wanted(name)) { return; }
|
|
1918
1870
|
|
|
1919
1871
|
UTILITIES[name] = GridEditor.utilities[name](api);
|
|
1920
1872
|
(UTILITIES[name].families || []).forEach(function(family) {
|
|
@@ -1932,12 +1884,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1932
1884
|
(settings.plugins || []).forEach(function(name) {
|
|
1933
1885
|
if (CONTAINERS[name] || FEATURES[name] || UTILITIES[name]) { return; }
|
|
1934
1886
|
|
|
1935
|
-
if (standsDown(name)) {
|
|
1936
|
-
warnOnceHere('renamed:' + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] +
|
|
1937
|
-
'" now: name "' + replacedBy[name] + '" in the plugins setting instead');
|
|
1938
|
-
return;
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
1887
|
warnOnceHere('plugin:' + name, 'the "' + name + '" plugin is not loaded: ' +
|
|
1942
1888
|
'include dist/plugins/grideditor.' + name + '.js after the editor');
|
|
1943
1889
|
});
|
|
@@ -3295,8 +3241,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3295
3241
|
refreshUtilities(container);
|
|
3296
3242
|
});
|
|
3297
3243
|
|
|
3298
|
-
// Bootstrap
|
|
3299
|
-
// up to 5.x they carried Bootstrap 3's btn-default, which 5 lacks
|
|
3244
|
+
// Bootstrap's outline buttons, filled while their class is on
|
|
3300
3245
|
var classGroup = general.appendChild(dom.element('div', { 'class': 'btn-group btn-group-sm ge-presets', role: 'group' }));
|
|
3301
3246
|
cssClasses.forEach(function(rowClass) {
|
|
3302
3247
|
var on = dom.hasClass(container, rowClass.cssClass);
|
|
@@ -3307,7 +3252,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3307
3252
|
'aria-pressed': on ? 'true' : 'false',
|
|
3308
3253
|
});
|
|
3309
3254
|
|
|
3310
|
-
// A preset's label is the host's markup
|
|
3255
|
+
// A preset's label is the host's markup
|
|
3311
3256
|
btn.innerHTML = rowClass.label;
|
|
3312
3257
|
dom.toggleClass(btn, 'active', on);
|
|
3313
3258
|
btn.addEventListener('click', function() {
|
|
@@ -5139,20 +5084,8 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
5139
5084
|
dom.one(layoutDropdown, 'button').textContent = t(labelKeyFor(view));
|
|
5140
5085
|
}
|
|
5141
5086
|
|
|
5142
|
-
/**
|
|
5143
|
-
* The view key a caller asked for, or null. 2.x callers passed a
|
|
5144
|
-
* layout mode index, which still works and says so once.
|
|
5145
|
-
*/
|
|
5087
|
+
/** The view key a caller asked for, or null. */
|
|
5146
5088
|
function viewKey(view) {
|
|
5147
|
-
if (typeof view == 'number') {
|
|
5148
|
-
warnOnceHere('changeView-index', 'changeView(' + view + '): layout modes are ' +
|
|
5149
|
-
'identified by breakpoint key now, so pass one of ' +
|
|
5150
|
-
JSON.stringify(VIEW_KEYS) + '. Numeric indexes still work, ' +
|
|
5151
|
-
'but they mean what they meant in 2.x (' +
|
|
5152
|
-
LEGACY_VIEW_INDEXES.join(', ') + ') and will be dropped.');
|
|
5153
|
-
return LEGACY_VIEW_INDEXES[view] || null;
|
|
5154
|
-
}
|
|
5155
|
-
|
|
5156
5089
|
return VIEW_KEYS.indexOf(view) === -1 ? null : view;
|
|
5157
5090
|
}
|
|
5158
5091
|
|
|
@@ -5409,14 +5342,12 @@ GridEditor.locales = {
|
|
|
5409
5342
|
'utility.inherit': 'Inherit: {value} (from {breakpoint})',
|
|
5410
5343
|
'utility.varies': 'Changes at {breakpoints}; choosing here replaces that',
|
|
5411
5344
|
'error.sortable_missing': 'SortableJS not available! Make sure you loaded the Sortable js file; dragging is off without it.',
|
|
5412
|
-
'warning.setting_removed': 'The {setting} setting was removed in 4.0. Use {replacement} instead.',
|
|
5413
5345
|
'warning.already_editing': 'This element already has an editor: that one is handed back, with the options it was made with.',
|
|
5414
5346
|
'warning.destroyed': '{method}() was called on an editor that has been destroyed, and does nothing.',
|
|
5415
5347
|
'warning.duplicate_build': 'grideditor.js was loaded twice: the first GridEditor is kept.',
|
|
5416
|
-
'warning.plugin_6x': 'The "{name}" plugin is written for grid-editor 6 and is not loaded. Plugins register on GridEditor since 7.0: see UPGRADING.md.',
|
|
5417
5348
|
'warning.adapter_no_jquery': 'grideditor.jquery.js needs jQuery 4, and there is no jQuery on the page: the jQuery API is not there.',
|
|
5418
5349
|
'error.tinymce_missing': 'tinyMCE not available! Make sure you loaded the tinyMCE js file.',
|
|
5419
|
-
'error.ckeditor_missing': 'CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file
|
|
5350
|
+
'error.ckeditor_missing': 'CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file.',
|
|
5420
5351
|
'error.summernote_missing': 'Summernote not available! Make sure you loaded jQuery and the Summernote js file.',
|
|
5421
5352
|
},
|
|
5422
5353
|
};
|
|
@@ -74,6 +74,23 @@ GridEditor.locales.es = {
|
|
|
74
74
|
'container.add_tabs': 'Pestañas',
|
|
75
75
|
'container.add_tab': 'Añadir pestaña',
|
|
76
76
|
'container.tab_label': 'Pestaña {number}',
|
|
77
|
+
'container.tabs_section': 'Pestañas',
|
|
78
|
+
'container.tabs_style': 'Estilo',
|
|
79
|
+
'container.tabs_style_tabs': 'Pestañas',
|
|
80
|
+
'container.tabs_style_pills': 'Pills',
|
|
81
|
+
'container.tabs_style_underline': 'Subrayado',
|
|
82
|
+
'container.tabs_width': 'Ancho',
|
|
83
|
+
'container.tabs_width_natural': 'Natural',
|
|
84
|
+
'container.tabs_width_fill': 'Rellenar',
|
|
85
|
+
'container.tabs_width_justified': 'Justificado',
|
|
86
|
+
'container.tabs_align': 'Alineación',
|
|
87
|
+
'container.tabs_align_start': 'Inicio',
|
|
88
|
+
'container.tabs_align_center': 'Centro',
|
|
89
|
+
'container.tabs_align_end': 'Fin',
|
|
90
|
+
'container.tabs_layout': 'Disposición',
|
|
91
|
+
'container.tabs_layout_horizontal': 'Horizontal',
|
|
92
|
+
'container.tabs_layout_vertical': 'Vertical',
|
|
93
|
+
'container.tabs_layout_vertical_from': 'Vertical desde {breakpoint}',
|
|
77
94
|
'container.add_accordion': 'Acordeón',
|
|
78
95
|
'container.add_accordion_item': 'Añadir apartado',
|
|
79
96
|
'container.accordion_label': 'Apartado {number}',
|
|
@@ -124,9 +141,8 @@ GridEditor.locales.es = {
|
|
|
124
141
|
'utility.default': 'Por defecto',
|
|
125
142
|
'utility.inherit': 'Hereda: {value} (de {breakpoint})',
|
|
126
143
|
'utility.varies': 'Cambia en {breakpoints}; elegir aquí lo sustituye',
|
|
127
|
-
'utility.
|
|
144
|
+
'utility.display': 'Display',
|
|
128
145
|
'utility.visibility_hidden': 'Oculto',
|
|
129
|
-
'utility.visibility_shown': 'Visible',
|
|
130
146
|
'tool.hide_in_view': 'Ocultar en esta vista',
|
|
131
147
|
'tool.show_in_view': 'Mostrar en esta vista',
|
|
132
148
|
'badge.hidden_in': 'Oculto en {breakpoints}',
|
|
@@ -138,6 +154,16 @@ GridEditor.locales.es = {
|
|
|
138
154
|
'badge.order': 'Orden: {value}',
|
|
139
155
|
'utility.justify_content': 'Justificar columnas',
|
|
140
156
|
'utility.align_items': 'Alinear columnas',
|
|
157
|
+
'utility.align_content': 'Alinear líneas',
|
|
158
|
+
'utility.flex_direction': 'Dirección',
|
|
159
|
+
'utility.flex_wrap': 'Salto de línea',
|
|
160
|
+
'utility.gap': 'Separación',
|
|
161
|
+
'utility.row_gap': 'Separación entre filas',
|
|
162
|
+
'utility.column_gap': 'Separación entre columnas',
|
|
163
|
+
'utility.flex_fill': 'Rellenar',
|
|
164
|
+
'utility.flex_grow': 'Crecer',
|
|
165
|
+
'utility.flex_shrink': 'Encoger',
|
|
166
|
+
'utility.sticky': 'Fijo al desplazar',
|
|
141
167
|
'utility.align_self': 'Alinearse',
|
|
142
168
|
'utility.gutters': 'Espaciado entre columnas',
|
|
143
169
|
'utility.gutters_x': 'Espaciado horizontal',
|
|
@@ -169,6 +195,7 @@ GridEditor.locales.es = {
|
|
|
169
195
|
'style.section_text': 'Texto',
|
|
170
196
|
'style.section_typography': 'Tipografía',
|
|
171
197
|
'style.section_display': 'Visualización',
|
|
198
|
+
'style.section_flex': 'Flex',
|
|
172
199
|
'style.section_position': 'Posición',
|
|
173
200
|
'style.section_custom': 'CSS libre',
|
|
174
201
|
'style.all_sizes': 'Se aplica a todos los tamaños',
|
|
@@ -228,15 +255,12 @@ GridEditor.locales.es = {
|
|
|
228
255
|
'style.prop_left': 'Izquierda',
|
|
229
256
|
'style.prop_z_index': 'Z-index',
|
|
230
257
|
'error.sortable_missing': '¡SortableJS no está disponible! Asegúrate de haber cargado el archivo js de Sortable; sin él no se puede arrastrar.',
|
|
231
|
-
'warning.setting_removed': 'El ajuste {setting} se eliminó en la 4.0. Usa {replacement} en su lugar.',
|
|
232
258
|
'warning.already_editing': 'Este elemento ya tiene un editor: se devuelve ese, con las opciones con las que se creó.',
|
|
233
259
|
'warning.destroyed': 'Se ha llamado a {method}() en un editor destruido, y no hace nada.',
|
|
234
260
|
'warning.duplicate_build': 'grideditor.js se ha cargado dos veces: se mantiene el primer GridEditor.',
|
|
235
|
-
'warning.plugin_6x': 'El plugin "{name}" está escrito para grid-editor 6 y no se carga. Desde la 7.0 los plugins se registran en GridEditor: consulta UPGRADING.md.',
|
|
236
261
|
'warning.adapter_no_jquery': 'grideditor.jquery.js necesita jQuery 4 y la página no tiene jQuery: la API de jQuery no está disponible.',
|
|
237
|
-
'warning.oninit_removed': 'La opción oninit de tinyMCE se eliminó en la 7.0 y se ignora: usa init_instance_callback.',
|
|
238
262
|
'error.tinymce_missing': '¡tinyMCE no está disponible! Asegúrate de haber cargado el archivo js de tinyMCE.',
|
|
239
|
-
'error.ckeditor_missing': '¡CKEditor 5 no está disponible! Asegúrate de haber cargado su archivo ckeditor5.umd.js
|
|
263
|
+
'error.ckeditor_missing': '¡CKEditor 5 no está disponible! Asegúrate de haber cargado su archivo ckeditor5.umd.js.',
|
|
240
264
|
'error.ckeditor_start': 'CKEditor no ha podido arrancar: {message}',
|
|
241
265
|
'warning.ckeditor_plugin': 'CKEditor no tiene ningún plugin llamado {name}, así que se deja fuera.',
|
|
242
266
|
'error.codemirror_missing': '¡CodeMirror no está disponible! Asegúrate de haber cargado el archivo js de CodeMirror; sin él el código se edita en un textarea normal.',
|