@themarioga/grid-editor 7.2.0 → 8.0.0-beta.2
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 +101 -0
- package/README.md +96 -30
- package/UPGRADING.md +86 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +149 -6
- package/dist/grideditor.d.ts +18 -0
- package/dist/grideditor.esm.js +257 -48
- 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 +257 -48
- 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 +80 -6
- package/dist/locales/grideditor.es.js +80 -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 +1926 -0
- package/dist/plugins/grideditor.style.js +1923 -0
- package/dist/plugins/grideditor.style.min.js +4 -0
- package/dist/plugins/grideditor.style.min.js.map +7 -0
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.min.js.map +2 -2
- 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 +99 -15
- package/docs/plugins.md +47 -23
- package/example/ckeditor.html +0 -5
- package/example/index.html +17 -2
- package/example/style.html +163 -0
- package/example/utilities.html +21 -16
- 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 +336 -67
- package/src/js/locales/grideditor.es.js +80 -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 +185 -0
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +168 -0
- package/src/js/style/catalog.js +76 -0
- package/src/js/style/custom.js +84 -0
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/fields.js +382 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/{plugins/grideditor.float.js → style/float.js} +6 -16
- package/src/js/style/options.js +60 -0
- package/src/js/style/sections.js +298 -0
- package/src/js/{plugins/grideditor.spacing.js → style/spacing.js} +7 -19
- package/src/js/style/sticky.js +39 -0
- package/src/js/{plugins/grideditor.textalign.js → style/textalign.js} +6 -14
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +151 -10
- package/types/grideditor.d.ts +18 -0
- package/dist/plugins/grideditor.float.esm.js +0 -34
- package/dist/plugins/grideditor.float.js +0 -41
- 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 -318
- package/dist/plugins/grideditor.spacing.js +0 -323
- 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 -40
- package/dist/plugins/grideditor.textalign.js +0 -47
- 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 -158
- package/dist/plugins/grideditor.visibility.js +0 -163
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.visibility.js +0 -171
|
@@ -124,9 +124,8 @@ GridEditor.locales.es = {
|
|
|
124
124
|
'utility.default': 'Por defecto',
|
|
125
125
|
'utility.inherit': 'Hereda: {value} (de {breakpoint})',
|
|
126
126
|
'utility.varies': 'Cambia en {breakpoints}; elegir aquí lo sustituye',
|
|
127
|
-
'utility.
|
|
127
|
+
'utility.display': 'Display',
|
|
128
128
|
'utility.visibility_hidden': 'Oculto',
|
|
129
|
-
'utility.visibility_shown': 'Visible',
|
|
130
129
|
'tool.hide_in_view': 'Ocultar en esta vista',
|
|
131
130
|
'tool.show_in_view': 'Mostrar en esta vista',
|
|
132
131
|
'badge.hidden_in': 'Oculto en {breakpoints}',
|
|
@@ -138,6 +137,16 @@ GridEditor.locales.es = {
|
|
|
138
137
|
'badge.order': 'Orden: {value}',
|
|
139
138
|
'utility.justify_content': 'Justificar columnas',
|
|
140
139
|
'utility.align_items': 'Alinear columnas',
|
|
140
|
+
'utility.align_content': 'Alinear líneas',
|
|
141
|
+
'utility.flex_direction': 'Dirección',
|
|
142
|
+
'utility.flex_wrap': 'Salto de línea',
|
|
143
|
+
'utility.gap': 'Separación',
|
|
144
|
+
'utility.row_gap': 'Separación entre filas',
|
|
145
|
+
'utility.column_gap': 'Separación entre columnas',
|
|
146
|
+
'utility.flex_fill': 'Rellenar',
|
|
147
|
+
'utility.flex_grow': 'Crecer',
|
|
148
|
+
'utility.flex_shrink': 'Encoger',
|
|
149
|
+
'utility.sticky': 'Fijo al desplazar',
|
|
141
150
|
'utility.align_self': 'Alinearse',
|
|
142
151
|
'utility.gutters': 'Espaciado entre columnas',
|
|
143
152
|
'utility.gutters_x': 'Espaciado horizontal',
|
|
@@ -160,16 +169,81 @@ GridEditor.locales.es = {
|
|
|
160
169
|
'utility.float_end': 'Fin',
|
|
161
170
|
'utility.float_none': 'Ninguno',
|
|
162
171
|
'utility.spacing_gutter': 'El relleno lateral de una columna es su espaciado: cambiarlo cambia el espacio entre columnas',
|
|
172
|
+
'style.section_title': 'Estilo',
|
|
173
|
+
'style.dialog_title': 'Estilo: {kind}',
|
|
174
|
+
'style.section_size': 'Tamaño',
|
|
175
|
+
'style.section_spacing': 'Espaciado',
|
|
176
|
+
'style.section_border': 'Borde',
|
|
177
|
+
'style.section_background': 'Fondo',
|
|
178
|
+
'style.section_text': 'Texto',
|
|
179
|
+
'style.section_typography': 'Tipografía',
|
|
180
|
+
'style.section_display': 'Visualización',
|
|
181
|
+
'style.section_flex': 'Flex',
|
|
182
|
+
'style.section_position': 'Posición',
|
|
183
|
+
'style.section_custom': 'CSS libre',
|
|
184
|
+
'style.all_sizes': 'Se aplica a todos los tamaños',
|
|
185
|
+
'style.overridden': 'La clase {class} tiene prioridad sobre este valor',
|
|
186
|
+
'style.invalid': 'Esta propiedad no acepta ese valor',
|
|
187
|
+
'style.catalog': 'Clases de Bootstrap',
|
|
188
|
+
'style.shadow_x': 'X',
|
|
189
|
+
'style.shadow_y': 'Y',
|
|
190
|
+
'style.shadow_blur': 'Desenfoque',
|
|
191
|
+
'style.shadow_spread': 'Extensión',
|
|
192
|
+
'style.shadow_color': 'Color',
|
|
193
|
+
'style.shadow_inset': 'Interior',
|
|
194
|
+
'style.shadow_text_mode': 'Editar como texto',
|
|
195
|
+
'style.prop_width': 'Ancho',
|
|
196
|
+
'style.prop_height': 'Alto',
|
|
197
|
+
'style.prop_min_width': 'Ancho mínimo',
|
|
198
|
+
'style.prop_min_height': 'Alto mínimo',
|
|
199
|
+
'style.prop_max_width': 'Ancho máximo',
|
|
200
|
+
'style.prop_max_height': 'Alto máximo',
|
|
201
|
+
'style.prop_margin_top': 'Margen superior',
|
|
202
|
+
'style.prop_margin_right': 'Margen derecho',
|
|
203
|
+
'style.prop_margin_bottom': 'Margen inferior',
|
|
204
|
+
'style.prop_margin_left': 'Margen izquierdo',
|
|
205
|
+
'style.prop_padding_top': 'Relleno superior',
|
|
206
|
+
'style.prop_padding_right': 'Relleno derecho',
|
|
207
|
+
'style.prop_padding_bottom': 'Relleno inferior',
|
|
208
|
+
'style.prop_padding_left': 'Relleno izquierdo',
|
|
209
|
+
'style.prop_border_width': 'Grosor del borde',
|
|
210
|
+
'style.prop_border_style': 'Estilo del borde',
|
|
211
|
+
'style.prop_border_color': 'Color del borde',
|
|
212
|
+
'style.prop_border_radius': 'Radio del borde',
|
|
213
|
+
'style.prop_box_shadow': 'Sombra',
|
|
214
|
+
'style.prop_background_color': 'Color de fondo',
|
|
215
|
+
'style.prop_background_image': 'Imagen de fondo',
|
|
216
|
+
'style.prop_background_size': 'Tamaño del fondo',
|
|
217
|
+
'style.prop_background_position': 'Posición del fondo',
|
|
218
|
+
'style.prop_background_repeat': 'Repetición del fondo',
|
|
219
|
+
'style.prop_color': 'Color',
|
|
220
|
+
'style.prop_font_size': 'Tamaño de letra',
|
|
221
|
+
'style.prop_text_align': 'Alineación',
|
|
222
|
+
'style.prop_text_shadow': 'Sombra del texto',
|
|
223
|
+
'style.prop_font_family': 'Fuente',
|
|
224
|
+
'style.prop_font_weight': 'Grosor de letra',
|
|
225
|
+
'style.prop_font_style': 'Estilo de letra',
|
|
226
|
+
'style.prop_line_height': 'Interlineado',
|
|
227
|
+
'style.prop_letter_spacing': 'Espaciado entre letras',
|
|
228
|
+
'style.prop_text_transform': 'Mayúsculas',
|
|
229
|
+
'style.prop_text_decoration': 'Decoración',
|
|
230
|
+
'style.prop_display': 'Display',
|
|
231
|
+
'style.prop_opacity': 'Opacidad',
|
|
232
|
+
'style.prop_overflow': 'Desbordamiento',
|
|
233
|
+
'style.prop_visibility': 'Visibilidad',
|
|
234
|
+
'style.prop_position': 'Posición',
|
|
235
|
+
'style.prop_top': 'Arriba',
|
|
236
|
+
'style.prop_right': 'Derecha',
|
|
237
|
+
'style.prop_bottom': 'Abajo',
|
|
238
|
+
'style.prop_left': 'Izquierda',
|
|
239
|
+
'style.prop_z_index': 'Z-index',
|
|
163
240
|
'error.sortable_missing': '¡SortableJS no está disponible! Asegúrate de haber cargado el archivo js de Sortable; sin él no se puede arrastrar.',
|
|
164
|
-
'warning.setting_removed': 'El ajuste {setting} se eliminó en la 4.0. Usa {replacement} en su lugar.',
|
|
165
241
|
'warning.already_editing': 'Este elemento ya tiene un editor: se devuelve ese, con las opciones con las que se creó.',
|
|
166
242
|
'warning.destroyed': 'Se ha llamado a {method}() en un editor destruido, y no hace nada.',
|
|
167
243
|
'warning.duplicate_build': 'grideditor.js se ha cargado dos veces: se mantiene el primer GridEditor.',
|
|
168
|
-
'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.',
|
|
169
244
|
'warning.adapter_no_jquery': 'grideditor.jquery.js necesita jQuery 4 y la página no tiene jQuery: la API de jQuery no está disponible.',
|
|
170
|
-
'warning.oninit_removed': 'La opción oninit de tinyMCE se eliminó en la 7.0 y se ignora: usa init_instance_callback.',
|
|
171
245
|
'error.tinymce_missing': '¡tinyMCE no está disponible! Asegúrate de haber cargado el archivo js de tinyMCE.',
|
|
172
|
-
'error.ckeditor_missing': '¡CKEditor 5 no está disponible! Asegúrate de haber cargado su archivo ckeditor5.umd.js
|
|
246
|
+
'error.ckeditor_missing': '¡CKEditor 5 no está disponible! Asegúrate de haber cargado su archivo ckeditor5.umd.js.',
|
|
173
247
|
'error.ckeditor_start': 'CKEditor no ha podido arrancar: {message}',
|
|
174
248
|
'warning.ckeditor_plugin': 'CKEditor no tiene ningún plugin llamado {name}, así que se deja fuera.',
|
|
175
249
|
'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.',
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Alignment for grid-editor.
|
|
3
3
|
*
|
|
4
|
-
* A utility plugin: load this file after the editor and a
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* handle its factory is called with, described in docs/plugins.md.
|
|
4
|
+
* A utility plugin: load this file after the editor and a column can align
|
|
5
|
+
* itself in its row, per breakpoint, with Bootstrap's align-self-{breakpoint}-*
|
|
6
|
+
* classes. What it can ask the editor for is the handle its factory is called
|
|
7
|
+
* with, described in docs/plugins.md.
|
|
9
8
|
*
|
|
10
9
|
* <script src="dist/grideditor.min.js"></script>
|
|
11
10
|
* <script src="dist/plugins/grideditor.alignment.min.js"></script>
|
|
12
11
|
*
|
|
13
|
-
*
|
|
12
|
+
* How a row justifies and aligns its columns - justify-content-* and
|
|
13
|
+
* align-items-* - is a flex container's, and the style plugin's Flex section
|
|
14
|
+
* edits it, on a row and on anything else made flex.
|
|
15
|
+
*
|
|
16
|
+
* A field only, in the settings panel: alignment is set now and then, not
|
|
14
17
|
* clicked through, and a drawer is short of room.
|
|
15
18
|
*/
|
|
16
19
|
import { GridEditor } from '../grideditor.js';
|
|
17
20
|
|
|
18
21
|
Object.assign(GridEditor.locales.en, {
|
|
19
|
-
'utility.justify_content': 'Justify columns',
|
|
20
|
-
'utility.align_items': 'Align columns',
|
|
21
22
|
'utility.align_self': 'Align self',
|
|
22
23
|
});
|
|
23
24
|
|
|
@@ -26,54 +27,24 @@ var FLEX = {
|
|
|
26
27
|
start: 'flex-start',
|
|
27
28
|
end: 'flex-end',
|
|
28
29
|
center: 'center',
|
|
29
|
-
between: 'space-between',
|
|
30
|
-
around: 'space-around',
|
|
31
|
-
evenly: 'space-evenly',
|
|
32
30
|
baseline: 'baseline',
|
|
33
31
|
stretch: 'stretch',
|
|
34
32
|
auto: 'auto',
|
|
35
33
|
};
|
|
36
34
|
|
|
37
|
-
/**
|
|
38
|
-
* A family whose preview is its one css property. `none` is what the
|
|
39
|
-
* property is when no class says anything, which a view has to show over a
|
|
40
|
-
* wider breakpoint's class that is live in a wide window.
|
|
41
|
-
*/
|
|
42
|
-
function family(definition) {
|
|
43
|
-
return Object.assign({
|
|
44
|
-
prefix: definition.name,
|
|
45
|
-
preview: function(value) {
|
|
46
|
-
var styles = {};
|
|
47
|
-
styles[definition.name] = value === null ? definition.none : FLEX[value];
|
|
48
|
-
return styles;
|
|
49
|
-
},
|
|
50
|
-
}, definition);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
35
|
GridEditor.utilities.alignment = function() {
|
|
54
36
|
return {
|
|
55
|
-
families: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
appliesTo: ['row'],
|
|
68
|
-
none: 'normal',
|
|
69
|
-
}),
|
|
70
|
-
family({
|
|
71
|
-
name: 'align-self',
|
|
72
|
-
labelKey: 'utility.align_self',
|
|
73
|
-
values: ['auto', 'start', 'center', 'end', 'baseline', 'stretch'],
|
|
74
|
-
appliesTo: ['column'],
|
|
75
|
-
none: 'auto',
|
|
76
|
-
}),
|
|
77
|
-
],
|
|
37
|
+
families: [{
|
|
38
|
+
name: 'align-self',
|
|
39
|
+
prefix: 'align-self',
|
|
40
|
+
labelKey: 'utility.align_self',
|
|
41
|
+
values: ['auto', 'start', 'center', 'end', 'baseline', 'stretch'],
|
|
42
|
+
appliesTo: ['column'],
|
|
43
|
+
|
|
44
|
+
/** Without a class, auto: what the row's align-items says. */
|
|
45
|
+
preview: function(value) {
|
|
46
|
+
return { 'align-self': value === null ? 'auto' : FLEX[value] };
|
|
47
|
+
},
|
|
48
|
+
}],
|
|
78
49
|
};
|
|
79
50
|
};
|
|
@@ -11,15 +11,13 @@
|
|
|
11
11
|
* <script src="dist/grideditor.min.js"></script>
|
|
12
12
|
* <script src="dist/plugins/grideditor.ckeditor.min.js"></script>
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 'GPL', or a commercial key, is the host's to pass in ckeditor.config.
|
|
14
|
+
* CKEditor 5 asks for a license key, GPL or a commercial one, which is the
|
|
15
|
+
* host's to pass in ckeditor.config.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* in its classic script, installed once however many editors a page loads.
|
|
17
|
+
* It imports what every text editor shares - text blocks, the Text button,
|
|
18
|
+
* createText, making the host's plain content a text - from
|
|
19
|
+
* src/js/text/grideditor.text.js, which the build puts in its classic
|
|
20
|
+
* script, installed once however many editors a page loads.
|
|
23
21
|
*/
|
|
24
22
|
import { GridEditor } from '../grideditor.js';
|
|
25
23
|
import * as dom from '../dom.js';
|
|
@@ -34,8 +32,8 @@ Object.assign(GridEditor.locales.en, {
|
|
|
34
32
|
var INITIAL_CONTENT = '<p>Lorem initius... </p>';
|
|
35
33
|
|
|
36
34
|
// What CKEditor 5 is started with when the host's config does not say. It
|
|
37
|
-
// has no plugins of its own, so these are what a text can do
|
|
38
|
-
//
|
|
35
|
+
// has no plugins of its own, so these are what a text can do. Names, looked
|
|
36
|
+
// up on window.CKEDITOR.
|
|
39
37
|
var PLUGINS = [
|
|
40
38
|
'Essentials', 'Autoformat', 'Paragraph', 'Heading', 'Bold', 'Italic', 'Underline', 'Strikethrough',
|
|
41
39
|
'Link', 'AutoLink', 'List', 'BlockQuote', 'Indent', 'HorizontalLine', 'Table', 'TableToolbar',
|
|
@@ -122,9 +120,6 @@ GridEditor.texts.ckeditor = function(ge) {
|
|
|
122
120
|
|
|
123
121
|
var configuration = Object.assign({}, DEFAULTS, userConfig);
|
|
124
122
|
configuration.plugins = pluginsFor(ge, userConfig.plugins || PLUGINS);
|
|
125
|
-
// on.instanceReady is CKEditor 4's, and CKEditor 5 has no
|
|
126
|
-
// such option: this file calls it, as it did in 7.1
|
|
127
|
-
delete configuration.on;
|
|
128
123
|
|
|
129
124
|
var ticket = {};
|
|
130
125
|
starting.set(contentArea, ticket);
|
|
@@ -144,13 +139,6 @@ GridEditor.texts.ckeditor = function(ge) {
|
|
|
144
139
|
starting.delete(contentArea);
|
|
145
140
|
editors.set(contentArea, editor);
|
|
146
141
|
|
|
147
|
-
// Call the original instanceReady function, if one was
|
|
148
|
-
// passed in the config: 7.1's, with CKEditor 4's event
|
|
149
|
-
var callback = userConfig.on && userConfig.on.instanceReady;
|
|
150
|
-
if (callback) {
|
|
151
|
-
callback.call(editor, { editor: editor });
|
|
152
|
-
}
|
|
153
|
-
|
|
154
142
|
// The editor owns what is inside the content area now,
|
|
155
143
|
// so the grid editor is told to put its own furniture back
|
|
156
144
|
ge.textReady(contentArea);
|
|
@@ -173,9 +161,8 @@ GridEditor.texts.ckeditor = function(ge) {
|
|
|
173
161
|
contentAreas.filter(function(contentArea) {
|
|
174
162
|
return dom.hasClass(contentArea, 'active');
|
|
175
163
|
}).forEach(function(contentArea) {
|
|
176
|
-
// This content area's editor, and no other:
|
|
177
|
-
//
|
|
178
|
-
// the page, other editors' and the host's own included
|
|
164
|
+
// This content area's editor, and no other: the other
|
|
165
|
+
// CKEditors on the page, the host's own included, stay
|
|
179
166
|
var editor = editors.get(contentArea);
|
|
180
167
|
editors.delete(contentArea);
|
|
181
168
|
// One still starting sees this and goes as it is ready
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style for grid-editor.
|
|
3
|
+
*
|
|
4
|
+
* A utility plugin: load this file after the editor and every row, column,
|
|
5
|
+
* container, pane, element and section gets a Style accordion in its
|
|
6
|
+
* settings panel - size, spacing, border, background, text, typography,
|
|
7
|
+
* display, flex, position and free css - written to the node's own style
|
|
8
|
+
* attribute, with Bootstrap's classes for each section as chips that put
|
|
9
|
+
* them in the classes field. What it can ask the editor for is the handle
|
|
10
|
+
* its factory is called with, described in docs/plugins.md.
|
|
11
|
+
*
|
|
12
|
+
* <script src="dist/grideditor.min.js"></script>
|
|
13
|
+
* <script src="dist/plugins/grideditor.style.min.js"></script>
|
|
14
|
+
*
|
|
15
|
+
* It also edits spacing, text alignment, display, flex, sticky and float,
|
|
16
|
+
* Bootstrap's responsive classes, per breakpoint in its sections. On a node
|
|
17
|
+
* that is flex or grid, the drawer leaves the flow, so the canvas lays the
|
|
18
|
+
* content out as the page will.
|
|
19
|
+
*
|
|
20
|
+
* Where the settings panel has no room for it - a popover, inline in the
|
|
21
|
+
* drawer - the accordion opens in a dialog, from a Style button.
|
|
22
|
+
*
|
|
23
|
+
* style.sections chooses the sections, and in each the properties and
|
|
24
|
+
* whether it has a catalog; style.spacing is the options of spacing, whose
|
|
25
|
+
* scale the gaps share, and style.visibility those of the eye.
|
|
26
|
+
*/
|
|
27
|
+
import { GridEditor } from '../grideditor.js';
|
|
28
|
+
import { spacingPart } from '../style/spacing.js';
|
|
29
|
+
import { textalignPart } from '../style/textalign.js';
|
|
30
|
+
import { displayPart } from '../style/display.js';
|
|
31
|
+
import { flexPart } from '../style/flex.js';
|
|
32
|
+
import { floatPart } from '../style/float.js';
|
|
33
|
+
import { stickyPart } from '../style/sticky.js';
|
|
34
|
+
import { drawerflowPart } from '../style/drawerflow.js';
|
|
35
|
+
import { resolveOptions } from '../style/options.js';
|
|
36
|
+
import { createAccordion } from '../style/accordion.js';
|
|
37
|
+
|
|
38
|
+
Object.assign(GridEditor.locales.en, {
|
|
39
|
+
'style.section_title': 'Style',
|
|
40
|
+
'style.dialog_title': 'Style: {kind}',
|
|
41
|
+
'style.section_size': 'Size',
|
|
42
|
+
'style.section_spacing': 'Spacing',
|
|
43
|
+
'style.section_border': 'Border',
|
|
44
|
+
'style.section_background': 'Background',
|
|
45
|
+
'style.section_text': 'Text',
|
|
46
|
+
'style.section_typography': 'Typography',
|
|
47
|
+
'style.section_display': 'Display',
|
|
48
|
+
'style.section_flex': 'Flex',
|
|
49
|
+
'style.section_position': 'Position',
|
|
50
|
+
'style.section_custom': 'Custom css',
|
|
51
|
+
'style.all_sizes': 'Applies to every size',
|
|
52
|
+
'style.overridden': 'The class {class} takes priority over this value',
|
|
53
|
+
'style.invalid': 'Not a value this property takes',
|
|
54
|
+
'style.catalog': 'Bootstrap classes',
|
|
55
|
+
'style.shadow_x': 'X',
|
|
56
|
+
'style.shadow_y': 'Y',
|
|
57
|
+
'style.shadow_blur': 'Blur',
|
|
58
|
+
'style.shadow_spread': 'Spread',
|
|
59
|
+
'style.shadow_color': 'Color',
|
|
60
|
+
'style.shadow_inset': 'Inset',
|
|
61
|
+
'style.shadow_text_mode': 'Edit as text',
|
|
62
|
+
'style.prop_width': 'Width',
|
|
63
|
+
'style.prop_height': 'Height',
|
|
64
|
+
'style.prop_min_width': 'Min width',
|
|
65
|
+
'style.prop_min_height': 'Min height',
|
|
66
|
+
'style.prop_max_width': 'Max width',
|
|
67
|
+
'style.prop_max_height': 'Max height',
|
|
68
|
+
'style.prop_margin_top': 'Margin top',
|
|
69
|
+
'style.prop_margin_right': 'Margin right',
|
|
70
|
+
'style.prop_margin_bottom': 'Margin bottom',
|
|
71
|
+
'style.prop_margin_left': 'Margin left',
|
|
72
|
+
'style.prop_padding_top': 'Padding top',
|
|
73
|
+
'style.prop_padding_right': 'Padding right',
|
|
74
|
+
'style.prop_padding_bottom': 'Padding bottom',
|
|
75
|
+
'style.prop_padding_left': 'Padding left',
|
|
76
|
+
'style.prop_border_width': 'Border width',
|
|
77
|
+
'style.prop_border_style': 'Border style',
|
|
78
|
+
'style.prop_border_color': 'Border color',
|
|
79
|
+
'style.prop_border_radius': 'Border radius',
|
|
80
|
+
'style.prop_box_shadow': 'Shadow',
|
|
81
|
+
'style.prop_background_color': 'Background color',
|
|
82
|
+
'style.prop_background_image': 'Background image',
|
|
83
|
+
'style.prop_background_size': 'Background size',
|
|
84
|
+
'style.prop_background_position': 'Background position',
|
|
85
|
+
'style.prop_background_repeat': 'Background repeat',
|
|
86
|
+
'style.prop_color': 'Color',
|
|
87
|
+
'style.prop_font_size': 'Font size',
|
|
88
|
+
'style.prop_text_align': 'Text align',
|
|
89
|
+
'style.prop_text_shadow': 'Text shadow',
|
|
90
|
+
'style.prop_font_family': 'Font family',
|
|
91
|
+
'style.prop_font_weight': 'Font weight',
|
|
92
|
+
'style.prop_font_style': 'Font style',
|
|
93
|
+
'style.prop_line_height': 'Line height',
|
|
94
|
+
'style.prop_letter_spacing': 'Letter spacing',
|
|
95
|
+
'style.prop_text_transform': 'Text transform',
|
|
96
|
+
'style.prop_text_decoration': 'Text decoration',
|
|
97
|
+
'style.prop_display': 'Display',
|
|
98
|
+
'style.prop_opacity': 'Opacity',
|
|
99
|
+
'style.prop_overflow': 'Overflow',
|
|
100
|
+
'style.prop_visibility': 'Visibility',
|
|
101
|
+
'style.prop_position': 'Position',
|
|
102
|
+
'style.prop_top': 'Top',
|
|
103
|
+
'style.prop_right': 'Right',
|
|
104
|
+
'style.prop_bottom': 'Bottom',
|
|
105
|
+
'style.prop_left': 'Left',
|
|
106
|
+
'style.prop_z_index': 'Z-index',
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// The drawer's part last: it asks the browser how the others left the node
|
|
110
|
+
var PARTS = ['spacing', 'textalign', 'display', 'flex', 'float', 'sticky', 'drawerflow'];
|
|
111
|
+
|
|
112
|
+
GridEditor.utilities.style = function(ge) {
|
|
113
|
+
|
|
114
|
+
var options = resolveOptions(ge);
|
|
115
|
+
var parts = {
|
|
116
|
+
spacing: spacingPart(ge, options.spacing),
|
|
117
|
+
textalign: textalignPart(ge),
|
|
118
|
+
display: displayPart(ge, options.visibility),
|
|
119
|
+
flex: flexPart(ge, options.spacing),
|
|
120
|
+
float: floatPart(ge),
|
|
121
|
+
sticky: stickyPart(ge),
|
|
122
|
+
drawerflow: drawerflowPart(ge),
|
|
123
|
+
};
|
|
124
|
+
var accordions = []; // { node, accordion } for every panel built since the last init
|
|
125
|
+
var context = {
|
|
126
|
+
sections: options.sections,
|
|
127
|
+
parts: parts,
|
|
128
|
+
state: { open: null },
|
|
129
|
+
opened: function(key) {
|
|
130
|
+
accordions.forEach(function(entry) { entry.accordion.open(key); });
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** Every part's hook, called in turn. */
|
|
135
|
+
function each(hook) {
|
|
136
|
+
return function() {
|
|
137
|
+
var args = arguments;
|
|
138
|
+
PARTS.forEach(function(name) {
|
|
139
|
+
if (parts[name][hook]) { parts[name][hook].apply(null, args); }
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var partsRefresh = each('onRefresh');
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
// The parts' families, edited in the sections rather than in Responsive
|
|
148
|
+
families: PARTS.reduce(function(all, name) {
|
|
149
|
+
return all.concat(parts[name].families.map(function(family) {
|
|
150
|
+
return Object.assign({}, family, { panel: false });
|
|
151
|
+
}));
|
|
152
|
+
}, []),
|
|
153
|
+
|
|
154
|
+
panelSection: function(node, kind) {
|
|
155
|
+
var accordion = createAccordion(ge, node, kind, context);
|
|
156
|
+
if (!accordion) { return null; }
|
|
157
|
+
|
|
158
|
+
accordions.push({ node: node, accordion: accordion });
|
|
159
|
+
|
|
160
|
+
return { labelKey: 'style.section_title', titleKey: 'style.dialog_title', body: accordion.element };
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
preview: function(node, kind, breakpoint) {
|
|
164
|
+
return parts.spacing.preview(node, kind, breakpoint);
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
// After a write, a change of classes or of view: the accordions of
|
|
168
|
+
// the nodes it touched follow
|
|
169
|
+
onRefresh: function(scope) {
|
|
170
|
+
partsRefresh(scope);
|
|
171
|
+
|
|
172
|
+
accordions = accordions.filter(function(entry) { return entry.accordion.element.isConnected; });
|
|
173
|
+
accordions.forEach(function(entry) {
|
|
174
|
+
if (entry.node === scope || scope.contains(entry.node)) { entry.accordion.render(); }
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
drawerTools: each('drawerTools'),
|
|
179
|
+
|
|
180
|
+
onDeinit: function() {
|
|
181
|
+
each('onDeinit')();
|
|
182
|
+
accordions = [];
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
};
|
|
@@ -16,11 +16,10 @@
|
|
|
16
16
|
* nothing else. Towards the editor it is plain DOM, like every plugin, and
|
|
17
17
|
* it needs no jQuery adapter.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* in its classic script, installed once however many editors a page loads.
|
|
19
|
+
* It imports what every text editor shares - text blocks, the Text button,
|
|
20
|
+
* createText, making the host's plain content a text - from
|
|
21
|
+
* src/js/text/grideditor.text.js, which the build puts in its classic
|
|
22
|
+
* script, installed once however many editors a page loads.
|
|
24
23
|
*/
|
|
25
24
|
import { GridEditor } from '../grideditor.js';
|
|
26
25
|
import * as dom from '../dom.js';
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
* <script src="dist/grideditor.min.js"></script>
|
|
11
11
|
* <script src="dist/plugins/grideditor.tinymce.min.js"></script>
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* in its classic script, installed once however many editors a page loads.
|
|
13
|
+
* It imports what every text editor shares - text blocks, the Text button,
|
|
14
|
+
* createText, making the host's plain content a text - from
|
|
15
|
+
* src/js/text/grideditor.text.js, which the build puts in its classic
|
|
16
|
+
* script, installed once however many editors a page loads.
|
|
18
17
|
*/
|
|
19
18
|
import { GridEditor } from '../grideditor.js';
|
|
20
19
|
import * as dom from '../dom.js';
|
|
@@ -22,7 +21,6 @@ import '../text/grideditor.text.js';
|
|
|
22
21
|
|
|
23
22
|
Object.assign(GridEditor.locales.en, {
|
|
24
23
|
'text.tinymce': 'tinyMCE',
|
|
25
|
-
'warning.oninit_removed': 'tinyMCE\'s oninit option was removed in 7.0 and is ignored: use init_instance_callback.',
|
|
26
24
|
});
|
|
27
25
|
|
|
28
26
|
// tinyMCE snapshots the target element's attributes when an inline editor is
|
|
@@ -42,9 +40,6 @@ var INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';
|
|
|
42
40
|
var editors = new WeakMap();
|
|
43
41
|
var pendingRemove = new WeakSet();
|
|
44
42
|
|
|
45
|
-
// Said once per page, however many editors are on it
|
|
46
|
-
var warnedOninit = false;
|
|
47
|
-
|
|
48
43
|
GridEditor.texts.tinymce = function(ge) {
|
|
49
44
|
return {
|
|
50
45
|
labelKey: 'text.tinymce',
|
|
@@ -57,13 +52,6 @@ GridEditor.texts.tinymce = function(ge) {
|
|
|
57
52
|
var settings = ge.settings;
|
|
58
53
|
var userConfig = (settings.tinymce && settings.tinymce.config) ? settings.tinymce.config : {};
|
|
59
54
|
|
|
60
|
-
// 'oninit' was the pre-6 name for init_instance_callback, honoured
|
|
61
|
-
// through 6.x and gone in 7.0
|
|
62
|
-
if (userConfig.oninit && !warnedOninit) {
|
|
63
|
-
warnedOninit = true;
|
|
64
|
-
ge.warn(ge.t('warning.oninit_removed'));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
55
|
contentAreas.forEach(function(contentArea) {
|
|
68
56
|
if (dom.hasClass(contentArea, 'active')) { return; }
|
|
69
57
|
|
|
@@ -147,7 +135,6 @@ GridEditor.texts.tinymce = function(ge) {
|
|
|
147
135
|
// We always edit the element we were handed, so a selector in the
|
|
148
136
|
// user config would only fight with target
|
|
149
137
|
delete configuration.selector;
|
|
150
|
-
delete configuration.oninit;
|
|
151
138
|
|
|
152
139
|
window.tinymce.init(configuration);
|
|
153
140
|
});
|