@ones-editor/editor 2.1.1-beta.74 → 2.1.1-beta.76

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.
@@ -51,6 +51,7 @@ declare const _default: {
51
51
  subscript: string;
52
52
  superscript: string;
53
53
  more: string;
54
+ selectBlock: string;
54
55
  };
55
56
  };
56
57
  export default _default;
@@ -51,6 +51,7 @@ declare const _default: {
51
51
  subscript: string;
52
52
  superscript: string;
53
53
  more: string;
54
+ selectBlock: string;
54
55
  };
55
56
  };
56
57
  export default _default;
@@ -51,6 +51,7 @@ declare const _default: {
51
51
  subscript: string;
52
52
  superscript: string;
53
53
  more: string;
54
+ selectBlock: string;
54
55
  };
55
56
  };
56
57
  export default _default;
@@ -1,9 +1,12 @@
1
1
  import { BlockElement, CommandItem, CommandItemWithSource, CommandParams, CommandResult, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
2
2
  export declare class MobileLinkProvider implements OnesEditorCommandProvider {
3
+ private options?;
3
4
  id: string;
4
5
  insertProvider: OnesEditorCommandProvider;
5
6
  editProvider: OnesEditorCommandProvider;
6
- constructor(editor: OnesEditor);
7
+ constructor(editor: OnesEditor, options?: {
8
+ linkMode: 'insert' | 'edit';
9
+ } | undefined);
7
10
  getSelectedLinkChild: (editor: OnesEditor, range: SelectionRange) => import("@ones-editor/core").TextBlockContentChild | null;
8
11
  getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
9
12
  executeCommand: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
@@ -0,0 +1,9 @@
1
+ import { BlockElement, CommandItem, CommandParams, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
2
+ export default class SelectionProvider implements OnesEditorCommandProvider {
3
+ private editor;
4
+ id: string;
5
+ constructor(editor: OnesEditor);
6
+ getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams): CommandItem[];
7
+ getInsertCommands: () => never[];
8
+ executeCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, command: CommandItem): boolean;
9
+ }
@@ -4,6 +4,7 @@ import CommandBar from './command-bar';
4
4
  import { AbstractManualCommandBar, ManualShowCommandBarOptions } from './types';
5
5
  export default abstract class ManualCommandBar extends CommandBar implements AbstractManualCommandBar {
6
6
  tippyInstance: Instance | null;
7
+ setProps: (props: ManualShowCommandBarOptions) => void;
7
8
  manualShow(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
8
9
  close(reason: CloseReason): void;
9
10
  destroy(): void;
@@ -31,6 +31,7 @@ export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
31
31
  handleDocumentKeydown: (event: KeyboardEvent) => boolean;
32
32
  getSubBarOptions: (item: CommandItem) => ManualShowCommandBarOptions;
33
33
  updateItems: (items: CommandItem[]) => void;
34
+ setProps?: (props: ManualShowCommandBarOptions) => void;
34
35
  }
35
36
  export interface ShowCommandBarOptions {
36
37
  placement?: Placement;
package/dist/index.js CHANGED
@@ -6436,21 +6436,27 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
6436
6436
  .command-m-bar > .editor-command-bar-root::-webkit-scrollbar {
6437
6437
  display: none;
6438
6438
  }
6439
- .command-m-bar > .editor-command-bar-root .overflowing-float, .command-m-bar > .editor-command-bar-root .command-m-bar > .editor-command-bar-root.overflowing::before, .command-m-bar > .editor-command-bar-root .command-m-bar > .editor-command-bar-root.overflowing::after {
6439
+ .command-m-bar > .editor-command-bar-root.overflowing::after {
6440
6440
  content: "";
6441
6441
  position: absolute;
6442
6442
  top: 0;
6443
- left: 0;
6443
+ right: 0;
6444
6444
  bottom: 0;
6445
- width: 10px;
6445
+ width: 18px;
6446
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgb(255, 255, 255));
6446
6447
  z-index: 1;
6447
6448
  pointer-events: none;
6448
6449
  }
6449
- .command-m-bar > .editor-command-bar-root.overflowing::after {
6450
- background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgb(255, 255, 255));
6451
- }
6452
6450
  .command-m-bar > .editor-command-bar-root.overflowing::before {
6451
+ content: "";
6452
+ position: absolute;
6453
+ top: 0;
6454
+ left: 0;
6455
+ bottom: 0;
6456
+ width: 18px;
6453
6457
  background: linear-gradient(90deg, rgb(255, 255, 255) 0, rgba(255, 255, 255, 0));
6458
+ z-index: 1;
6459
+ pointer-events: none;
6454
6460
  }
6455
6461
  .command-m-bar > .editor-command-bar-root > .editor-command-bar {
6456
6462
  width: max-content;
@@ -8931,29 +8937,42 @@ var __publicField = (obj, key, value) => {
8931
8937
  return events2 instanceof TouchEvent;
8932
8938
  }
8933
8939
  function bindDbClick(elem, handler) {
8934
- let touchTime = 0;
8935
- const callback = (event) => {
8936
- if (touchTime === 0) {
8937
- touchTime = new Date().getTime();
8938
- } else {
8939
- if (new Date().getTime() - touchTime < 800) {
8940
- handler(event);
8941
- }
8942
- touchTime = 0;
8940
+ let clickCount = 0;
8941
+ function simulateDoubleClick(event) {
8942
+ clickCount++;
8943
+ if (clickCount === 1) {
8944
+ setTimeout(() => {
8945
+ if (clickCount === 2) {
8946
+ handler(event);
8947
+ }
8948
+ clickCount = 0;
8949
+ }, 300);
8943
8950
  }
8944
- };
8945
- elem.addEventListener("click", callback);
8951
+ }
8952
+ elem.addEventListener("click", simulateDoubleClick);
8946
8953
  return () => {
8947
- elem.removeEventListener("click", callback);
8954
+ elem.removeEventListener("click", simulateDoubleClick);
8948
8955
  };
8949
8956
  }
8957
+ const getVisualViewportHeightOffset = () => {
8958
+ var _a, _b;
8959
+ if (!clientType.isMobile) {
8960
+ return 0;
8961
+ }
8962
+ let topWindow = window;
8963
+ if (window.top) {
8964
+ topWindow = window.top;
8965
+ }
8966
+ const visualViewportHeight = (_b = (_a = topWindow.visualViewport) == null ? void 0 : _a.height) != null ? _b : topWindow.innerHeight || topWindow.document.documentElement.clientHeight;
8967
+ return Math.max(topWindow.innerHeight - visualViewportHeight, 40);
8968
+ };
8950
8969
  class ScrollDomElement {
8951
8970
  constructor(element) {
8952
8971
  __publicField(this, "element");
8953
8972
  this.element = element;
8954
8973
  }
8955
8974
  getClientHeight() {
8956
- return this.element.clientHeight;
8975
+ return this.element.clientHeight - getVisualViewportHeightOffset();
8957
8976
  }
8958
8977
  getHorizontalScroll() {
8959
8978
  return this.element.scrollLeft;
@@ -9862,6 +9881,11 @@ var __publicField = (obj, key, value) => {
9862
9881
  });
9863
9882
  }
9864
9883
  function select(element) {
9884
+ const preventDefault = (event) => {
9885
+ event.preventDefault();
9886
+ event.stopPropagation();
9887
+ };
9888
+ document.addEventListener("selectionchange", preventDefault, { capture: true, passive: false });
9865
9889
  if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
9866
9890
  element.select();
9867
9891
  } else {
@@ -9871,6 +9895,9 @@ var __publicField = (obj, key, value) => {
9871
9895
  selection == null ? void 0 : selection.removeAllRanges();
9872
9896
  selection == null ? void 0 : selection.addRange(range);
9873
9897
  }
9898
+ setTimeout(() => {
9899
+ document.removeEventListener("selectionchange", preventDefault, { capture: true });
9900
+ });
9874
9901
  }
9875
9902
  async function copyTextToClipboard(text2) {
9876
9903
  const textarea2 = document.createElement("textarea");
@@ -11165,6 +11192,13 @@ var __publicField = (obj, key, value) => {
11165
11192
  __publicField(this, "mouseDownEvent", null);
11166
11193
  __publicField(this, "dbClickRef", null);
11167
11194
  __publicField(this, "handleContextMenu", (event) => {
11195
+ if (clientType.isMobile) {
11196
+ event.preventDefault();
11197
+ if (clientType.isAndroid) {
11198
+ this.editor.focus();
11199
+ }
11200
+ return;
11201
+ }
11168
11202
  if (clientType.isSafari) {
11169
11203
  const sel = document.getSelection();
11170
11204
  if (sel && !sel.isCollapsed) {
@@ -11189,7 +11223,7 @@ var __publicField = (obj, key, value) => {
11189
11223
  if (event.detail === 1) {
11190
11224
  this.editor.input.focus();
11191
11225
  }
11192
- if (event.detail === 3) {
11226
+ if (event.detail === 3 && !clientType.isMobile) {
11193
11227
  this.editor.selectionHandler.handleTripleClick(event);
11194
11228
  }
11195
11229
  if (event.detail === 1 && event.button === 0) {
@@ -11308,13 +11342,13 @@ var __publicField = (obj, key, value) => {
11308
11342
  container.ontouchend = this.handleMouseDown;
11309
11343
  } else {
11310
11344
  container.onmousedown = this.handleMouseDown;
11311
- container.oncontextmenu = this.handleContextMenu;
11312
11345
  }
11313
11346
  if (clientType.isIOS) {
11314
11347
  this.dbClickRef = bindDbClick(container, this.handleDblClick);
11315
11348
  } else {
11316
11349
  container.ondblclick = this.handleDblClick;
11317
11350
  }
11351
+ container.oncontextmenu = this.handleContextMenu;
11318
11352
  container.onclick = this.handleClick;
11319
11353
  }
11320
11354
  unbindEvents() {
@@ -25009,7 +25043,10 @@ var __publicField = (obj, key, value) => {
25009
25043
  const x1 = rect.x < 0 ? 0 : rect.x;
25010
25044
  const y1 = rect.y < 0 ? 0 : rect.y;
25011
25045
  const x2 = rect.right > window.innerWidth ? window.innerWidth : rect.right;
25012
- const y2 = rect.bottom > window.innerHeight ? window.innerHeight : rect.bottom;
25046
+ let y2 = rect.bottom > window.innerHeight ? window.innerHeight : rect.bottom;
25047
+ if (clientType.isIOS) {
25048
+ y2 -= getVisualViewportHeightOffset();
25049
+ }
25013
25050
  return new DOMRect(x1, y1, x2 - x1, y2 - y1);
25014
25051
  }
25015
25052
  function isBlockPositionVisible(editor, pos) {
@@ -30466,7 +30503,7 @@ ${codeText}
30466
30503
  Array.from(this.activeBlockAttributes).forEach(([key, value]) => {
30467
30504
  const op = { attributes, insert: "" };
30468
30505
  if (key === "color" || key === "backgroundColor") {
30469
- if (!value) {
30506
+ if (value === null || value === void 0) {
30470
30507
  deleteColor(op, key);
30471
30508
  } else {
30472
30509
  addColor(op, key, value);
@@ -39558,6 +39595,10 @@ ${codeText}
39558
39595
  constructor() {
39559
39596
  super(...arguments);
39560
39597
  __publicField(this, "tippyInstance", null);
39598
+ __publicField(this, "setProps", (props) => {
39599
+ var _a;
39600
+ (_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
39601
+ });
39561
39602
  }
39562
39603
  manualShow(target, options) {
39563
39604
  var _a, _b, _c;
@@ -46397,10 +46438,11 @@ ${codeText}
46397
46438
  element: this.createPasteElement(editor),
46398
46439
  states: []
46399
46440
  };
46400
- const items = [cutItem, copyItem];
46441
+ const items = [copyItem];
46401
46442
  if (this.options.withPaste) {
46402
46443
  items.push(pasteItem);
46403
46444
  }
46445
+ items.push(cutItem);
46404
46446
  return items;
46405
46447
  });
46406
46448
  __publicField(this, "getInsertCommands", () => []);
@@ -50280,7 +50322,7 @@ ${codeText}
50280
50322
  this.clipboardProvider.executeRangeCommand(editor, range, item);
50281
50323
  });
50282
50324
  this.editor = editor;
50283
- this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: true });
50325
+ this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: false });
50284
50326
  }
50285
50327
  commands(editor, block, child) {
50286
50328
  if (!editor.isWritable()) {
@@ -50290,11 +50332,10 @@ ${codeText}
50290
50332
  return void 0;
50291
50333
  }
50292
50334
  const commands = [];
50335
+ commands.push(...this.provider.getAvailableCommands(editor, block, this.editor.selection.range, { child }));
50293
50336
  if (clientType.isMobile) {
50294
50337
  this.clipboardProvider.getAvailableCommands(editor, block).forEach((c) => commands.push(c));
50295
- commands.push({ id: "separator", name: "", type: "separator" });
50296
50338
  }
50297
- commands.push(...this.provider.getAvailableCommands(editor, block, this.editor.selection.range, { child }));
50298
50339
  return {
50299
50340
  element: child,
50300
50341
  group: "hovering-toolbar",
@@ -50348,6 +50389,33 @@ ${codeText}
50348
50389
  return false;
50349
50390
  }
50350
50391
  }
50392
+ class SelectionProvider {
50393
+ constructor(editor) {
50394
+ __publicField(this, "id", "SelectionProvider");
50395
+ __publicField(this, "getInsertCommands", () => []);
50396
+ this.editor = editor;
50397
+ }
50398
+ getAvailableCommands(editor, block, range, params) {
50399
+ const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor);
50400
+ if (disabled && (params == null ? void 0 : params.isFilter)) {
50401
+ return [];
50402
+ }
50403
+ return [
50404
+ {
50405
+ name: i18n$1.t("commands.selectBlock"),
50406
+ id: "select-block",
50407
+ states: disabled ? ["disabled"] : []
50408
+ }
50409
+ ];
50410
+ }
50411
+ executeCommand(editor, block, range, command) {
50412
+ if (command.id === "select-block") {
50413
+ editor.selection.selectBlock(block, 0, getBlockTextLength$6(editor, block));
50414
+ return true;
50415
+ }
50416
+ return false;
50417
+ }
50418
+ }
50351
50419
  const logger$1S = getLogger("toolbar-handler");
50352
50420
  class OnesEditorToolbar {
50353
50421
  constructor(editor) {
@@ -50487,9 +50555,11 @@ ${codeText}
50487
50555
  OnesEditorHoveringBlock.get(editor).addFilter(this);
50488
50556
  editor.blockHooks.push(new LinkCommands(editor));
50489
50557
  if (clientType.isMobile) {
50490
- editor.editorCommandProviders.registerCommandProvider(new MobileLinkProvider(editor));
50558
+ editor.editorCommandProviders.registerCommandProvider(new MobileLinkProvider(editor, { linkMode: "edit" }));
50491
50559
  editor.editorCommandProviders.registerCommandProvider(new StandardBoxProvider(editor));
50492
50560
  editor.editorCommandProviders.registerCommandProvider(new ClipboardProvider(editor, { withPaste: true }));
50561
+ editor.editorCommandProviders.registerCommandProvider(new SelectionProvider(editor));
50562
+ editor.editorCommandProviders.registerCommandProvider(new MobileLinkProvider(editor, { linkMode: "insert" }));
50493
50563
  } else {
50494
50564
  editor.editorCommandProviders.registerCommandProvider(new BlockTurnIntoCommandProvider(editor));
50495
50565
  editor.editorCommandProviders.registerCommandProvider(new ParagraphProvider$1(editor));
@@ -57992,7 +58062,8 @@ $$${mathData.mathjaxText}$$
57992
58062
  code: "\u884C\u5185\u4EE3\u7801",
57993
58063
  subscript: "\u4E0B\u6807",
57994
58064
  superscript: "\u4E0A\u6807",
57995
- more: "\u66F4\u591A"
58065
+ more: "\u66F4\u591A",
58066
+ selectBlock: "\u9009\u62E9\u533A\u5757"
57996
58067
  }
57997
58068
  };
57998
58069
  const enUS$q = {
@@ -58047,7 +58118,8 @@ $$${mathData.mathjaxText}$$
58047
58118
  code: "Inline code",
58048
58119
  subscript: "Subscript",
58049
58120
  superscript: "Superscript",
58050
- more: "More"
58121
+ more: "More",
58122
+ selectBlock: "Select Block"
58051
58123
  }
58052
58124
  };
58053
58125
  const jaJP$q = {
@@ -58102,7 +58174,8 @@ $$${mathData.mathjaxText}$$
58102
58174
  code: "\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",
58103
58175
  subscript: "\u4E0B\u4ED8\u304D\u6587\u5B57",
58104
58176
  superscript: "\u4E0A\u4ED8\u304D\u6587\u5B57",
58105
- more: "\u305D\u306E\u4ED6"
58177
+ more: "\u305D\u306E\u4ED6",
58178
+ selectBlock: "\u30D6\u30ED\u30C3\u30AF\u3092\u9078\u629E"
58106
58179
  }
58107
58180
  };
58108
58181
  i18n$1.mergeLang({
@@ -59016,7 +59089,7 @@ $$${mathData.mathjaxText}$$
59016
59089
  }
59017
59090
  }
59018
59091
  class MobileLinkProvider {
59019
- constructor(editor) {
59092
+ constructor(editor, options) {
59020
59093
  __publicField(this, "id", "MobileLinkProvider");
59021
59094
  __publicField(this, "insertProvider");
59022
59095
  __publicField(this, "editProvider");
@@ -59040,12 +59113,16 @@ $$${mathData.mathjaxText}$$
59040
59113
  return null;
59041
59114
  });
59042
59115
  __publicField(this, "getAvailableCommands", (editor, block, range, params) => {
59116
+ var _a, _b;
59043
59117
  const editorRange = editor.selection.range;
59044
59118
  const child = this.getSelectedLinkChild(editor, editorRange);
59045
- if (child) {
59119
+ if (child && ((_a = this.options) == null ? void 0 : _a.linkMode) === "edit") {
59046
59120
  return this.editProvider.getAvailableCommands(editor, block, range, { child });
59047
59121
  }
59048
- return this.insertProvider.getAvailableCommands(editor, block, range, { ...params, isFilter: true });
59122
+ if (((_b = this.options) == null ? void 0 : _b.linkMode) === "insert" && !child) {
59123
+ return this.insertProvider.getAvailableCommands(editor, block, range, { ...params, isFilter: true });
59124
+ }
59125
+ return [];
59049
59126
  });
59050
59127
  __publicField(this, "executeCommand", (editor, block, range, item, params, result) => {
59051
59128
  var _a, _b, _c, _d, _e, _f;
@@ -59056,6 +59133,7 @@ $$${mathData.mathjaxText}$$
59056
59133
  }
59057
59134
  return (_f = (_e = (_d = this.insertProvider) == null ? void 0 : _d.executeCommand) == null ? void 0 : _e.call(_d, editor, block, range, item, params, result)) != null ? _f : false;
59058
59135
  });
59136
+ this.options = options;
59059
59137
  this.insertProvider = new LinkProvider(editor);
59060
59138
  this.editProvider = new EditLinkProvider();
59061
59139
  }
@@ -79627,7 +79705,7 @@ ${content}
79627
79705
  return groupEachCommand(commands);
79628
79706
  });
79629
79707
  __publicField(this, "showToolbar", () => {
79630
- hideToolbar$1(this.editor);
79708
+ tippy$1.hideAll();
79631
79709
  const commands = this.getCommands();
79632
79710
  this.toolbar.updateItems(commands);
79633
79711
  const focusBlock = this.editor.selection.focusedBlock;
@@ -79922,8 +80000,10 @@ ${content}
79922
80000
  __publicField(this, "mobileToolbar");
79923
80001
  __publicField(this, "fixedProviders");
79924
80002
  __publicField(this, "bar");
80003
+ __publicField(this, "subBar", null);
79925
80004
  __publicField(this, "handleSubBarShown", (_2, subBar) => {
79926
80005
  scrollBarIntoView(this.editor, subBar);
80006
+ this.subBar = subBar;
79927
80007
  });
79928
80008
  __publicField(this, "handleSelectionChange", debounce__default.default(() => {
79929
80009
  const commands = this.fixedProviders.getCommands(this.editor.selection.range);
@@ -79955,6 +80035,12 @@ ${content}
79955
80035
  }
79956
80036
  }, 500);
79957
80037
  }
80038
+ layoutSubBar() {
80039
+ var _a, _b, _c;
80040
+ if (((_a = this.subBar) == null ? void 0 : _a.isVisible) && this.subBar.parentItem) {
80041
+ (_c = (_b = this.subBar).setProps) == null ? void 0 : _c.call(_b, this.mobileToolbar.getSubBarOptions(this.subBar.parentItem));
80042
+ }
80043
+ }
79958
80044
  destroy() {
79959
80045
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
79960
80046
  this.mobileToolbar.destroy();
@@ -79986,9 +80072,19 @@ ${content}
79986
80072
  __publicField(this, "commandBar");
79987
80073
  __publicField(this, "observer");
79988
80074
  __publicField(this, "toggleDelay", clientType.isSafari ? 800 : 100);
80075
+ __publicField(this, "preHeight", this.virtualViewportHeight);
79989
80076
  __publicField(this, "layoutBar", debounce__default.default(() => {
79990
80077
  const offsetHeight = Math.max(this.clientHeight - this.virtualViewportHeight, 0);
80078
+ if (clientType.isIOS) {
80079
+ if (this.preHeight > this.virtualViewportHeight) {
80080
+ editorScrollIntoView(this.editor);
80081
+ }
80082
+ }
79991
80083
  this.commandBar.bar.style.bottom = `${offsetHeight}px`;
80084
+ if (this.preHeight !== this.virtualViewportHeight) {
80085
+ this.commandBar.layoutSubBar();
80086
+ }
80087
+ this.preHeight = this.virtualViewportHeight;
79992
80088
  }, this.toggleDelay));
79993
80089
  __publicField(this, "handScroll", debounce__default.default(() => {
79994
80090
  const input2 = this.editor.input.getInput();
@@ -80132,17 +80228,6 @@ ${content}
80132
80228
  this.editor.selection.selectBlock(block, offset, offset + 1);
80133
80229
  return true;
80134
80230
  }
80135
- if (this.editor.selection.range.isCollapsed()) {
80136
- const rangeRect = getBlockClientRects(this.editor, block, this.editor.selection.range);
80137
- const clientX = event.touches[0].clientX;
80138
- const clientY = event.touches[0].clientY;
80139
- const step = 10;
80140
- const inRect = rangeRect.some((rect) => clientX > rect.left - step && clientX < rect.right + step && clientY > rect.top - step && clientY < rect.bottom + step);
80141
- if (inRect) {
80142
- this.cursorToolbar.showToolbar();
80143
- return true;
80144
- }
80145
- }
80146
80231
  }
80147
80232
  return false;
80148
80233
  });
@@ -80160,6 +80245,11 @@ ${content}
80160
80245
  }, LONG_PRESS_DELAY);
80161
80246
  }
80162
80247
  });
80248
+ __publicField(this, "debounceShowCursorToolbar", debounce__default.default(() => {
80249
+ if (this.editor.selection.range.isCollapsed()) {
80250
+ this.cursorToolbar.showToolbar();
80251
+ }
80252
+ }, 400));
80163
80253
  __publicField(this, "handleTouchEnd", (event) => {
80164
80254
  if (this.longPressTimeout) {
80165
80255
  window.clearTimeout(this.longPressTimeout);
@@ -80171,6 +80261,17 @@ ${content}
80171
80261
  }
80172
80262
  this.longPressTriggered = false;
80173
80263
  this.isMoving = false;
80264
+ if (this.editor.selection.range.isCollapsed()) {
80265
+ const block = this.editor.selection.focusedBlock;
80266
+ const rangeRect = getBlockClientRects(this.editor, block, this.editor.selection.range);
80267
+ const clientX = event.changedTouches[0].clientX;
80268
+ const clientY = event.changedTouches[0].clientY;
80269
+ const step = 18;
80270
+ const inRect = rangeRect.some((rect) => clientX > rect.left - step && clientX < rect.right + step && clientY > rect.top - step && clientY < rect.bottom + step);
80271
+ if (inRect) {
80272
+ this.debounceShowCursorToolbar();
80273
+ }
80274
+ }
80174
80275
  });
80175
80276
  this.editor = editor;
80176
80277
  this.editor.addListener("selectionChanged", this.handleSelectionChange);
@@ -86615,7 +86716,7 @@ ${data2.flowchartText}
86615
86716
  }
86616
86717
  }
86617
86718
  });
86618
- editor.version = "2.1.1-beta.74";
86719
+ editor.version = "2.1.1-beta.76";
86619
86720
  if (Logger$2.level === LogLevel.DEBUG) {
86620
86721
  window.setReauthFail = (fail) => {
86621
86722
  window.isReauthError = fail;
@@ -86716,7 +86817,7 @@ ${data2.flowchartText}
86716
86817
  });
86717
86818
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
86718
86819
  OnesEditorToolbar.register(editor);
86719
- editor.version = "2.1.1-beta.74";
86820
+ editor.version = "2.1.1-beta.76";
86720
86821
  return editor;
86721
86822
  }
86722
86823
  async function showDocVersions(editor, options, serverUrl) {
@@ -132723,6 +132824,7 @@ ${data2.flowchartText}
132723
132824
  exports2.editorReplaceBlockText = editorReplaceBlockText;
132724
132825
  exports2.editorReplaceContainer = editorReplaceContainer;
132725
132826
  exports2.editorRunOnce = editorRunOnce;
132827
+ exports2.editorScrollIntoView = editorScrollIntoView;
132726
132828
  exports2.editorSelectAll = editorSelectAll;
132727
132829
  exports2.editorSelectContainer = editorSelectContainer;
132728
132830
  exports2.editorSelectDown = editorSelectDown;
@@ -132881,6 +132983,7 @@ ${data2.flowchartText}
132881
132983
  exports2.getTextOpLength = getTextOpLength;
132882
132984
  exports2.getTextWidth = getTextWidth;
132883
132985
  exports2.getToolbar = getToolbar;
132986
+ exports2.getVisualViewportHeightOffset = getVisualViewportHeightOffset;
132884
132987
  exports2.groupEachCommand = groupEachCommand;
132885
132988
  exports2.handleBlockElementUpdated = handleBlockElementUpdated$1;
132886
132989
  exports2.hasAltOnly = hasAltOnly;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.1-beta.74",
3
+ "version": "2.1.1-beta.76",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",