@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
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Floating elements for grid-editor.
|
|
3
|
-
*
|
|
4
|
-
* A utility plugin: load this file after the editor and after the elements
|
|
5
|
-
* plugin, and an element can float to the start or the end of its content
|
|
6
|
-
* area per breakpoint, with the text around it, using Bootstrap's
|
|
7
|
-
* float-{breakpoint}-start, -end and -none classes. What it can ask the
|
|
8
|
-
* editor for is the handle its factory is called with, described in
|
|
9
|
-
* docs/plugins.md.
|
|
10
|
-
*
|
|
11
|
-
* <script src="dist/grideditor.min.js"></script>
|
|
12
|
-
* <script src="dist/plugins/grideditor.elements.min.js"></script>
|
|
13
|
-
* <script src="dist/plugins/grideditor.float.min.js"></script>
|
|
14
|
-
*
|
|
15
|
-
* Elements only. A floated row or column stops being part of the grid, and a
|
|
16
|
-
* container sits beside the content areas rather than in their text.
|
|
17
|
-
*
|
|
18
|
-
* Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this
|
|
19
|
-
* plugin's families, and edits them in its own sections. This file is that
|
|
20
|
-
* part on its own, as it was, and says so once per editor. Loaded beside
|
|
21
|
-
* the style plugin, it stands down.
|
|
22
|
-
*/
|
|
23
|
-
import { GridEditor } from '../grideditor.js';
|
|
24
|
-
import { floatPart } from '../style/float.js';
|
|
25
|
-
|
|
26
|
-
GridEditor.utilities.float = function(ge) {
|
|
27
|
-
ge.warn('the "float" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
28
|
-
return floatPart(ge);
|
|
29
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spacing for grid-editor.
|
|
3
|
-
*
|
|
4
|
-
* A utility plugin: load this file after the editor and every row, column,
|
|
5
|
-
* element and container can have its padding and margin set per breakpoint,
|
|
6
|
-
* with Bootstrap's p-{breakpoint}-*, pt-, px- … and m-{breakpoint}-*, mt-, mx-
|
|
7
|
-
* … classes. What it can ask the editor for is the handle its factory is
|
|
8
|
-
* called with, described in docs/plugins.md.
|
|
9
|
-
*
|
|
10
|
-
* <script src="dist/grideditor.min.js"></script>
|
|
11
|
-
* <script src="dist/plugins/grideditor.spacing.min.js"></script>
|
|
12
|
-
*
|
|
13
|
-
* Fourteen families would be fourteen fields, so the panel has two, padding
|
|
14
|
-
* and margin, each a choice of side and a value for that side.
|
|
15
|
-
*
|
|
16
|
-
* utilities.spacing.values narrows the values offered, and
|
|
17
|
-
* utilities.spacing.scale is what 0 to 5 come to, for a page that changed
|
|
18
|
-
* Bootstrap's $spacers.
|
|
19
|
-
*
|
|
20
|
-
* Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this
|
|
21
|
-
* plugin's families, and edits them in its own sections. This file is that
|
|
22
|
-
* part on its own, as it was, and says so once per editor. Loaded beside
|
|
23
|
-
* the style plugin, it stands down.
|
|
24
|
-
*/
|
|
25
|
-
import { GridEditor } from '../grideditor.js';
|
|
26
|
-
import { spacingPart } from '../style/spacing.js';
|
|
27
|
-
|
|
28
|
-
GridEditor.utilities.spacing = function(ge) {
|
|
29
|
-
ge.warn('the "spacing" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
30
|
-
return spacingPart(ge, ge.settings.utilities.spacing);
|
|
31
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text alignment for grid-editor.
|
|
3
|
-
*
|
|
4
|
-
* A utility plugin: load this file after the editor and a row, column,
|
|
5
|
-
* element or container can align its text per breakpoint, with Bootstrap's
|
|
6
|
-
* text-{breakpoint}-start, -center and -end classes. What it can ask the
|
|
7
|
-
* editor for is the handle its factory is called with, described in
|
|
8
|
-
* docs/plugins.md.
|
|
9
|
-
*
|
|
10
|
-
* <script src="dist/grideditor.min.js"></script>
|
|
11
|
-
* <script src="dist/plugins/grideditor.textalign.min.js"></script>
|
|
12
|
-
*
|
|
13
|
-
* The class aligns everything inside the node that does not align itself: a
|
|
14
|
-
* paragraph the rich text editor gave its own text-align keeps it.
|
|
15
|
-
*
|
|
16
|
-
* Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this
|
|
17
|
-
* plugin's families, and edits them in its own sections. This file is that
|
|
18
|
-
* part on its own, as it was, and says so once per editor. Loaded beside
|
|
19
|
-
* the style plugin, it stands down.
|
|
20
|
-
*/
|
|
21
|
-
import { GridEditor } from '../grideditor.js';
|
|
22
|
-
import { textalignPart } from '../style/textalign.js';
|
|
23
|
-
|
|
24
|
-
GridEditor.utilities.textalign = function(ge) {
|
|
25
|
-
ge.warn('the "textalign" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
26
|
-
return textalignPart(ge);
|
|
27
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Visibility for grid-editor.
|
|
3
|
-
*
|
|
4
|
-
* A utility plugin: load this file after the editor and every row, column,
|
|
5
|
-
* element and container can be hidden at some breakpoints and shown at
|
|
6
|
-
* others, with Bootstrap's d-{breakpoint}-none and d-{breakpoint}-block (or
|
|
7
|
-
* -flex, for a row, which is a flex container and stops being a grid as a
|
|
8
|
-
* block). What it can ask the editor for is the handle its factory is called
|
|
9
|
-
* with, described in docs/plugins.md.
|
|
10
|
-
*
|
|
11
|
-
* <script src="dist/grideditor.min.js"></script>
|
|
12
|
-
* <script src="dist/plugins/grideditor.visibility.min.js"></script>
|
|
13
|
-
*
|
|
14
|
-
* A hidden node is never hidden from the editor, which would leave nothing to
|
|
15
|
-
* click to show it again. It stays on the canvas, faded and striped in a view
|
|
16
|
-
* where it is hidden, and in the all view says at which breakpoints it is.
|
|
17
|
-
*
|
|
18
|
-
* utilities.visibility.drawer: false leaves the eye out of the drawers, and
|
|
19
|
-
* the panel field is the only control.
|
|
20
|
-
*
|
|
21
|
-
* Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this
|
|
22
|
-
* plugin's families, and edits them in its own sections. This file is that
|
|
23
|
-
* part on its own, as it was, and says so once per editor. Loaded beside
|
|
24
|
-
* the style plugin, it stands down.
|
|
25
|
-
*/
|
|
26
|
-
import { GridEditor } from '../grideditor.js';
|
|
27
|
-
import { visibilityPart } from '../style/visibility.js';
|
|
28
|
-
|
|
29
|
-
GridEditor.utilities.visibility = function(ge) {
|
|
30
|
-
ge.warn('the "visibility" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
31
|
-
return visibilityPart(ge, ge.settings.utilities.visibility);
|
|
32
|
-
};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Visibility, a part of the style plugin: hiding and showing per breakpoint, with Bootstrap's d-{breakpoint}-none
|
|
3
|
-
* and d-{breakpoint}-block or -flex classes, and the eye in the drawers.
|
|
4
|
-
*
|
|
5
|
-
* The part is what the visibility plugin was up to 7.2 - its families, and
|
|
6
|
-
* whatever it did on the canvas - as a function of the handle and its options.
|
|
7
|
-
* grideditor.style.js puts it in its sections; the deprecated
|
|
8
|
-
* grideditor.visibility.js still registers it on its own, as it always did.
|
|
9
|
-
*/
|
|
10
|
-
import { GridEditor } from '../grideditor.js';
|
|
11
|
-
import * as dom from '../dom.js';
|
|
12
|
-
|
|
13
|
-
Object.assign(GridEditor.locales.en, {
|
|
14
|
-
'utility.visibility': 'Visibility',
|
|
15
|
-
'utility.visibility_hidden': 'Hidden',
|
|
16
|
-
'utility.visibility_shown': 'Shown',
|
|
17
|
-
'tool.hide_in_view': 'Hide in this view',
|
|
18
|
-
'tool.show_in_view': 'Show in this view',
|
|
19
|
-
'badge.hidden_in': 'Hidden at {breakpoints}',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
/** A node that carries any class of the family, at any breakpoint. */
|
|
23
|
-
var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
|
|
24
|
-
|
|
25
|
-
var NODES = '.row, .column, .ge-content, .ge-element, [data-ge-container]';
|
|
26
|
-
|
|
27
|
-
export function visibilityPart(ge, given) {
|
|
28
|
-
|
|
29
|
-
var options = Object.assign({ drawer: true }, given);
|
|
30
|
-
|
|
31
|
-
/** What "shown" is written as on this kind of node. */
|
|
32
|
-
function shown(kind) {
|
|
33
|
-
return kind === 'row' ? 'flex' : 'block';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function applies(node, kind) {
|
|
37
|
-
return kind === 'row' || kind === 'column' || kind === 'element' || kind === 'text' || kind === 'plain' ||
|
|
38
|
-
dom.is(node, '[data-ge-container]');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function hiddenAt(node, view) {
|
|
42
|
-
return ge.getUtility(node, 'visibility', view) === 'none';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** The breakpoints at which the node is hidden, smallest first. */
|
|
46
|
-
function hiddenTiers(node) {
|
|
47
|
-
return ge.breakpoints.filter(function(key) { return hiddenAt(node, key); });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Whether the node is hidden in the view being edited. In the all view
|
|
52
|
-
* that means hidden at every breakpoint, since "hidden at some" is what
|
|
53
|
-
* the badge is for.
|
|
54
|
-
*/
|
|
55
|
-
function hiddenHere(node) {
|
|
56
|
-
return ge.view() === 'all'
|
|
57
|
-
? hiddenTiers(node).length === ge.breakpoints.length
|
|
58
|
-
: hiddenAt(node, ge.view());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** What the breakpoint below the view shows, which an inherit falls back to. */
|
|
62
|
-
function hiddenBelow(node) {
|
|
63
|
-
var index = ge.breakpoints.indexOf(ge.view());
|
|
64
|
-
|
|
65
|
-
return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Hide or show the node in the view being edited, with as few classes as
|
|
70
|
-
* that takes. In a breakpoint view that is often none at all: showing a
|
|
71
|
-
* node the breakpoint below shows removes this breakpoint's d-*-none
|
|
72
|
-
* rather than writing a d-*-block on top of it. In the all view a node
|
|
73
|
-
* is hidden everywhere or shown everywhere, and shown is no class.
|
|
74
|
-
*/
|
|
75
|
-
function toggle(node, kind) {
|
|
76
|
-
var hide = !hiddenHere(node);
|
|
77
|
-
var value;
|
|
78
|
-
|
|
79
|
-
if (ge.view() === 'all') {
|
|
80
|
-
value = hide ? 'none' : null;
|
|
81
|
-
} else if (hide) {
|
|
82
|
-
value = hiddenBelow(node) ? null : 'none';
|
|
83
|
-
} else {
|
|
84
|
-
value = hiddenBelow(node) ? shown(kind) : null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
ge.setUtility(node, 'visibility', value, { source: 'tool' });
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The canvas shows each node as the view sees it. ge-visibility keeps a
|
|
92
|
-
* node Bootstrap would hide on the canvas, ge-hidden-in-view fades it,
|
|
93
|
-
* and data-ge-hidden-in carries the badge text for the all view.
|
|
94
|
-
*/
|
|
95
|
-
function mark(scope) {
|
|
96
|
-
dom.selfAndAll(scope, NODES).forEach(function(node) {
|
|
97
|
-
var kind = ge.kindOf(node);
|
|
98
|
-
var carries = applies(node, kind) && CLASS_PATTERN.test(node.getAttribute('class') || '');
|
|
99
|
-
var tiers = carries ? hiddenTiers(node) : [];
|
|
100
|
-
var here = carries && hiddenHere(node);
|
|
101
|
-
var partly = carries && ge.view() === 'all' && tiers.length > 0 && !here;
|
|
102
|
-
|
|
103
|
-
dom.toggleClass(node, 'ge-visibility', carries);
|
|
104
|
-
dom.toggleClass(node, 'ge-hidden-in-view', here);
|
|
105
|
-
|
|
106
|
-
if (partly) {
|
|
107
|
-
node.setAttribute('data-ge-hidden-in', ge.t('badge.hidden_in', { breakpoints: tiers.join(', ') }));
|
|
108
|
-
} else {
|
|
109
|
-
node.removeAttribute('data-ge-hidden-in');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
dom.children(node, '.ge-tools-drawer').forEach(function(drawer) {
|
|
113
|
-
dom.children(drawer, '.ge-visibility-tool').forEach(function(tool) {
|
|
114
|
-
tool.setAttribute('title', here ? ge.t('tool.show_in_view') : ge.t('tool.hide_in_view'));
|
|
115
|
-
dom.all(tool, 'i').forEach(function(icon) {
|
|
116
|
-
icon.setAttribute('class', here ? 'bi bi-eye-slash' : 'bi bi-eye');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function unmark() {
|
|
124
|
-
dom.all(ge.canvas, '.ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]').forEach(function(node) {
|
|
125
|
-
dom.removeClass(node, 'ge-visibility ge-hidden-in-view');
|
|
126
|
-
node.removeAttribute('data-ge-hidden-in');
|
|
127
|
-
dom.dropEmptyClass(node);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
families: [{
|
|
133
|
-
name: 'visibility',
|
|
134
|
-
prefix: 'd',
|
|
135
|
-
values: ['none', 'block', 'flex'],
|
|
136
|
-
appliesTo: ['row', 'column', 'text', 'element', 'container'],
|
|
137
|
-
labelKey: 'utility.visibility',
|
|
138
|
-
|
|
139
|
-
/** Hidden, or shown the way this kind of node is shown. */
|
|
140
|
-
choices: function(node, kind) {
|
|
141
|
-
return ['none', shown(kind)];
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
label: function(value) {
|
|
145
|
-
return value === 'none' ? ge.t('utility.visibility_hidden') : ge.t('utility.visibility_shown');
|
|
146
|
-
},
|
|
147
|
-
}],
|
|
148
|
-
|
|
149
|
-
drawerTools: function(drawer, node, kind) {
|
|
150
|
-
if (!options.drawer || !applies(node, kind)) { return; }
|
|
151
|
-
|
|
152
|
-
ge.createTool(drawer, ge.t('tool.hide_in_view'), 'ge-visibility-tool', 'bi bi-eye', function() {
|
|
153
|
-
toggle(node, kind);
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
onRefresh: mark,
|
|
158
|
-
onDeinit: unmark,
|
|
159
|
-
};
|
|
160
|
-
}
|