@ones-editor/editor 2.0.7-beta.22 → 2.0.7-beta.23

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.
@@ -31,6 +31,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
31
31
  private handleHoveringBlockChildChange;
32
32
  handleSelectionChange: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
33
33
  updateItems(updater: (items: CommandItem[]) => CommandItem[]): void;
34
+ updateItemStates(id: CommandItem['id'], states: Required<CommandItem>['states']): void;
34
35
  update(reason: ShowToolbarReason): void;
35
36
  private showTextToolbar;
36
37
  private showObjectToolbar;
package/dist/index.js CHANGED
@@ -48126,6 +48126,27 @@ ${codeText}
48126
48126
  const updatedItems = updater(this.toolbar.items);
48127
48127
  this.toolbar.updateItems(updatedItems);
48128
48128
  }
48129
+ updateItemStates(id, states) {
48130
+ var _a;
48131
+ const commandItem = this.toolbar.getItemById(id);
48132
+ commandItem.states = states;
48133
+ if (commandItem.element)
48134
+ return;
48135
+ const button2 = (_a = this.toolbar.popper) == null ? void 0 : _a.querySelector(`[data-button-id=${id}]`);
48136
+ if (!button2)
48137
+ return;
48138
+ if (states.indexOf("checked") !== -1) {
48139
+ addClass(button2, "checked");
48140
+ } else {
48141
+ removeClass(button2, "checked");
48142
+ }
48143
+ if (states.indexOf("disabled") !== -1) {
48144
+ button2.setAttribute("disabled", "");
48145
+ } else {
48146
+ button2.removeAttribute("disabled");
48147
+ removeClass(button2, "disabled");
48148
+ }
48149
+ }
48129
48150
  update(reason) {
48130
48151
  if (!this.editor.isWritable()) {
48131
48152
  return;
@@ -80068,6 +80089,13 @@ ${data2.flowchartText}
80068
80089
  states
80069
80090
  };
80070
80091
  }
80092
+ function updateDeleteIconStatus(editor, block) {
80093
+ const states = [];
80094
+ if (isEmptyIcon(editor, block)) {
80095
+ states.push("disabled");
80096
+ }
80097
+ OnesEditorToolbar.get(editor).updateItemStates("delete-icon", states);
80098
+ }
80071
80099
  getLogger("callout-block-commands");
80072
80100
  class CalloutBlockCommands {
80073
80101
  constructor(editor, block) {
@@ -80094,6 +80122,7 @@ ${data2.flowchartText}
80094
80122
  this.updateCalloutBlockData({
80095
80123
  icon: emoji
80096
80124
  });
80125
+ updateDeleteIconStatus(this.editor, this.activeBlock);
80097
80126
  });
80098
80127
  __publicField(this, "handleEmojiDelete", () => {
80099
80128
  this.updateCalloutBlockData({
@@ -82317,7 +82346,7 @@ ${data2.flowchartText}
82317
82346
  }
82318
82347
  }
82319
82348
  });
82320
- editor.version = "2.0.7-beta.22";
82349
+ editor.version = "2.0.7-beta.23";
82321
82350
  if (Logger$2.level === LogLevel.DEBUG) {
82322
82351
  window.setReauthFail = (fail) => {
82323
82352
  window.isReauthError = fail;
@@ -82411,7 +82440,7 @@ ${data2.flowchartText}
82411
82440
  if (!clientType.isMobile) {
82412
82441
  OnesEditorToolbar.register(editor);
82413
82442
  }
82414
- editor.version = "2.0.7-beta.22";
82443
+ editor.version = "2.0.7-beta.23";
82415
82444
  return editor;
82416
82445
  }
82417
82446
  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.0.7-beta.22",
3
+ "version": "2.0.7-beta.23",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",