@themarioga/grid-editor 8.3.0 → 8.5.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +43 -1
  3. package/dist/grideditor.bundle.min.js +3 -3
  4. package/dist/grideditor.css +49 -0
  5. package/dist/grideditor.d.ts +21 -1
  6. package/dist/grideditor.esm.js +211 -9
  7. package/dist/grideditor.js +211 -9
  8. package/dist/grideditor.min.css +1 -1
  9. package/dist/grideditor.min.css.map +1 -1
  10. package/dist/grideditor.min.js +2 -2
  11. package/dist/grideditor.min.js.map +3 -3
  12. package/dist/locales/grideditor.es.esm.js +4 -0
  13. package/dist/locales/grideditor.es.js +4 -0
  14. package/dist/locales/grideditor.es.min.js +1 -1
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.ckeditor.esm.js +1 -0
  17. package/dist/plugins/grideditor.ckeditor.js +1 -0
  18. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  19. package/dist/plugins/grideditor.ckeditor.min.js.map +2 -2
  20. package/dist/plugins/grideditor.elements.esm.js +72 -1
  21. package/dist/plugins/grideditor.elements.js +72 -1
  22. package/dist/plugins/grideditor.elements.min.js +1 -1
  23. package/dist/plugins/grideditor.elements.min.js.map +3 -3
  24. package/dist/plugins/grideditor.sections.esm.js +1 -0
  25. package/dist/plugins/grideditor.sections.js +1 -0
  26. package/dist/plugins/grideditor.sections.min.js +1 -1
  27. package/dist/plugins/grideditor.sections.min.js.map +2 -2
  28. package/dist/plugins/grideditor.summernote.esm.js +1 -0
  29. package/dist/plugins/grideditor.summernote.js +1 -0
  30. package/dist/plugins/grideditor.summernote.min.js +1 -1
  31. package/dist/plugins/grideditor.summernote.min.js.map +2 -2
  32. package/dist/plugins/grideditor.tinymce.esm.js +1 -0
  33. package/dist/plugins/grideditor.tinymce.js +1 -0
  34. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  35. package/dist/plugins/grideditor.tinymce.min.js.map +2 -2
  36. package/docs/locale-keys.md +5 -1
  37. package/docs/plugins.md +24 -1
  38. package/package.json +1 -1
  39. package/src/js/grideditor.js +252 -8
  40. package/src/js/locales/grideditor.es.js +4 -0
  41. package/src/js/plugins/grideditor.elements.js +94 -1
  42. package/src/js/plugins/grideditor.sections.js +1 -0
  43. package/src/js/text/grideditor.text.js +1 -0
  44. package/src/less/grideditor.less +58 -0
  45. package/types/grideditor.d.ts +21 -1
@@ -67,6 +67,18 @@
67
67
  margin-left: 5px;
68
68
  }
69
69
 
70
+ /* toolbar_groups: the tabs choosing which category of add buttons
71
+ shows, at the start of the line. Never squeezed, and never behind the
72
+ more button */
73
+ .ge-toolbar-groups {
74
+ flex: none;
75
+ margin-right: 8px;
76
+
77
+ > .btn {
78
+ white-space: nowrap;
79
+ }
80
+ }
81
+
70
82
  /* toolbar_overflow: 'menu'. The add buttons keep to one line, and the
71
83
  ones that don't fit go behind a button at its end. The right-hand
72
84
  buttons come before in the markup, so they are ordered back to how
@@ -94,6 +106,15 @@
94
106
  flex: 1 1 auto;
95
107
  min-width: 0;
96
108
  overflow: hidden;
109
+
110
+ /* A group as wide as its buttons and a button as wide as its label:
111
+ squeezed, they would wrap their labels rather than overflow */
112
+ > .btn-group {
113
+ flex: none;
114
+ }
115
+ .btn {
116
+ white-space: nowrap;
117
+ }
97
118
  }
98
119
 
99
120
  .ge-toolbar-more {
@@ -1114,6 +1135,43 @@
1114
1135
  }
1115
1136
  }
1116
1137
 
1138
+ /* drawer_overflow: 'menu'. A drawer keeps its tools to one line; the ones
1139
+ that don't fit are hidden behind a more tool at its end, which unfolds it
1140
+ to show them all */
1141
+ .ge-canvas.ge-editing .ge-tools-drawer.ge-drawer-fit {
1142
+ white-space: nowrap;
1143
+
1144
+ > .ge-details {
1145
+ white-space: normal;
1146
+ }
1147
+ > a.ge-tool-overflow,
1148
+ > a.ge-drawer-more {
1149
+ display: none;
1150
+ }
1151
+
1152
+ &.ge-drawer-overflow {
1153
+ padding-right: 26px;
1154
+
1155
+ > a.ge-drawer-more {
1156
+ display: inline-block;
1157
+ position: absolute;
1158
+ top: 0;
1159
+ right: 0;
1160
+ }
1161
+ }
1162
+
1163
+ &.ge-drawer-expanded {
1164
+ white-space: normal;
1165
+
1166
+ > a.ge-tool-overflow {
1167
+ display: inline-block;
1168
+ }
1169
+ > a.ge-drawer-more {
1170
+ background: rgba(0, 0, 0, 0.08);
1171
+ }
1172
+ }
1173
+ }
1174
+
1117
1175
  /* The handle belongs to editing, and never to the output */
1118
1176
  .ge-canvas:not(.ge-editing) .ge-resize-handle {
1119
1177
  display: none;
@@ -109,6 +109,10 @@ export interface GridEditorOptions {
109
109
  toolbar_drag?: 'auto' | boolean;
110
110
  /** The add buttons that don't fit on the toolbar's line: behind a more button, or onto another line. Default 'menu'. */
111
111
  toolbar_overflow?: 'menu' | 'wrap';
112
+ /** The drawers' tools that don't fit on one line: behind a more tool, or onto more lines. Default 'menu'. */
113
+ drawer_overflow?: 'menu' | 'wrap';
114
+ /** The add buttons in categories - rows, content, and a plugin's own - one shown at a time, chosen with tabs. Default false. */
115
+ toolbar_groups?: boolean;
112
116
  /** A click in a column or a section makes it where the toolbar's buttons add. Default false. */
113
117
  active_target?: boolean;
114
118
  /** The plugins to use, of any kind; null is every one loaded. */
@@ -121,7 +125,7 @@ export interface GridEditorOptions {
121
125
  inline_style?: InlineStyleOptions;
122
126
  /** The tabs plugin: the variant of the tabs containers made new. */
123
127
  tabs?: TabsOptions;
124
- elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean };
128
+ elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
125
129
  custom_filter?: CustomFilter | CustomFilter[] | '';
126
130
  valid_col_sizes?: ColumnSize[];
127
131
  valid_col_offsets?: number[];
@@ -282,6 +286,22 @@ export type GridEditorCallbacks = {
282
286
  };
283
287
 
284
288
  /** A plugin's factory: called once per editor with the handle in docs/plugins.md. */
289
+ /** An element the toolbar offers, from elements.types. */
290
+ export interface ElementType {
291
+ /** What it is: its data-ge-element. */
292
+ type: string;
293
+ /** Its markup: html, or a function called for each one made that returns html or a node. */
294
+ html: string | (() => string | Node);
295
+ /** Its button's label, as it is. */
296
+ label?: string;
297
+ /** Its button's label, a locale key: wins over label, and follows setLocale. */
298
+ labelKey?: string;
299
+ /** The button shows this icon alone, with the label as its title. */
300
+ iconClass?: string;
301
+ /** Its toolbar_groups category. Default 'elements'. */
302
+ group?: string;
303
+ }
304
+
285
305
  export type PluginFactory = ((ge: any) => Record<string, unknown>) & { always?: boolean };
286
306
 
287
307
  export interface CreateColumnOptions extends Placement {