@themarioga/grid-editor 9.0.0-beta.2 → 9.0.0-beta.4
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 +34 -0
- package/README.md +76 -8
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +187 -0
- package/dist/grideditor.d.ts +75 -0
- package/dist/grideditor.esm.js +38 -11
- package/dist/grideditor.js +38 -11
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +22 -0
- package/dist/locales/grideditor.es.js +22 -0
- package/dist/locales/grideditor.es.min.js +2 -2
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.history.esm.js +360 -0
- package/dist/plugins/grideditor.history.js +365 -0
- package/dist/plugins/grideditor.history.min.js +1 -0
- package/dist/plugins/grideditor.history.min.js.map +7 -0
- package/dist/plugins/grideditor.offcanvas.esm.js +551 -0
- package/dist/plugins/grideditor.offcanvas.js +556 -0
- package/dist/plugins/grideditor.offcanvas.min.js +1 -0
- package/dist/plugins/grideditor.offcanvas.min.js.map +7 -0
- package/dist/plugins/grideditor.popup.esm.js +90 -37
- package/dist/plugins/grideditor.popup.js +90 -37
- package/dist/plugins/grideditor.popup.min.js +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +4 -4
- package/docs/events.md +7 -3
- package/docs/locale-keys.md +32 -1
- package/docs/plugins.md +19 -5
- package/example/clipboard.html +22 -0
- package/example/containers.html +22 -4
- package/example/history.html +94 -0
- package/example/index.html +9 -1
- package/package.json +1 -1
- package/src/js/grideditor.js +37 -9
- package/src/js/locales/grideditor.es.js +22 -0
- package/src/js/plugins/grideditor.history.js +367 -0
- package/src/js/plugins/grideditor.offcanvas.js +420 -0
- package/src/js/plugins/grideditor.popup.js +8 -70
- package/src/js/triggers/triggers.js +121 -0
- package/src/less/grideditor.less +60 -0
- package/types/grideditor.d.ts +75 -0
package/dist/grideditor.css
CHANGED
|
@@ -626,6 +626,14 @@ html.ge-sidebar-open {
|
|
|
626
626
|
/* A popup is rendered unfolded and in place: a plain block with its
|
|
627
627
|
body as an ordinary region. Bootstrap's modal JS is never asked to
|
|
628
628
|
open it, so there is no backdrop, no focus trap and no scroll lock */
|
|
629
|
+
/* An offcanvas is rendered unfolded and in place too: a plain block with
|
|
630
|
+
its body as an ordinary region, whichever edge it comes from on the
|
|
631
|
+
page. Bootstrap fixes it to the window, hides it and shifts it out
|
|
632
|
+
until its own JS adds .show, which the editor never asks for, so what
|
|
633
|
+
it sets is undone here. The responsive classes hide the header and
|
|
634
|
+
the body's padding from their breakpoint up, where the panel is
|
|
635
|
+
content: the title still has to be there to edit */
|
|
636
|
+
/* A trigger pointing at an offcanvas that is not there any more */
|
|
629
637
|
/* A trigger pointing at a popup that is not there any more */
|
|
630
638
|
/* Elements: the level below a column, inside a content area. Dashed
|
|
631
639
|
rather than solid, so a page full of them still reads as content */
|
|
@@ -925,6 +933,185 @@ html.ge-sidebar-open {
|
|
|
925
933
|
.ge-canvas.ge-editing .ge-container-popup.ge-popup-collapsed .modal {
|
|
926
934
|
display: none;
|
|
927
935
|
}
|
|
936
|
+
.ge-canvas.ge-editing .ge-container-offcanvas {
|
|
937
|
+
/* d-*-none on the trigger is for the page: the editor needs it to select the container */
|
|
938
|
+
/* Folded away, for a page with several offcanvases on it */
|
|
939
|
+
}
|
|
940
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas {
|
|
941
|
+
position: static;
|
|
942
|
+
z-index: auto;
|
|
943
|
+
visibility: visible;
|
|
944
|
+
width: auto;
|
|
945
|
+
height: auto;
|
|
946
|
+
max-width: none;
|
|
947
|
+
max-height: none;
|
|
948
|
+
margin: 5px 0;
|
|
949
|
+
transform: none;
|
|
950
|
+
transition: none;
|
|
951
|
+
display: flex;
|
|
952
|
+
flex-direction: column;
|
|
953
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
954
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
955
|
+
}
|
|
956
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas .offcanvas-header {
|
|
957
|
+
display: flex;
|
|
958
|
+
}
|
|
959
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas .offcanvas-body {
|
|
960
|
+
display: block;
|
|
961
|
+
flex-grow: 1;
|
|
962
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
963
|
+
overflow: visible;
|
|
964
|
+
}
|
|
965
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-sm {
|
|
966
|
+
position: static;
|
|
967
|
+
z-index: auto;
|
|
968
|
+
visibility: visible;
|
|
969
|
+
width: auto;
|
|
970
|
+
height: auto;
|
|
971
|
+
max-width: none;
|
|
972
|
+
max-height: none;
|
|
973
|
+
margin: 5px 0;
|
|
974
|
+
transform: none;
|
|
975
|
+
transition: none;
|
|
976
|
+
display: flex;
|
|
977
|
+
flex-direction: column;
|
|
978
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
979
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
980
|
+
}
|
|
981
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-sm .offcanvas-header {
|
|
982
|
+
display: flex;
|
|
983
|
+
}
|
|
984
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-sm .offcanvas-body {
|
|
985
|
+
display: block;
|
|
986
|
+
flex-grow: 1;
|
|
987
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
988
|
+
overflow: visible;
|
|
989
|
+
}
|
|
990
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-md {
|
|
991
|
+
position: static;
|
|
992
|
+
z-index: auto;
|
|
993
|
+
visibility: visible;
|
|
994
|
+
width: auto;
|
|
995
|
+
height: auto;
|
|
996
|
+
max-width: none;
|
|
997
|
+
max-height: none;
|
|
998
|
+
margin: 5px 0;
|
|
999
|
+
transform: none;
|
|
1000
|
+
transition: none;
|
|
1001
|
+
display: flex;
|
|
1002
|
+
flex-direction: column;
|
|
1003
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
1004
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
1005
|
+
}
|
|
1006
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-md .offcanvas-header {
|
|
1007
|
+
display: flex;
|
|
1008
|
+
}
|
|
1009
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-md .offcanvas-body {
|
|
1010
|
+
display: block;
|
|
1011
|
+
flex-grow: 1;
|
|
1012
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
1013
|
+
overflow: visible;
|
|
1014
|
+
}
|
|
1015
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-lg {
|
|
1016
|
+
position: static;
|
|
1017
|
+
z-index: auto;
|
|
1018
|
+
visibility: visible;
|
|
1019
|
+
width: auto;
|
|
1020
|
+
height: auto;
|
|
1021
|
+
max-width: none;
|
|
1022
|
+
max-height: none;
|
|
1023
|
+
margin: 5px 0;
|
|
1024
|
+
transform: none;
|
|
1025
|
+
transition: none;
|
|
1026
|
+
display: flex;
|
|
1027
|
+
flex-direction: column;
|
|
1028
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
1029
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
1030
|
+
}
|
|
1031
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-lg .offcanvas-header {
|
|
1032
|
+
display: flex;
|
|
1033
|
+
}
|
|
1034
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-lg .offcanvas-body {
|
|
1035
|
+
display: block;
|
|
1036
|
+
flex-grow: 1;
|
|
1037
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
1038
|
+
overflow: visible;
|
|
1039
|
+
}
|
|
1040
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xl {
|
|
1041
|
+
position: static;
|
|
1042
|
+
z-index: auto;
|
|
1043
|
+
visibility: visible;
|
|
1044
|
+
width: auto;
|
|
1045
|
+
height: auto;
|
|
1046
|
+
max-width: none;
|
|
1047
|
+
max-height: none;
|
|
1048
|
+
margin: 5px 0;
|
|
1049
|
+
transform: none;
|
|
1050
|
+
transition: none;
|
|
1051
|
+
display: flex;
|
|
1052
|
+
flex-direction: column;
|
|
1053
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
1054
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
1055
|
+
}
|
|
1056
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xl .offcanvas-header {
|
|
1057
|
+
display: flex;
|
|
1058
|
+
}
|
|
1059
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xl .offcanvas-body {
|
|
1060
|
+
display: block;
|
|
1061
|
+
flex-grow: 1;
|
|
1062
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
1063
|
+
overflow: visible;
|
|
1064
|
+
}
|
|
1065
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xxl {
|
|
1066
|
+
position: static;
|
|
1067
|
+
z-index: auto;
|
|
1068
|
+
visibility: visible;
|
|
1069
|
+
width: auto;
|
|
1070
|
+
height: auto;
|
|
1071
|
+
max-width: none;
|
|
1072
|
+
max-height: none;
|
|
1073
|
+
margin: 5px 0;
|
|
1074
|
+
transform: none;
|
|
1075
|
+
transition: none;
|
|
1076
|
+
display: flex;
|
|
1077
|
+
flex-direction: column;
|
|
1078
|
+
background-color: var(--bs-offcanvas-bg) !important;
|
|
1079
|
+
border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
|
|
1080
|
+
}
|
|
1081
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xxl .offcanvas-header {
|
|
1082
|
+
display: flex;
|
|
1083
|
+
}
|
|
1084
|
+
.ge-canvas.ge-editing .ge-container-offcanvas .offcanvas-xxl .offcanvas-body {
|
|
1085
|
+
display: block;
|
|
1086
|
+
flex-grow: 1;
|
|
1087
|
+
padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
|
|
1088
|
+
overflow: visible;
|
|
1089
|
+
}
|
|
1090
|
+
.ge-canvas.ge-editing .ge-container-offcanvas > .ge-offcanvas-trigger {
|
|
1091
|
+
display: inline-block !important;
|
|
1092
|
+
margin-bottom: 5px;
|
|
1093
|
+
}
|
|
1094
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas {
|
|
1095
|
+
display: none;
|
|
1096
|
+
}
|
|
1097
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas-sm {
|
|
1098
|
+
display: none;
|
|
1099
|
+
}
|
|
1100
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas-md {
|
|
1101
|
+
display: none;
|
|
1102
|
+
}
|
|
1103
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas-lg {
|
|
1104
|
+
display: none;
|
|
1105
|
+
}
|
|
1106
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas-xl {
|
|
1107
|
+
display: none;
|
|
1108
|
+
}
|
|
1109
|
+
.ge-canvas.ge-editing .ge-container-offcanvas.ge-offcanvas-collapsed .offcanvas-xxl {
|
|
1110
|
+
display: none;
|
|
1111
|
+
}
|
|
1112
|
+
.ge-canvas.ge-editing .ge-offcanvas-orphan {
|
|
1113
|
+
outline: 2px dashed #d9534f;
|
|
1114
|
+
}
|
|
928
1115
|
.ge-canvas.ge-editing .ge-popup-orphan {
|
|
929
1116
|
outline: 2px dashed #d9534f;
|
|
930
1117
|
}
|
package/dist/grideditor.d.ts
CHANGED
|
@@ -111,6 +111,35 @@ export interface CarouselOptions {
|
|
|
111
111
|
/** createContainer('carousel', …): the options, and how many slides. */
|
|
112
112
|
export interface CreateCarouselOptions extends Placement, CarouselOptions {}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The offcanvas plugin's options, the ones an offcanvas made new has, as the
|
|
116
|
+
* offcanvas setting gives them and createContainer overrides them: where it
|
|
117
|
+
* comes from, its backdrop, whether the page scrolls behind it, Esc, the
|
|
118
|
+
* breakpoint from which it is content and not a panel, and the dark theme.
|
|
119
|
+
*/
|
|
120
|
+
export interface OffcanvasOptions {
|
|
121
|
+
/** The edge it slides in from. Default `'start'`. */
|
|
122
|
+
placement?: 'start' | 'end' | 'top' | 'bottom';
|
|
123
|
+
/** A backdrop behind it: `true`, `false`, or `'static'`, which does not close it on a click. Default true. */
|
|
124
|
+
backdrop?: boolean | 'static';
|
|
125
|
+
/** The page can scroll while it is open. Default false. */
|
|
126
|
+
scroll?: boolean;
|
|
127
|
+
/** Esc closes it. Default true. */
|
|
128
|
+
keyboard?: boolean;
|
|
129
|
+
/** From this breakpoint up it is content in the page, and its trigger is hidden; null is a panel at every size. Default null. */
|
|
130
|
+
responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | null;
|
|
131
|
+
/** `data-bs-theme="dark"`. Default false. */
|
|
132
|
+
dark?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** createContainer('offcanvas', …): the options, its title and its trigger. */
|
|
136
|
+
export interface CreateOffcanvasOptions extends Placement, OffcanvasOptions {
|
|
137
|
+
title?: string;
|
|
138
|
+
/** false makes none, for a trigger the page writes itself. Default true. */
|
|
139
|
+
trigger?: boolean;
|
|
140
|
+
trigger_label?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
114
143
|
/** The inline-style plugin's settings. */
|
|
115
144
|
export interface InlineStyleOptions {
|
|
116
145
|
/** Every section is on unless it is turned off here. */
|
|
@@ -175,11 +204,15 @@ export interface GridEditorOptions {
|
|
|
175
204
|
tabs?: TabsOptions;
|
|
176
205
|
/** The carousel plugin: the options of the carousels made new. */
|
|
177
206
|
carousel?: CarouselOptions;
|
|
207
|
+
/** The offcanvas plugin: the options of the offcanvases made new. */
|
|
208
|
+
offcanvas?: OffcanvasOptions;
|
|
178
209
|
elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
|
|
179
210
|
/** The autosave plugin: what is edited, kept in the browser's storage as it changes. */
|
|
180
211
|
autosave?: AutosaveOptions;
|
|
181
212
|
/** The clipboard plugin. `shortcuts`: Ctrl+C and Ctrl+V on the node selected or the target; default active_target. */
|
|
182
213
|
clipboard?: { shortcuts?: boolean };
|
|
214
|
+
/** The history plugin: undo and redo. */
|
|
215
|
+
history?: HistoryOptions;
|
|
183
216
|
custom_filter?: CustomFilter | CustomFilter[] | '';
|
|
184
217
|
valid_col_sizes?: ColumnSize[];
|
|
185
218
|
valid_col_offsets?: number[];
|
|
@@ -222,6 +255,18 @@ export interface AutosaveOptions {
|
|
|
222
255
|
maxAge?: number | null;
|
|
223
256
|
}
|
|
224
257
|
|
|
258
|
+
/** The history plugin's options. */
|
|
259
|
+
export interface HistoryOptions {
|
|
260
|
+
/** Ctrl+Z, and Ctrl+Y or Ctrl+Shift+Z (⌘ on a Mac). Default true. */
|
|
261
|
+
shortcuts?: boolean;
|
|
262
|
+
/** The undo and redo buttons on the right of the toolbar. Default true. */
|
|
263
|
+
buttons?: boolean;
|
|
264
|
+
/** The steps that can be undone. Default 50. */
|
|
265
|
+
max?: number;
|
|
266
|
+
/** Milliseconds after the last change that make a step. Default 500. */
|
|
267
|
+
delay?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
225
270
|
/** A draft the autosave plugin kept. */
|
|
226
271
|
export interface AutosaveDraft {
|
|
227
272
|
html: string;
|
|
@@ -252,6 +297,19 @@ export interface AutosaveErrorPayload {
|
|
|
252
297
|
error: unknown;
|
|
253
298
|
}
|
|
254
299
|
|
|
300
|
+
export interface HistoryPayload {
|
|
301
|
+
canvas: HTMLElement;
|
|
302
|
+
/** The markup the canvas went to. */
|
|
303
|
+
html: string;
|
|
304
|
+
source: 'shortcut' | 'tool' | 'api';
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface HistoryChangePayload {
|
|
308
|
+
canvas: HTMLElement;
|
|
309
|
+
canUndo: boolean;
|
|
310
|
+
canRedo: boolean;
|
|
311
|
+
}
|
|
312
|
+
|
|
255
313
|
/** Where a node was, or went: its parent and its index among the blocks there. */
|
|
256
314
|
export interface Position {
|
|
257
315
|
parent: HTMLElement;
|
|
@@ -320,6 +378,10 @@ export interface PopupOrphanPayload extends Payload {
|
|
|
320
378
|
missing: string;
|
|
321
379
|
}
|
|
322
380
|
|
|
381
|
+
export interface OffcanvasOrphanPayload extends Payload {
|
|
382
|
+
missing: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
323
385
|
export interface ViewChangePayload {
|
|
324
386
|
canvas: HTMLElement;
|
|
325
387
|
breakpoint: View;
|
|
@@ -379,12 +441,16 @@ export interface GridEditorEventMap {
|
|
|
379
441
|
'grideditor:after-edit-html': EditHtmlPayload;
|
|
380
442
|
'grideditor:after-copy': Payload;
|
|
381
443
|
'grideditor:popup-orphan': PopupOrphanPayload;
|
|
444
|
+
'grideditor:offcanvas-orphan': OffcanvasOrphanPayload;
|
|
382
445
|
'grideditor:view-change': ViewChangePayload;
|
|
383
446
|
'grideditor:target-change': TargetChangePayload;
|
|
384
447
|
'grideditor:selection-change': SelectionChangePayload;
|
|
385
448
|
'grideditor:after-autosave': AutosavePayload;
|
|
386
449
|
'grideditor:after-restore-draft': RestoreDraftPayload;
|
|
387
450
|
'grideditor:autosave-error': AutosaveErrorPayload;
|
|
451
|
+
'grideditor:after-undo': HistoryPayload;
|
|
452
|
+
'grideditor:after-redo': HistoryPayload;
|
|
453
|
+
'grideditor:history-change': HistoryChangePayload;
|
|
388
454
|
}
|
|
389
455
|
|
|
390
456
|
/** An event the editor dispatches on its canvas: a CustomEvent whose detail is the payload. */
|
|
@@ -507,6 +573,7 @@ export declare class GridEditor {
|
|
|
507
573
|
createSection(options?: CreateSectionOptions): HTMLElement | null;
|
|
508
574
|
createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
|
|
509
575
|
createContainer(type: 'carousel', options?: CreateCarouselOptions): HTMLElement | null;
|
|
576
|
+
createContainer(type: 'offcanvas', options?: CreateOffcanvasOptions): HTMLElement | null;
|
|
510
577
|
createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
|
|
511
578
|
addTab(container: Target, options?: PaneOptions): HTMLElement | null;
|
|
512
579
|
addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;
|
|
@@ -523,6 +590,14 @@ export declare class GridEditor {
|
|
|
523
590
|
saveDraft?(): boolean;
|
|
524
591
|
getDraft?(): AutosaveDraft | null;
|
|
525
592
|
clearDraft?(): boolean;
|
|
593
|
+
/** The history plugin's, when it is loaded: true when it went to another step. */
|
|
594
|
+
undo?(): boolean;
|
|
595
|
+
redo?(): boolean;
|
|
596
|
+
/** Whether there is a step to go back to, a change not yet a step counting. */
|
|
597
|
+
canUndo?(): boolean;
|
|
598
|
+
canRedo?(): boolean;
|
|
599
|
+
/** What there is now becomes the first step, with nothing before or after it. */
|
|
600
|
+
clearHistory?(): boolean;
|
|
526
601
|
}
|
|
527
602
|
|
|
528
603
|
export default GridEditor;
|
package/dist/grideditor.esm.js
CHANGED
|
@@ -340,9 +340,7 @@ var REFERENCES = [
|
|
|
340
340
|
"aria-controls",
|
|
341
341
|
"aria-labelledby",
|
|
342
342
|
"aria-describedby",
|
|
343
|
-
"for"
|
|
344
|
-
"data-ge-popup-id",
|
|
345
|
-
"data-ge-popup-target"
|
|
343
|
+
"for"
|
|
346
344
|
];
|
|
347
345
|
var GENERATED_ID = /^ge-([a-z][a-z-]*?)-\d+-[a-z0-9]+$/;
|
|
348
346
|
var BREAKPOINTS = [
|
|
@@ -1130,11 +1128,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1130
1128
|
var signal = { signal: lifetime.signal };
|
|
1131
1129
|
window.addEventListener("scroll", onScroll, signal);
|
|
1132
1130
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1133
|
-
delegate(canvas, "click", ".ge-popup-trigger, [data-ge-popup-target]", function(e) {
|
|
1134
|
-
if (hasClass(canvas, "ge-editing")) {
|
|
1135
|
-
e.preventDefault();
|
|
1136
|
-
}
|
|
1137
|
-
}, signal);
|
|
1138
1131
|
var sidebarMode = panelMode() === "sidebar";
|
|
1139
1132
|
if (settings.active_target || sidebarMode) {
|
|
1140
1133
|
var pressed = null;
|
|
@@ -1545,6 +1538,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1545
1538
|
var label = typeof item.label === "function" ? item.label() : item.label || t(item.labelKey);
|
|
1546
1539
|
var colour = item.align === "end" ? "btn-primary" : "btn-light";
|
|
1547
1540
|
var button = labelButton(element("a", { "class": "btn btn-sm " + colour + " ge-add-container ge-add-feature" }), label, iconClass);
|
|
1541
|
+
var acting = typeof item.action === "function";
|
|
1548
1542
|
addClass(button, item.className || "");
|
|
1549
1543
|
if (typeof item.hidden === "function" ? item.hidden() : item.hidden) {
|
|
1550
1544
|
hide(button);
|
|
@@ -1554,7 +1548,20 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1554
1548
|
"data-ge-feature": name,
|
|
1555
1549
|
"data-ge-item": index
|
|
1556
1550
|
});
|
|
1551
|
+
if (acting) {
|
|
1552
|
+
button.setAttribute("data-ge-action", "");
|
|
1553
|
+
if (typeof item.disabled === "function" ? item.disabled() : item.disabled) {
|
|
1554
|
+
addClass(button, "disabled");
|
|
1555
|
+
button.setAttribute("aria-disabled", "true");
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1557
1558
|
button.addEventListener("click", function() {
|
|
1559
|
+
if (acting) {
|
|
1560
|
+
if (!hasClass(button, "disabled")) {
|
|
1561
|
+
item.action(button);
|
|
1562
|
+
}
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1558
1565
|
if (activeTarget) {
|
|
1559
1566
|
addToTarget(button, item.source || "tool");
|
|
1560
1567
|
return;
|
|
@@ -1580,7 +1587,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1580
1587
|
return !!settings.toolbar_drag;
|
|
1581
1588
|
}
|
|
1582
1589
|
function makeToolbarDraggable() {
|
|
1583
|
-
var buttons = all(mainControls, "[data-ge-toolbar]");
|
|
1590
|
+
var buttons = all(mainControls, "[data-ge-toolbar]:not([data-ge-action])");
|
|
1584
1591
|
buttons.forEach(function(button) {
|
|
1585
1592
|
removeClass(button, "ge-palette-button");
|
|
1586
1593
|
button.removeEventListener("pointerdown", startToolbarDrag);
|
|
@@ -2356,6 +2363,23 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2356
2363
|
getActiveTarget: function() {
|
|
2357
2364
|
return settings.active_target ? activeTarget : null;
|
|
2358
2365
|
},
|
|
2366
|
+
// True when it took: a node that cannot be, or no setting
|
|
2367
|
+
// for it, says nothing, since a plugin putting back what it
|
|
2368
|
+
// remembers cannot know the node is still one
|
|
2369
|
+
setSelected: function(node) {
|
|
2370
|
+
var chosen = panelMode() === "sidebar" && !!node && node !== canvas && canvas.contains(node) && detailsFor.has(node);
|
|
2371
|
+
if (chosen) {
|
|
2372
|
+
changeSelection(node);
|
|
2373
|
+
}
|
|
2374
|
+
return chosen;
|
|
2375
|
+
},
|
|
2376
|
+
setActiveTarget: function(node) {
|
|
2377
|
+
var chosen = !!settings.active_target && isTarget(node);
|
|
2378
|
+
if (chosen) {
|
|
2379
|
+
changeTarget(node);
|
|
2380
|
+
}
|
|
2381
|
+
return chosen;
|
|
2382
|
+
},
|
|
2359
2383
|
// What keeps Escape from the selection and the target, and an
|
|
2360
2384
|
// inline panel unfolded in a drawer, which Escape leaves alone
|
|
2361
2385
|
panelOpen: function() {
|
|
@@ -2895,8 +2919,11 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2895
2919
|
if (!Object.keys(renamed).length) {
|
|
2896
2920
|
return node;
|
|
2897
2921
|
}
|
|
2922
|
+
var references = Object.keys(CONTAINERS).reduce(function(names, type) {
|
|
2923
|
+
return names.concat(CONTAINERS[type].references || []);
|
|
2924
|
+
}, REFERENCES);
|
|
2898
2925
|
selfAndAll(node, "*").forEach(function(element2) {
|
|
2899
|
-
|
|
2926
|
+
references.forEach(function(name) {
|
|
2900
2927
|
var value = element2.getAttribute(name);
|
|
2901
2928
|
if (value === null) {
|
|
2902
2929
|
return;
|
|
@@ -5148,7 +5175,7 @@ GridEditor.t = translate;
|
|
|
5148
5175
|
GridEditor._plainHtml = plainHtml;
|
|
5149
5176
|
GridEditor.Sortable = null;
|
|
5150
5177
|
GridEditor.bootstrap = null;
|
|
5151
|
-
GridEditor.version = false ? "dev" : "9.0.0-beta.
|
|
5178
|
+
GridEditor.version = false ? "dev" : "9.0.0-beta.4";
|
|
5152
5179
|
GridEditor.locales = {
|
|
5153
5180
|
en: {
|
|
5154
5181
|
"tool.move": "Move",
|
package/dist/grideditor.js
CHANGED
|
@@ -341,9 +341,7 @@
|
|
|
341
341
|
"aria-controls",
|
|
342
342
|
"aria-labelledby",
|
|
343
343
|
"aria-describedby",
|
|
344
|
-
"for"
|
|
345
|
-
"data-ge-popup-id",
|
|
346
|
-
"data-ge-popup-target"
|
|
344
|
+
"for"
|
|
347
345
|
];
|
|
348
346
|
var GENERATED_ID = /^ge-([a-z][a-z-]*?)-\d+-[a-z0-9]+$/;
|
|
349
347
|
var BREAKPOINTS = [
|
|
@@ -1131,11 +1129,6 @@
|
|
|
1131
1129
|
var signal = { signal: lifetime.signal };
|
|
1132
1130
|
window.addEventListener("scroll", onScroll, signal);
|
|
1133
1131
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1134
|
-
delegate(canvas, "click", ".ge-popup-trigger, [data-ge-popup-target]", function(e) {
|
|
1135
|
-
if (hasClass(canvas, "ge-editing")) {
|
|
1136
|
-
e.preventDefault();
|
|
1137
|
-
}
|
|
1138
|
-
}, signal);
|
|
1139
1132
|
var sidebarMode = panelMode() === "sidebar";
|
|
1140
1133
|
if (settings.active_target || sidebarMode) {
|
|
1141
1134
|
var pressed = null;
|
|
@@ -1546,6 +1539,7 @@
|
|
|
1546
1539
|
var label = typeof item.label === "function" ? item.label() : item.label || t(item.labelKey);
|
|
1547
1540
|
var colour = item.align === "end" ? "btn-primary" : "btn-light";
|
|
1548
1541
|
var button = labelButton(element("a", { "class": "btn btn-sm " + colour + " ge-add-container ge-add-feature" }), label, iconClass);
|
|
1542
|
+
var acting = typeof item.action === "function";
|
|
1549
1543
|
addClass(button, item.className || "");
|
|
1550
1544
|
if (typeof item.hidden === "function" ? item.hidden() : item.hidden) {
|
|
1551
1545
|
hide(button);
|
|
@@ -1555,7 +1549,20 @@
|
|
|
1555
1549
|
"data-ge-feature": name,
|
|
1556
1550
|
"data-ge-item": index
|
|
1557
1551
|
});
|
|
1552
|
+
if (acting) {
|
|
1553
|
+
button.setAttribute("data-ge-action", "");
|
|
1554
|
+
if (typeof item.disabled === "function" ? item.disabled() : item.disabled) {
|
|
1555
|
+
addClass(button, "disabled");
|
|
1556
|
+
button.setAttribute("aria-disabled", "true");
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1558
1559
|
button.addEventListener("click", function() {
|
|
1560
|
+
if (acting) {
|
|
1561
|
+
if (!hasClass(button, "disabled")) {
|
|
1562
|
+
item.action(button);
|
|
1563
|
+
}
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1559
1566
|
if (activeTarget) {
|
|
1560
1567
|
addToTarget(button, item.source || "tool");
|
|
1561
1568
|
return;
|
|
@@ -1581,7 +1588,7 @@
|
|
|
1581
1588
|
return !!settings.toolbar_drag;
|
|
1582
1589
|
}
|
|
1583
1590
|
function makeToolbarDraggable() {
|
|
1584
|
-
var buttons = all(mainControls, "[data-ge-toolbar]");
|
|
1591
|
+
var buttons = all(mainControls, "[data-ge-toolbar]:not([data-ge-action])");
|
|
1585
1592
|
buttons.forEach(function(button) {
|
|
1586
1593
|
removeClass(button, "ge-palette-button");
|
|
1587
1594
|
button.removeEventListener("pointerdown", startToolbarDrag);
|
|
@@ -2357,6 +2364,23 @@
|
|
|
2357
2364
|
getActiveTarget: function() {
|
|
2358
2365
|
return settings.active_target ? activeTarget : null;
|
|
2359
2366
|
},
|
|
2367
|
+
// True when it took: a node that cannot be, or no setting
|
|
2368
|
+
// for it, says nothing, since a plugin putting back what it
|
|
2369
|
+
// remembers cannot know the node is still one
|
|
2370
|
+
setSelected: function(node) {
|
|
2371
|
+
var chosen = panelMode() === "sidebar" && !!node && node !== canvas && canvas.contains(node) && detailsFor.has(node);
|
|
2372
|
+
if (chosen) {
|
|
2373
|
+
changeSelection(node);
|
|
2374
|
+
}
|
|
2375
|
+
return chosen;
|
|
2376
|
+
},
|
|
2377
|
+
setActiveTarget: function(node) {
|
|
2378
|
+
var chosen = !!settings.active_target && isTarget(node);
|
|
2379
|
+
if (chosen) {
|
|
2380
|
+
changeTarget(node);
|
|
2381
|
+
}
|
|
2382
|
+
return chosen;
|
|
2383
|
+
},
|
|
2360
2384
|
// What keeps Escape from the selection and the target, and an
|
|
2361
2385
|
// inline panel unfolded in a drawer, which Escape leaves alone
|
|
2362
2386
|
panelOpen: function() {
|
|
@@ -2896,8 +2920,11 @@
|
|
|
2896
2920
|
if (!Object.keys(renamed).length) {
|
|
2897
2921
|
return node;
|
|
2898
2922
|
}
|
|
2923
|
+
var references = Object.keys(CONTAINERS).reduce(function(names, type) {
|
|
2924
|
+
return names.concat(CONTAINERS[type].references || []);
|
|
2925
|
+
}, REFERENCES);
|
|
2899
2926
|
selfAndAll(node, "*").forEach(function(element2) {
|
|
2900
|
-
|
|
2927
|
+
references.forEach(function(name) {
|
|
2901
2928
|
var value = element2.getAttribute(name);
|
|
2902
2929
|
if (value === null) {
|
|
2903
2930
|
return;
|
|
@@ -5149,7 +5176,7 @@
|
|
|
5149
5176
|
GridEditor._plainHtml = plainHtml;
|
|
5150
5177
|
GridEditor.Sortable = null;
|
|
5151
5178
|
GridEditor.bootstrap = null;
|
|
5152
|
-
GridEditor.version = false ? "dev" : "9.0.0-beta.
|
|
5179
|
+
GridEditor.version = false ? "dev" : "9.0.0-beta.4";
|
|
5153
5180
|
GridEditor.locales = {
|
|
5154
5181
|
en: {
|
|
5155
5182
|
"tool.move": "Move",
|