@themarioga/grid-editor 8.10.1 → 9.0.0-beta.1

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/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "version": "8.10.1",
35
+ "version": "9.0.0-beta.1",
36
36
  "main": "dist/grideditor.js",
37
37
  "module": "dist/grideditor.esm.js",
38
38
  "types": "dist/grideditor.d.ts",
@@ -403,7 +403,7 @@ function build(instance, baseElem, optionsOrMethod) {
403
403
  'toolbar_overflow' : 'menu', // What doesn't fit on one line: 'menu' behind a button, 'wrap' onto another line
404
404
  'drawer_overflow' : 'menu', // The same for the drawers' tools: 'menu' behind a button, 'wrap' onto another line
405
405
  'toolbar_groups' : false, // The add buttons in categories, one shown at a time, picked with tabs
406
- 'active_target' : false, // A click in a column makes it where the toolbar's buttons add
406
+ 'active_target' : false, // A click in a column makes it where the toolbar's buttons add. The 'sidebar' panel turns it on
407
407
  'element_tools' : [], // Host tools on element drawers, same shape as row_tools
408
408
  'element_classes' : [], // Preset class toggles on an element's settings panel
409
409
  // content_types, text_tools and text_classes are the text editor
@@ -442,6 +442,16 @@ function build(instance, baseElem, optionsOrMethod) {
442
442
  settings[name] = Object.assign({}, NESTED_SETTINGS[name], settings[name]);
443
443
  });
444
444
 
445
+ // The sidebar shows what is selected and the toolbar adds to the
446
+ // target: both follow the node last clicked, so one asks for the other.
447
+ // Read from what the host gave, as the default is already in settings
448
+ if (settings.settings_panel === 'sidebar') {
449
+ if (optionsOrMethod && optionsOrMethod.active_target === false) {
450
+ throw new TypeError('grid-editor: settings_panel "sidebar" needs active_target; leave it out or set it to true');
451
+ }
452
+ settings.active_target = true;
453
+ }
454
+
445
455
 
446
456
  // Elems
447
457
  var canvas,
@@ -161,7 +161,7 @@ export interface GridEditorOptions {
161
161
  drawer_overflow?: 'menu' | 'wrap';
162
162
  /** The add buttons in categories - rows, content, and a plugin's own - one shown at a time, chosen with tabs. Default false. */
163
163
  toolbar_groups?: boolean;
164
- /** A click in a column or a section makes it where the toolbar's buttons add. Default false. */
164
+ /** A click in a column or a section makes it where the toolbar's buttons add. Default false, and true with settings_panel 'sidebar', which throws if it is given false. */
165
165
  active_target?: boolean;
166
166
  /** The plugins to use, of any kind; null is every one loaded. */
167
167
  plugins?: string[] | null;
@@ -195,7 +195,7 @@ export interface GridEditorOptions {
195
195
  locale_strings?: Record<string, string>;
196
196
  callbacks?: Partial<GridEditorCallbacks>;
197
197
  confirm_delete?: boolean;
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. */
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. It turns active_target on, and the constructor throws a TypeError if active_target is false. */
199
199
  settings_panel?: 'offcanvas' | 'popover' | 'modal' | 'inline' | 'sidebar';
200
200
  /** The 'sidebar' panel. */
201
201
  sidebar?: SidebarSettings;
@@ -487,7 +487,7 @@ export declare class GridEditor {
487
487
  /** Take the editor off: the markup stays, everything else goes. */
488
488
  destroy(): this;
489
489
  changeView(view: View): this;
490
- /** The column or region the toolbar adds to, or null. Null without active_target. */
490
+ /** The column or region the toolbar adds to, or null. Null without active_target, which settings_panel 'sidebar' turns on. */
491
491
  getActiveTarget(): HTMLElement | null;
492
492
  /** Make a column or region, or the first a selector matches, where the toolbar adds; null for none. */
493
493
  setActiveTarget(target: HTMLElement | string | null): this;