@ones-editor/editor 2.2.3 → 2.2.4-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.
@@ -3,6 +3,7 @@ import CommandBar from './command-bar';
3
3
  import { CommandBarOptions, CommandItemElement, ManualShowCommandBarOptions } from './types';
4
4
  export default class FixedToolbar extends CommandBar {
5
5
  constructor(parent: HTMLElement, items: CommandItem[], options?: CommandBarOptions);
6
+ handleDocumentKeydown: (event: KeyboardEvent) => boolean;
6
7
  protected initCommandBarElement(elem: HTMLElement): void;
7
8
  protected initItemElement(item: CommandItem, elem: CommandItemElement): void;
8
9
  close(): void;
package/dist/index.js CHANGED
@@ -2574,7 +2574,7 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
2574
2574
  padding: 4px 15px;
2575
2575
  }
2576
2576
  [data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar-root {
2577
- max-height: max-content;
2577
+ max-height: 100%;
2578
2578
  }
2579
2579
  [data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar-header {
2580
2580
  width: 100%;
@@ -2620,7 +2620,6 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
2620
2620
  width: 100%;
2621
2621
  }
2622
2622
  [data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] {
2623
- height: 495px;
2624
2623
  align-items: start;
2625
2624
  }
2626
2625
  [data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup].selected {
@@ -23176,19 +23175,6 @@ var __publicField = (obj, key, value) => {
23176
23175
  });
23177
23176
  return ret;
23178
23177
  }
23179
- function getOffsetBetweenChildren(block, x, y) {
23180
- const rects = getBlockRects(block);
23181
- for (let i = 1; i < rects.length; i++) {
23182
- const prev = rects[i - 1];
23183
- const next2 = rects[i];
23184
- if (x >= prev.rect.right && x <= next2.rect.left) {
23185
- if (y >= prev.rect.top && y <= prev.rect.bottom && y >= next2.rect.top && y <= next2.rect.bottom) {
23186
- return getChildOffset(block, next2.child).start;
23187
- }
23188
- }
23189
- }
23190
- return null;
23191
- }
23192
23178
  function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign) {
23193
23179
  const elem = getElementFromPoint(xOrign, yOrign);
23194
23180
  if (!elem)
@@ -23227,11 +23213,6 @@ var __publicField = (obj, key, value) => {
23227
23213
  if (!pointInRect(rect, x, y)) {
23228
23214
  return null;
23229
23215
  }
23230
- const offset2 = getOffsetBetweenChildren(block, x, y);
23231
- if (offset2 !== null) {
23232
- const pos2 = createSimpleBlockPosition(block, offset2, "normal");
23233
- return new EditorSimpleSelectionRange(editor, { anchor: pos2, focus: pos2 });
23234
- }
23235
23216
  const pos = geLineHomeEndPositionFromPoint(block, x, y);
23236
23217
  if (pos) {
23237
23218
  return new EditorSimpleSelectionRange(editor, { anchor: pos, focus: pos });
@@ -40220,6 +40201,18 @@ ${codeText}
40220
40201
  class FixedToolbar extends CommandBar {
40221
40202
  constructor(parent, items, options) {
40222
40203
  super(items, void 0, options);
40204
+ __publicField(this, "handleDocumentKeydown", (event) => {
40205
+ if (!this.isVisible) {
40206
+ return true;
40207
+ }
40208
+ if (event.isComposing) {
40209
+ return true;
40210
+ }
40211
+ if (this.subBar) {
40212
+ return this.subBar.handleDocumentKeydown(event);
40213
+ }
40214
+ return true;
40215
+ });
40223
40216
  __publicField(this, "getSubBarOptions", (item) => {
40224
40217
  var _a;
40225
40218
  const options = {
@@ -58667,6 +58660,9 @@ $$${mathData.mathjaxText}$$
58667
58660
  __publicField(this, "handleItemClick", (bar2, item) => {
58668
58661
  assert(logger$1H, this.commandBlock, "no command block before show block menu");
58669
58662
  this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
58663
+ if (!item.element) {
58664
+ this.close();
58665
+ }
58670
58666
  });
58671
58667
  __publicField(this, "close", () => {
58672
58668
  this.menu.close("clickItem");
@@ -78467,6 +78463,7 @@ ${content}
78467
78463
  this.scrollEventTarget = void 0;
78468
78464
  }
78469
78465
  }
78466
+ const DEFAULT_WAIT = 300;
78470
78467
  const highlightTextAll = (text2, find) => {
78471
78468
  if (!find) {
78472
78469
  return text2;
@@ -78599,7 +78596,7 @@ ${content}
78599
78596
  this._queryItems(find).then((items) => {
78600
78597
  this.createMobileItems(content, items, find);
78601
78598
  });
78602
- }, 100));
78599
+ }, DEFAULT_WAIT));
78603
78600
  __publicField(this, "createMobileWrap", () => {
78604
78601
  if (this.mobileWrap) {
78605
78602
  return this.mobileWrap;
@@ -78680,7 +78677,8 @@ ${content}
78680
78677
  onShown: this.onShown,
78681
78678
  onClickItem: this.onClickItem,
78682
78679
  queryItems: this.queryItems,
78683
- onClose: this.onClose
78680
+ onClose: this.onClose,
78681
+ wait: DEFAULT_WAIT
78684
78682
  });
78685
78683
  }
78686
78684
  destroy() {
@@ -86902,7 +86900,7 @@ ${data2.flowchartText}
86902
86900
  }
86903
86901
  }
86904
86902
  });
86905
- editor.version = "2.2.3";
86903
+ editor.version = "2.2.4-beta.1";
86906
86904
  if (Logger$2.level === LogLevel.DEBUG) {
86907
86905
  window.setReauthFail = (fail) => {
86908
86906
  window.isReauthError = fail;
@@ -87003,7 +87001,7 @@ ${data2.flowchartText}
87003
87001
  });
87004
87002
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
87005
87003
  OnesEditorToolbar.register(editor);
87006
- editor.version = "2.2.3";
87004
+ editor.version = "2.2.4-beta.1";
87007
87005
  return editor;
87008
87006
  }
87009
87007
  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.2.3",
3
+ "version": "2.2.4-beta.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",