@ones-editor/editor 2.1.1-beta.71 → 2.1.1-beta.72

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import { TypedEmitter } from 'tiny-typed-emitter';
3
2
  import { CloseReason, CommandItem, Closeable } from '../../../../@ones-editor/core';
4
3
  import { AbstractManualCommandBar, AbstractCommandBar, CommandBarEvents, CommandBarOptions, CommandItemElement, CreateManualCommandBarFunction, ManualShowCommandBarOptions, SelectItemFrom } from './types';
@@ -31,7 +30,8 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
31
30
  private getSelectedItemIndex;
32
31
  private getPrevItemIndex;
33
32
  private getNextItemIndex;
34
- protected clearSelectedItem: import("lodash").DebouncedFunc<() => void>;
33
+ protected clearSelectedItem(): void;
34
+ private debounceClearSelectedItem;
35
35
  selectItem(id: string, from?: SelectItemFrom): void;
36
36
  private lastEnterPauseTime;
37
37
  private startPauseMouseEnter;
package/dist/index.js CHANGED
@@ -39113,16 +39113,7 @@ ${codeText}
39113
39113
  disablePageScroll(this.id);
39114
39114
  }
39115
39115
  });
39116
- __publicField(this, "clearSelectedItem", debounce__default.default(() => {
39117
- const item = this.getSelectedItem();
39118
- if (!item) {
39119
- return;
39120
- }
39121
- const elem = this.getItemElementById(item.id);
39122
- if (elem) {
39123
- removeClass(elem, "selected");
39124
- }
39125
- }, 200));
39116
+ __publicField(this, "debounceClearSelectedItem", debounce__default.default(this.clearSelectedItem, 200));
39126
39117
  __publicField(this, "lastEnterPauseTime", 0);
39127
39118
  __publicField(this, "startPauseMouseEnter", () => {
39128
39119
  this.lastEnterPauseTime = Date.now();
@@ -39183,7 +39174,7 @@ ${codeText}
39183
39174
  }
39184
39175
  if (clientType.isMobile) {
39185
39176
  this.selectItem(id);
39186
- this.clearSelectedItem();
39177
+ this.debounceClearSelectedItem();
39187
39178
  }
39188
39179
  if (item.children && item.children.length > 0 && item.manualShowChildren) {
39189
39180
  this.showSubCommandBar(item.childrenMenuId);
@@ -39354,6 +39345,16 @@ ${codeText}
39354
39345
  }
39355
39346
  }
39356
39347
  }
39348
+ clearSelectedItem() {
39349
+ const item = this.getSelectedItem();
39350
+ if (!item) {
39351
+ return;
39352
+ }
39353
+ const elem = this.getItemElementById(item.id);
39354
+ if (elem) {
39355
+ removeClass(elem, "selected");
39356
+ }
39357
+ }
39357
39358
  selectItem(id, from = "event") {
39358
39359
  const exists = this.getSelectedItem();
39359
39360
  if (exists) {
@@ -50739,6 +50740,7 @@ ${codeText}
50739
50740
  }
50740
50741
  const block = this.hoveringBlock;
50741
50742
  const child = this.hoveringTextChild;
50743
+ const isBoxChild = child && isTextBlockContentBoxChild(child);
50742
50744
  const { commands, element } = getObjectCommands(this.editor, block, child);
50743
50745
  if (!commands.length || !element) {
50744
50746
  this.toolbar.close("fromHover");
@@ -50763,7 +50765,7 @@ ${codeText}
50763
50765
  lineRects.push(y);
50764
50766
  });
50765
50767
  if (lineRects.length > 1) {
50766
- rect = child ? clientRects[clientRects.length - 1] : clientRects[0];
50768
+ rect = isBoxChild ? clientRects[clientRects.length - 1] : clientRects[0];
50767
50769
  if (event) {
50768
50770
  for (let i = 0; i < clientRects.length; i++) {
50769
50771
  const clientRect = clientRects[i];
@@ -50776,7 +50778,7 @@ ${codeText}
50776
50778
  }
50777
50779
  } else {
50778
50780
  rect = element.getBoundingClientRect();
50779
- if (child) {
50781
+ if (isBoxChild) {
50780
50782
  const childRect = child.getBoundingClientRect();
50781
50783
  return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
50782
50784
  }
@@ -61534,6 +61536,10 @@ $$${mathData.mathjaxText}$$
61534
61536
  return false;
61535
61537
  }
61536
61538
  filterCommands(editor, block, range, commands) {
61539
+ const { start, end } = editor.selection.range;
61540
+ if (start.blockId === end.blockId && isCodeBlock(block)) {
61541
+ return [];
61542
+ }
61537
61543
  if (isCodeTextBlock(editor, block)) {
61538
61544
  return [];
61539
61545
  }
@@ -65021,7 +65027,7 @@ ${codeText}
65021
65027
  });
65022
65028
  }
65023
65029
  const { enableComments = true } = this.editor.options;
65024
- if (!enableComments) {
65030
+ if (!enableComments || this.editor.readonly) {
65025
65031
  standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
65026
65032
  }
65027
65033
  if (this.editor.readonly) {
@@ -86796,7 +86802,7 @@ ${data2.flowchartText}
86796
86802
  }
86797
86803
  }
86798
86804
  });
86799
- editor.version = "2.1.1-beta.71";
86805
+ editor.version = "2.1.1-beta.72";
86800
86806
  if (Logger$2.level === LogLevel.DEBUG) {
86801
86807
  window.setReauthFail = (fail) => {
86802
86808
  window.isReauthError = fail;
@@ -86897,7 +86903,7 @@ ${data2.flowchartText}
86897
86903
  });
86898
86904
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
86899
86905
  OnesEditorToolbar.register(editor);
86900
- editor.version = "2.1.1-beta.71";
86906
+ editor.version = "2.1.1-beta.72";
86901
86907
  return editor;
86902
86908
  }
86903
86909
  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.1-beta.71",
3
+ "version": "2.1.1-beta.72",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",