@ones-editor/editor 2.1.5 → 2.1.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.
@@ -40,6 +40,6 @@ export default class AutoSuggestMenu {
40
40
  handleClick: import("lodash").DebouncedFuncLeading<(menu: AbstractCommandBar, item: CommandItem) => void>;
41
41
  handleShow: (menu: AbstractCommandBar) => void;
42
42
  handleClose: () => void;
43
- handleKeydown: (event: KeyboardEvent) => void;
43
+ handleKeydown: (event: KeyboardEvent) => boolean;
44
44
  protected highlightText(search: string, items?: CommandItem[]): void;
45
45
  }
@@ -21,7 +21,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
21
21
  abstract readonly isVisible: boolean;
22
22
  get isSubCommandBar(): boolean;
23
23
  updateItems(items: CommandItem[]): void;
24
- handleDocumentKeydown: (event: KeyboardEvent) => void;
24
+ handleDocumentKeydown: (event: KeyboardEvent) => boolean;
25
25
  protected handleDocumentMouseDown: (event: MouseEvent) => void;
26
26
  protected handleHidden: () => void;
27
27
  protected handleShow: () => void;
@@ -26,7 +26,7 @@ export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
26
26
  close: (reason: CloseReason) => void;
27
27
  destroy: () => void;
28
28
  isInCommandBar: (target: EventTarget | null) => boolean;
29
- handleDocumentKeydown: (event: KeyboardEvent) => void;
29
+ handleDocumentKeydown: (event: KeyboardEvent) => boolean;
30
30
  getSubBarOptions: (item: CommandItem) => ManualShowCommandBarOptions;
31
31
  }
32
32
  export interface ShowCommandBarOptions {
package/dist/index.js CHANGED
@@ -38120,27 +38120,26 @@ ${codeText}
38120
38120
  __publicField(this, "handleDocumentKeydown", (event) => {
38121
38121
  var _a, _b;
38122
38122
  if (!this.isVisible) {
38123
- return;
38123
+ return true;
38124
38124
  }
38125
38125
  if (event.isComposing) {
38126
- return;
38126
+ return true;
38127
38127
  }
38128
38128
  if (isInBlockTools(event.target)) {
38129
- return;
38129
+ return true;
38130
38130
  }
38131
38131
  if (this.subBar) {
38132
- this.subBar.handleDocumentKeydown(event);
38133
- return;
38132
+ return this.subBar.handleDocumentKeydown(event);
38134
38133
  }
38135
38134
  if (this.items.length === 0) {
38136
- return;
38135
+ return true;
38137
38136
  }
38138
38137
  if (event.key === "Escape") {
38139
38138
  if ((_b = (_a = this.options).beforeClose) == null ? void 0 : _b.call(_a)) {
38140
- return;
38139
+ return true;
38141
38140
  }
38142
38141
  this.close("cancelBar");
38143
- return;
38142
+ return true;
38144
38143
  }
38145
38144
  if (event.key === "ArrowUp") {
38146
38145
  const prev = this.getPrevItemIndex(this.getSelectedItemIndex());
@@ -38166,7 +38165,7 @@ ${codeText}
38166
38165
  } else if (event.key === "Enter") {
38167
38166
  const index2 = this.getSelectedItemIndex();
38168
38167
  if (index2 === -1) {
38169
- return;
38168
+ return false;
38170
38169
  }
38171
38170
  const item = this.items[index2];
38172
38171
  const elem = this.getItemElementById(item.id);
@@ -38174,6 +38173,7 @@ ${codeText}
38174
38173
  this.emit("click", this, item, elem);
38175
38174
  }
38176
38175
  }
38176
+ return true;
38177
38177
  });
38178
38178
  __publicField(this, "handleDocumentMouseDown", (event) => {
38179
38179
  var _a, _b;
@@ -38229,6 +38229,9 @@ ${codeText}
38229
38229
  }
38230
38230
  const itemId = this.getItemElementId(elem);
38231
38231
  const item = this.getItemById(itemId);
38232
+ if (item.states && item.states.indexOf("disabled") !== -1) {
38233
+ return;
38234
+ }
38232
38235
  this.selectItem(itemId);
38233
38236
  if (item.manualShowChildren) {
38234
38237
  return;
@@ -39317,9 +39320,7 @@ ${codeText}
39317
39320
  var _a, _b;
39318
39321
  (_b = (_a = this.options).onClose) == null ? void 0 : _b.call(_a);
39319
39322
  });
39320
- __publicField(this, "handleKeydown", (event) => {
39321
- this.menu.handleDocumentKeydown(event);
39322
- });
39323
+ __publicField(this, "handleKeydown", (event) => this.menu.handleDocumentKeydown(event));
39323
39324
  this.options = options;
39324
39325
  this.menu = new ManualMenu([], void 0, {
39325
39326
  id: options.id,
@@ -39341,7 +39342,13 @@ ${codeText}
39341
39342
  setItems(items) {
39342
39343
  this.menu.updateItems(items);
39343
39344
  if (items.length > 0) {
39344
- const firstItem = items.find((item) => item.type !== "section" && item.type !== "separator");
39345
+ const selectable = (item) => {
39346
+ if (item.states && item.states.indexOf("disabled") !== -1) {
39347
+ return false;
39348
+ }
39349
+ return item.type !== "section" && item.type !== "separator";
39350
+ };
39351
+ const firstItem = items.find(selectable);
39345
39352
  if (firstItem) {
39346
39353
  this.menu.selectItem(firstItem.id, "manual");
39347
39354
  }
@@ -40109,8 +40116,7 @@ ${codeText}
40109
40116
  this.menu.close();
40110
40117
  return true;
40111
40118
  }
40112
- this.menu.handleKeydown(event);
40113
- return true;
40119
+ return this.menu.handleKeydown(event);
40114
40120
  }
40115
40121
  popup(block, offset, leftText, trigger) {
40116
40122
  this.anchor = {
@@ -83080,7 +83086,7 @@ ${data2.flowchartText}
83080
83086
  }
83081
83087
  }
83082
83088
  });
83083
- editor.version = "2.1.5";
83089
+ editor.version = "2.1.6";
83084
83090
  if (Logger$2.level === LogLevel.DEBUG) {
83085
83091
  window.setReauthFail = (fail) => {
83086
83092
  window.isReauthError = fail;
@@ -83175,7 +83181,7 @@ ${data2.flowchartText}
83175
83181
  if (!clientType.isMobile) {
83176
83182
  OnesEditorToolbar.register(editor);
83177
83183
  }
83178
- editor.version = "2.1.5";
83184
+ editor.version = "2.1.6";
83179
83185
  return editor;
83180
83186
  }
83181
83187
  async function showDocVersions(editor, options, serverUrl) {
@@ -129449,6 +129455,7 @@ ${data2.flowchartText}
129449
129455
  exports2.toPlainText = toPlainText;
129450
129456
  exports2.toPlainTextKeepLength = toPlainTextKeepLength;
129451
129457
  exports2.trimChar = trimChar;
129458
+ exports2.turndownService = turndownService;
129452
129459
  exports2.unexclusiveBlock = unexclusiveBlock;
129453
129460
  exports2.unicodeLength = unicodeLength;
129454
129461
  exports2.unicodeSubstr = unicodeSubstr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",