@themarioga/grid-editor 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -329,6 +329,7 @@ The inline-style plugin's accordion, in a node's settings panel or in the dialog
329
329
  | `inline_style.shadow_color` | Color | A part of the shadow builder |
330
330
  | `inline_style.shadow_inset` | Inset | The shadow builder's inset checkbox |
331
331
  | `inline_style.shadow_text_mode` | Edit as text | Link under the shadow builder that edits the value as text |
332
+ | `inline_style.shadow_builder_mode` | Edit with the builder | Link under a shadow edited as text that goes back to the builder, when the value is one shadow or none |
332
333
  | `inline_style.prop_width` | Width | Label of the `width` field |
333
334
  | `inline_style.prop_height` | Height | Label of the `height` field |
334
335
  | `inline_style.prop_min_width` | Min width | Label of the `min-width` field |
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": "8.0.0",
36
+ "version": "8.1.0",
37
37
  "main": "dist/grideditor.js",
38
38
  "module": "dist/grideditor.esm.js",
39
39
  "types": "dist/grideditor.d.ts",
@@ -142,10 +142,14 @@ var NESTED_SETTINGS = {
142
142
  auto: false, // Treat every child of a content area as an element
143
143
  },
144
144
  resize: {
145
- enabled: true,
145
+ enabled: true, // The handle on the column's edge
146
+ tools: true, // The narrower and wider tools in the column's drawer
146
147
  handles: 'e', // Which edges carry a handle: 'e', 'w', or 'e, w'
147
148
  balance: 'next', // 'next' takes the units out of the following column
148
149
  },
150
+ indent: {
151
+ tools: true, // The indent tools in the column's drawer
152
+ },
149
153
  drag: {
150
154
  delay: 0, // Milliseconds to hold before a drag starts
151
155
  touch_delay: 100, // The same for touch, where 0 eats the page's scrolling
@@ -380,6 +384,7 @@ function build(instance, baseElem, optionsOrMethod) {
380
384
  'layout_modes' : VIEW_KEYS.slice(), // Which views the dropdown offers
381
385
  'default_view' : ALL_VIEW,
382
386
  'resize' : NESTED_SETTINGS.resize, // Resizing a column by dragging its edge
387
+ 'indent' : NESTED_SETTINGS.indent, // Indenting a column, offset-*
383
388
  'source_textarea' : '',
384
389
  'edit_source' : true, // The toolbar's button to edit the canvas as html
385
390
  'locale' : 'en', // Code of a locale in GridEditor.locales
@@ -2973,30 +2978,34 @@ function build(instance, baseElem, optionsOrMethod) {
2973
2978
 
2974
2979
  createMoveTool(drawer);
2975
2980
 
2976
- createTool(drawer, t('tool.column_narrower'), 'ge-decrease-col-width', 'bi bi-dash-lg', function(e) {
2977
- resizeColumn(col, e.shiftKey
2978
- ? smallest(settings.valid_col_sizes)
2979
- : stepThrough(settings.valid_col_sizes.filter(isUnits), currentUnits(col), -1),
2980
- 'tool');
2981
- });
2981
+ if (settings.resize.tools !== false) {
2982
+ createTool(drawer, t('tool.column_narrower'), 'ge-decrease-col-width', 'bi bi-dash-lg', function(e) {
2983
+ resizeColumn(col, e.shiftKey
2984
+ ? smallest(settings.valid_col_sizes)
2985
+ : stepThrough(settings.valid_col_sizes.filter(isUnits), currentUnits(col), -1),
2986
+ 'tool');
2987
+ });
2982
2988
 
2983
- createTool(drawer, t('tool.column_wider'), 'ge-increase-col-width', 'bi bi-plus-lg', function(e) {
2984
- resizeColumn(col, e.shiftKey
2985
- ? widestFor(col)
2986
- : stepThrough(settings.valid_col_sizes.filter(isUnits), currentUnits(col), 1),
2987
- 'tool');
2988
- });
2989
+ createTool(drawer, t('tool.column_wider'), 'ge-increase-col-width', 'bi bi-plus-lg', function(e) {
2990
+ resizeColumn(col, e.shiftKey
2991
+ ? widestFor(col)
2992
+ : stepThrough(settings.valid_col_sizes.filter(isUnits), currentUnits(col), 1),
2993
+ 'tool');
2994
+ });
2995
+ }
2989
2996
 
2990
- createTool(drawer, t('tool.indent_decrease'), 'ge-decrease-col-offset', 'bi bi-text-indent-right', function(e) {
2991
- indentColumn(col, e.shiftKey
2992
- ? smallest(settings.valid_col_offsets)
2993
- : stepThrough(settings.valid_col_offsets, currentOffset(col), -1),
2994
- 'tool');
2995
- });
2997
+ if (settings.indent.tools !== false) {
2998
+ createTool(drawer, t('tool.indent_decrease'), 'ge-decrease-col-offset', 'bi bi-text-indent-right', function(e) {
2999
+ indentColumn(col, e.shiftKey
3000
+ ? smallest(settings.valid_col_offsets)
3001
+ : stepThrough(settings.valid_col_offsets, currentOffset(col), -1),
3002
+ 'tool');
3003
+ });
2996
3004
 
2997
- createTool(drawer, t('tool.indent_increase'), 'ge-increase-col-offset', 'bi bi-text-indent-left', function(e) {
2998
- indentColumn(col, e.shiftKey ? deepestFor(col) : stepThrough(settings.valid_col_offsets, currentOffset(col), 1), 'tool');
2999
- });
3005
+ createTool(drawer, t('tool.indent_increase'), 'ge-increase-col-offset', 'bi bi-text-indent-left', function(e) {
3006
+ indentColumn(col, e.shiftKey ? deepestFor(col) : stepThrough(settings.valid_col_offsets, currentOffset(col), 1), 'tool');
3007
+ });
3008
+ }
3000
3009
 
3001
3010
  addSettingsTool(drawer, col, settings.col_classes);
3002
3011
 
@@ -276,6 +276,16 @@ function shadowControl(ge, node, property, changed) {
276
276
  }
277
277
  writeValue(input.value, input);
278
278
  });
279
+
280
+ // Back to the builder, when it can hold the value: one shadow, or none
281
+ if (parseShadow(value, box)) {
282
+ var toBuilder = holder.appendChild(dom.element('a', { href: '#', 'class': 'ge-inline-style-shadow-mode' }, ge.t('inline_style.shadow_builder_mode')));
283
+ toBuilder.addEventListener('click', function(e) {
284
+ e.preventDefault();
285
+ textMode = false;
286
+ render();
287
+ });
288
+ }
279
289
  }
280
290
 
281
291
  var shown = null; // The value the builder or the text was last built for
@@ -210,6 +210,7 @@ GridEditor.locales.es = {
210
210
  'inline_style.shadow_color': 'Color',
211
211
  'inline_style.shadow_inset': 'Interior',
212
212
  'inline_style.shadow_text_mode': 'Editar como texto',
213
+ 'inline_style.shadow_builder_mode': 'Editar con el constructor',
213
214
  'inline_style.prop_width': 'Ancho',
214
215
  'inline_style.prop_height': 'Alto',
215
216
  'inline_style.prop_min_width': 'Ancho mínimo',
@@ -59,6 +59,7 @@ Object.assign(GridEditor.locales.en, {
59
59
  'inline_style.shadow_color': 'Color',
60
60
  'inline_style.shadow_inset': 'Inset',
61
61
  'inline_style.shadow_text_mode': 'Edit as text',
62
+ 'inline_style.shadow_builder_mode': 'Edit with the builder',
62
63
  'inline_style.prop_width': 'Width',
63
64
  'inline_style.prop_height': 'Height',
64
65
  'inline_style.prop_min_width': 'Min width',
@@ -124,7 +124,10 @@ export interface GridEditorOptions {
124
124
  add_column?: { size?: ColumnSize | null; picker?: boolean; delay?: number };
125
125
  layout_modes?: View[];
126
126
  default_view?: View;
127
- resize?: { enabled?: boolean; handles?: string; balance?: 'next' | false };
127
+ /** enabled is the handle on the column's edge, tools the narrower and wider tools in its drawer. */
128
+ resize?: { enabled?: boolean; tools?: boolean; handles?: string; balance?: 'next' | false };
129
+ /** tools is the indent tools in a column's drawer. */
130
+ indent?: { tools?: boolean };
128
131
  /** A textarea whose html the canvas starts with. */
129
132
  source_textarea?: Target | '';
130
133
  edit_source?: boolean;