@ones-editor/editor 2.1.7-beta.5 → 2.1.7-beta.6

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.
@@ -14,6 +14,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
14
14
  private hoveringTextChild;
15
15
  private _disableTextToolbar;
16
16
  private _lastClickTime;
17
+ private _disabled;
17
18
  constructor(editor: OnesEditor);
18
19
  disableTextToolbar(): void;
19
20
  enableTextToolbar(): void;
@@ -32,6 +33,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
32
33
  handleSelectionChange: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
33
34
  updateItems(updater: (items: CommandItem[]) => CommandItem[]): void;
34
35
  updateItemStates(id: CommandItem['id'], states: Required<CommandItem>['states']): void;
36
+ disable(value: boolean): void;
35
37
  update(reason: ShowToolbarReason): void;
36
38
  private showTextToolbar;
37
39
  private showObjectToolbar;
package/dist/index.js CHANGED
@@ -48289,6 +48289,7 @@ ${codeText}
48289
48289
  __publicField(this, "hoveringTextChild", null);
48290
48290
  __publicField(this, "_disableTextToolbar", false);
48291
48291
  __publicField(this, "_lastClickTime", 0);
48292
+ __publicField(this, "_disabled", false);
48292
48293
  __publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
48293
48294
  __publicField(this, "handleButtonClick", (toolbar2, item) => {
48294
48295
  const tooltip = this.editor.getCustom("editor-tooltip");
@@ -48364,6 +48365,9 @@ ${codeText}
48364
48365
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
48365
48366
  var _a;
48366
48367
  assert(logger$1R, editor === this.editor, "editor mismatch");
48368
+ if (this._disabled) {
48369
+ return;
48370
+ }
48367
48371
  if (editor.selection.range.isCollapsed() || this.mouseDown) {
48368
48372
  if (this.toolbarType === "object") {
48369
48373
  const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
@@ -48473,7 +48477,13 @@ ${codeText}
48473
48477
  removeClass(button2, "disabled");
48474
48478
  }
48475
48479
  }
48480
+ disable(value) {
48481
+ this._disabled = value;
48482
+ }
48476
48483
  update(reason) {
48484
+ if (this._disabled) {
48485
+ return;
48486
+ }
48477
48487
  if (!this.editor.isWritable()) {
48478
48488
  return;
48479
48489
  }
@@ -48481,6 +48491,9 @@ ${codeText}
48481
48491
  }
48482
48492
  showTextToolbar(reason) {
48483
48493
  var _a, _b;
48494
+ if (this._disabled) {
48495
+ return;
48496
+ }
48484
48497
  if (this._disableTextToolbar) {
48485
48498
  return;
48486
48499
  }
@@ -48569,6 +48582,9 @@ ${codeText}
48569
48582
  }
48570
48583
  showObjectToolbar(event) {
48571
48584
  var _a, _b, _c;
48585
+ if (this._disabled) {
48586
+ return;
48587
+ }
48572
48588
  if (!this.hoveringBlock) {
48573
48589
  return;
48574
48590
  }
@@ -84409,8 +84425,11 @@ ${data2.flowchartText}
84409
84425
  editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
84410
84426
  }
84411
84427
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
84412
- if (!clientType.isMobile && options.floatingToolbar !== false) {
84413
- OnesEditorToolbar.register(editor);
84428
+ if (!clientType.isMobile) {
84429
+ const toolbar2 = OnesEditorToolbar.register(editor);
84430
+ if (options.floatingToolbar === false) {
84431
+ toolbar2.disable(true);
84432
+ }
84414
84433
  }
84415
84434
  OnesEditorDropTarget.register(editor);
84416
84435
  OnesEditorTocProvider.register(editor);
@@ -84454,7 +84473,7 @@ ${data2.flowchartText}
84454
84473
  }
84455
84474
  }
84456
84475
  });
84457
- editor.version = "2.1.7-beta.5";
84476
+ editor.version = "2.1.7-beta.6";
84458
84477
  if (Logger$2.level === LogLevel.DEBUG) {
84459
84478
  window.setReauthFail = (fail) => {
84460
84479
  window.isReauthError = fail;
@@ -84557,10 +84576,13 @@ ${data2.flowchartText}
84557
84576
  }
84558
84577
  });
84559
84578
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
84560
- if (!clientType.isMobile && options.floatingToolbar !== false) {
84561
- OnesEditorToolbar.register(editor);
84579
+ if (!clientType.isMobile) {
84580
+ const toolbar2 = OnesEditorToolbar.register(editor);
84581
+ if (options.floatingToolbar === false) {
84582
+ toolbar2.disable(true);
84583
+ }
84562
84584
  }
84563
- editor.version = "2.1.7-beta.5";
84585
+ editor.version = "2.1.7-beta.6";
84564
84586
  return editor;
84565
84587
  }
84566
84588
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.7-beta.5",
3
+ "version": "2.1.7-beta.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",