@themarioga/grid-editor 8.8.2 → 8.9.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.
@@ -121,6 +121,18 @@ export interface InlineStyleOptions {
121
121
  visibility?: { drawer?: boolean };
122
122
  }
123
123
 
124
+ /** What the sidebar shows while nothing is selected, instead of its message. */
125
+ export interface SidebarContent {
126
+ /** Text, not html. Default the sidebar's own title. */
127
+ title?: string;
128
+ body: Element;
129
+ }
130
+
131
+ export interface SidebarSettings {
132
+ /** Called whenever the sidebar is left with nothing selected. Null gives the message. */
133
+ empty?: ((ge: GridEditor) => SidebarContent | null) | null;
134
+ }
135
+
124
136
  export type CustomFilter = ((canvas: HTMLElement, isInit: boolean) => void) | string;
125
137
 
126
138
  /** The settings. Every one is optional. */
@@ -183,7 +195,10 @@ export interface GridEditorOptions {
183
195
  locale_strings?: Record<string, string>;
184
196
  callbacks?: Partial<GridEditorCallbacks>;
185
197
  confirm_delete?: boolean;
186
- settings_panel?: 'offcanvas' | 'popover' | 'modal' | 'inline';
198
+ /** Where a node's settings open. 'sidebar' is a panel that stays on the right while editing, showing the selected node's; one editor per page has it. */
199
+ settings_panel?: 'offcanvas' | 'popover' | 'modal' | 'inline' | 'sidebar';
200
+ /** The 'sidebar' panel. */
201
+ sidebar?: SidebarSettings;
187
202
  drag?: { delay?: number; touch_delay?: number; threshold?: number; animation?: number; scroll?: boolean };
188
203
  tinymce?: { config?: Record<string, unknown> };
189
204
  ckeditor?: { config?: Record<string, unknown> };
@@ -317,6 +332,13 @@ export interface TargetChangePayload {
317
332
  from: HTMLElement | null;
318
333
  }
319
334
 
335
+ /** The selection changed, with settings_panel 'sidebar': the node whose settings the sidebar shows, or null. */
336
+ export interface SelectionChangePayload {
337
+ canvas: HTMLElement;
338
+ node: HTMLElement | null;
339
+ from: HTMLElement | null;
340
+ }
341
+
320
342
  /** The events, by name, with their payloads. Adding fires a specific name and the generic one. */
321
343
  export interface GridEditorEventMap {
322
344
  'grideditor:before-add': Payload;
@@ -357,6 +379,7 @@ export interface GridEditorEventMap {
357
379
  'grideditor:popup-orphan': PopupOrphanPayload;
358
380
  'grideditor:view-change': ViewChangePayload;
359
381
  'grideditor:target-change': TargetChangePayload;
382
+ 'grideditor:selection-change': SelectionChangePayload;
360
383
  'grideditor:after-autosave': AutosavePayload;
361
384
  'grideditor:after-restore-draft': RestoreDraftPayload;
362
385
  'grideditor:autosave-error': AutosaveErrorPayload;
@@ -468,6 +491,10 @@ export declare class GridEditor {
468
491
  getActiveTarget(): HTMLElement | null;
469
492
  /** Make a column or region, or the first a selector matches, where the toolbar adds; null for none. */
470
493
  setActiveTarget(target: HTMLElement | string | null): this;
494
+ /** The node whose settings the sidebar shows, or null. Null unless settings_panel is 'sidebar'. */
495
+ getSelected(): HTMLElement | null;
496
+ /** Select a node with settings, or the first a selector matches, or null for none. Does nothing unless settings_panel is 'sidebar'. */
497
+ setSelected(node: HTMLElement | string | null): this;
471
498
  getView(): View;
472
499
  setLocale(code: string): this;
473
500
  createRow(layout?: RowLayout, options?: Placement): HTMLElement | null;