@ones-editor/editor 2.1.1-beta.54 → 2.1.1-beta.55

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.
package/dist/index.js CHANGED
@@ -11210,25 +11210,19 @@ var __publicField = (obj, key, value) => {
11210
11210
  }
11211
11211
  });
11212
11212
  __publicField(this, "handleClick", (event) => {
11213
- if (!this.mouseDownEvent)
11214
- return;
11215
- const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
11216
- this.editor.emit("click", this.editor, mouseEvent);
11217
- const target = ensureIsMobileEvent(this.mouseDownEvent) ? this.mouseDownEvent.changedTouches[0].target : this.mouseDownEvent.target;
11213
+ this.editor.emit("click", this.editor, event);
11214
+ const target = event.target;
11218
11215
  if (isInBlockTools(target)) {
11219
- this.mouseDownEvent = null;
11220
11216
  return;
11221
11217
  }
11222
- if (event.detail === 1 || clientType.isMobile) {
11218
+ if (event.detail === 1) {
11223
11219
  this.editor.input.focus();
11224
11220
  }
11225
- if (!ensureIsMobileEvent(event) && event.detail === 3) {
11221
+ if (event.detail === 3) {
11226
11222
  this.editor.selectionHandler.handleTripleClick(event);
11227
11223
  }
11228
- if (event.detail === 1 || (ensureIsMobileEvent(event) || event.button === 0)) {
11229
- const clientX = ensureIsMobileEvent(event) ? event.changedTouches[0].clientX : event.clientX;
11230
- const clientY = ensureIsMobileEvent(event) ? event.changedTouches[0].clientY : event.clientY;
11231
- const elem = getElementFromPoint(clientX, clientY);
11224
+ if (event.detail === 1 && event.button === 0) {
11225
+ const elem = getElementFromPoint(event.clientX, event.clientY);
11232
11226
  if (elem && isChildNode(this.rootContainer, elem)) {
11233
11227
  const block = getParentBlock(elem);
11234
11228
  if (block && isChildNode(block, elem)) {
@@ -11236,19 +11230,17 @@ var __publicField = (obj, key, value) => {
11236
11230
  }
11237
11231
  }
11238
11232
  }
11239
- this.mouseDownEvent = null;
11240
11233
  });
11241
11234
  __publicField(this, "handleBlockClick", (event, block, elem) => {
11242
11235
  var _a, _b;
11243
11236
  if (!isTextKindBlock(this.editor, block)) {
11244
11237
  return;
11245
11238
  }
11246
- const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
11247
11239
  const box = getParentBox(elem);
11248
11240
  if (box) {
11249
11241
  const block2 = getParentBlock(box);
11250
11242
  assert(logger$4n, block2, "no parent block");
11251
- (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, mouseEvent);
11243
+ (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
11252
11244
  return;
11253
11245
  }
11254
11246
  const link2 = elem.closest("span.text.link");
@@ -11256,7 +11248,7 @@ var __publicField = (obj, key, value) => {
11256
11248
  const children = getTextBlockContentChildren(block);
11257
11249
  const index2 = children.indexOf(link2);
11258
11250
  if (index2 !== -1) {
11259
- this.editor.emit("clickLink", this.editor, mouseEvent, link2);
11251
+ this.editor.emit("clickLink", this.editor, event, link2);
11260
11252
  }
11261
11253
  }
11262
11254
  });
@@ -50555,8 +50547,12 @@ ${codeText}
50555
50547
  }
50556
50548
  this.toolbar.updateItems(allCommands);
50557
50549
  const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
50558
- const reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
50559
- const selectedBlock = reverseToolbar ? lastBlock2 : firstBlock;
50550
+ let reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
50551
+ let selectedBlock = reverseToolbar ? lastBlock2 : firstBlock;
50552
+ if (clientType.isMobile) {
50553
+ reverseToolbar = false;
50554
+ selectedBlock = firstBlock;
50555
+ }
50560
50556
  const rect = getReferenceClientRect(this.editor, selectedBlock);
50561
50557
  if (!this.toolbar.isVisible) {
50562
50558
  const anchor2 = createBlockAnchor(this.editor, selectedBlock.block, "editor-quick-menu", rect);
@@ -79994,6 +79990,7 @@ ${content}
79994
79990
  this.toggle();
79995
79991
  });
79996
79992
  this.editor = editor;
79993
+ createMobileBottomMenu();
79997
79994
  this.commandBar = new MobileToolbarHandler(editor, document.body);
79998
79995
  this.observer = new ActiveElementObserver({
79999
79996
  onFocused: this.handleFocusIn,
@@ -80075,6 +80072,7 @@ ${content}
80075
80072
  __publicField(this, "longPressTriggered", false);
80076
80073
  __publicField(this, "gripper");
80077
80074
  __publicField(this, "cursorToolbar");
80075
+ __publicField(this, "isMoving", false);
80078
80076
  __publicField(this, "handleSelectionChange", () => {
80079
80077
  this.gripper.update();
80080
80078
  });
@@ -80082,25 +80080,23 @@ ${content}
80082
80080
  const touch = event.touches[0];
80083
80081
  const range = getBlockRangeFromPoint(this.editor, touch.clientX, touch.clientY);
80084
80082
  if (!range || this.isMoving) {
80085
- return;
80083
+ return false;
80086
80084
  }
80087
80085
  if (!range.isSimple()) {
80088
80086
  this.editor.selection.setRange(range);
80089
- return;
80087
+ return true;
80090
80088
  }
80091
80089
  const block = this.editor.getBlockById(range.start.blockId);
80092
80090
  if (!isTextKindBlock(this.editor, block)) {
80093
80091
  this.editor.selection.selectBlock(block, 0);
80092
+ return true;
80094
80093
  }
80095
80094
  if (isTextKindBlock(this.editor, block)) {
80096
80095
  const offset = range.start.offset;
80097
80096
  const childInfo = getTextBlockChild(block, offset);
80098
80097
  if (childInfo.next && isBox(childInfo.next)) {
80099
80098
  this.editor.selection.selectBlock(block, offset, offset + 1);
80100
- this.editor.focus();
80101
- event.preventDefault();
80102
- event.stopPropagation();
80103
- return;
80099
+ return true;
80104
80100
  }
80105
80101
  if (this.editor.selection.range.isCollapsed()) {
80106
80102
  const rangeRect = getBlockClientRects(this.editor, block, this.editor.selection.range);
@@ -80110,14 +80106,12 @@ ${content}
80110
80106
  const inRect = rangeRect.some((rect) => clientX > rect.left - step && clientX < rect.right + step && clientY > rect.top - step && clientY < rect.bottom + step);
80111
80107
  if (inRect) {
80112
80108
  this.cursorToolbar.showToolbar();
80113
- event.preventDefault();
80114
- event.stopPropagation();
80115
- this.editor.focus();
80109
+ return true;
80116
80110
  }
80117
80111
  }
80118
80112
  }
80113
+ return false;
80119
80114
  });
80120
- __publicField(this, "isMoving", false);
80121
80115
  __publicField(this, "handleTouchMove", (event) => {
80122
80116
  this.isMoving = true;
80123
80117
  });
@@ -80126,7 +80120,9 @@ ${content}
80126
80120
  if (event.touches.length === 1) {
80127
80121
  this.longPressTimeout = window.setTimeout(() => {
80128
80122
  this.longPressTriggered = true;
80129
- this.handleLongPress(event);
80123
+ if (this.handleLongPress(event)) {
80124
+ this.editor.focus();
80125
+ }
80130
80126
  }, LONG_PRESS_DELAY);
80131
80127
  }
80132
80128
  });
@@ -80144,17 +80140,19 @@ ${content}
80144
80140
  });
80145
80141
  this.editor = editor;
80146
80142
  this.editor.addListener("selectionChanged", this.handleSelectionChange);
80143
+ this.editor.addListener("docChanged", this.handleSelectionChange);
80147
80144
  document.addEventListener("touchstart", this.handleTouchStart);
80148
80145
  document.addEventListener("touchend", this.handleTouchEnd, { capture: true });
80149
80146
  document.addEventListener("touchmove", this.handleTouchMove);
80150
80147
  this.gripper = new SelectionGripper(this.editor);
80151
- createMobileBottomMenu();
80152
80148
  this.cursorToolbar = createCursorToolbar(this.editor);
80153
80149
  }
80154
80150
  destroy() {
80155
80151
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
80152
+ this.editor.removeListener("docChanged", this.handleSelectionChange);
80156
80153
  document.removeEventListener("touchstart", this.handleTouchStart);
80157
80154
  document.removeEventListener("touchend", this.handleTouchEnd);
80155
+ document.removeEventListener("touchmove", this.handleTouchMove);
80158
80156
  }
80159
80157
  }
80160
80158
  function getChildContainers(editor, block, from, to) {
@@ -86540,7 +86538,7 @@ ${data2.flowchartText}
86540
86538
  }
86541
86539
  }
86542
86540
  });
86543
- editor.version = "2.1.1-beta.54";
86541
+ editor.version = "2.1.1-beta.55";
86544
86542
  if (Logger$2.level === LogLevel.DEBUG) {
86545
86543
  window.setReauthFail = (fail) => {
86546
86544
  window.isReauthError = fail;
@@ -86638,7 +86636,7 @@ ${data2.flowchartText}
86638
86636
  });
86639
86637
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
86640
86638
  OnesEditorToolbar.register(editor);
86641
- editor.version = "2.1.1-beta.54";
86639
+ editor.version = "2.1.1-beta.55";
86642
86640
  return editor;
86643
86641
  }
86644
86642
  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.54",
3
+ "version": "2.1.1-beta.55",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",