@ones-editor/editor 5.0.6-beta.p8216.2 → 5.0.6-beta.p8216.3

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
@@ -10107,6 +10107,15 @@ var __publicField = (obj, key, value) => {
10107
10107
  isMobileSafari: false
10108
10108
  };
10109
10109
  clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
10110
+ function isDOMNode(target) {
10111
+ return !!target && typeof target.nodeType === "number";
10112
+ }
10113
+ function isDOMElement(node) {
10114
+ return (node == null ? void 0 : node.nodeType) === 1;
10115
+ }
10116
+ function isDOMHTMLElement(node) {
10117
+ return isDOMElement(node) && node.namespaceURI === "http://www.w3.org/1999/xhtml";
10118
+ }
10110
10119
  const logger$4V = getLogger("dom-utils");
10111
10120
  function addClass(dom, ...className) {
10112
10121
  if (dom && dom.nodeType === Node.ELEMENT_NODE) {
@@ -10114,7 +10123,7 @@ var __publicField = (obj, key, value) => {
10114
10123
  }
10115
10124
  }
10116
10125
  function hasClass(dom, className) {
10117
- if (dom instanceof HTMLElement) {
10126
+ if (isDOMHTMLElement(dom)) {
10118
10127
  return dom.classList.contains(className);
10119
10128
  }
10120
10129
  return false;
@@ -10423,7 +10432,7 @@ var __publicField = (obj, key, value) => {
10423
10432
  }
10424
10433
  const elements = document.elementsFromPoint(x, y);
10425
10434
  const elem = elements.find((element) => {
10426
- if (element instanceof HTMLElement) {
10435
+ if (isDOMHTMLElement(element)) {
10427
10436
  if (!hasClass(element, "editor-disable-scroll")) {
10428
10437
  return true;
10429
10438
  }
@@ -12122,7 +12131,7 @@ var __publicField = (obj, key, value) => {
12122
12131
  return type;
12123
12132
  }
12124
12133
  function getParentBlock(node) {
12125
- const elem = node instanceof Element ? node : node.parentElement;
12134
+ const elem = isDOMElement(node) ? node : node.parentElement;
12126
12135
  if (!elem)
12127
12136
  return null;
12128
12137
  const block = elem.closest("div[data-type=editor-block]");
@@ -12131,7 +12140,7 @@ var __publicField = (obj, key, value) => {
12131
12140
  return block;
12132
12141
  }
12133
12142
  function getParentBlockExcludeSelf(node) {
12134
- const elem = node instanceof Element ? node : node.parentElement;
12143
+ const elem = isDOMElement(node) ? node : node.parentElement;
12135
12144
  if (!elem)
12136
12145
  return null;
12137
12146
  const block = elem.closest("div[data-type=editor-block]:not(:scope)");
@@ -12229,7 +12238,7 @@ var __publicField = (obj, key, value) => {
12229
12238
  return id;
12230
12239
  }
12231
12240
  function getParentBox(node) {
12232
- const elem = node instanceof Element ? node : node.parentElement;
12241
+ const elem = isDOMElement(node) ? node : node.parentElement;
12233
12242
  if (!elem)
12234
12243
  return null;
12235
12244
  const box = elem.closest("span[data-type=editor-box]");
@@ -12333,7 +12342,7 @@ var __publicField = (obj, key, value) => {
12333
12342
  return index2;
12334
12343
  }
12335
12344
  function isInBlock(target) {
12336
- if (!target || !(target instanceof Node)) {
12345
+ if (!isDOMNode(target)) {
12337
12346
  return false;
12338
12347
  }
12339
12348
  const block = getParentBlock(target);
@@ -12344,7 +12353,7 @@ var __publicField = (obj, key, value) => {
12344
12353
  return false;
12345
12354
  }
12346
12355
  const node = target;
12347
- const elem = node instanceof Element ? node : node.parentElement;
12356
+ const elem = isDOMElement(node) ? node : node.parentElement;
12348
12357
  if (!elem) {
12349
12358
  return false;
12350
12359
  }
@@ -12578,7 +12587,7 @@ var __publicField = (obj, key, value) => {
12578
12587
  return;
12579
12588
  }
12580
12589
  if (event.detail === 1) {
12581
- this.editor.input.focus();
12590
+ this.editor.input.focus({ preventScroll: true });
12582
12591
  }
12583
12592
  if (event.detail === 3 && !clientType.isMobile) {
12584
12593
  this.editor.selectionHandler.handleTripleClick(event);
@@ -12629,7 +12638,7 @@ var __publicField = (obj, key, value) => {
12629
12638
  if (!target) {
12630
12639
  return;
12631
12640
  }
12632
- if (!(target instanceof Node)) {
12641
+ if (!isDOMNode(target)) {
12633
12642
  return;
12634
12643
  }
12635
12644
  if (isInBlockTools(target)) {
@@ -12640,10 +12649,10 @@ var __publicField = (obj, key, value) => {
12640
12649
  return;
12641
12650
  }
12642
12651
  this.editor.selection.caret.update();
12643
- if (target instanceof HTMLElement && target.draggable) {
12652
+ if (isDOMHTMLElement(target) && target.draggable) {
12644
12653
  this.editor.selectionHandler.handleMouseDown(event);
12645
12654
  this.editor.selectionHandler.stopSelection();
12646
- this.editor.input.focus();
12655
+ this.editor.input.focus({ preventScroll: true });
12647
12656
  return;
12648
12657
  }
12649
12658
  if (ensureIsMobileEvent(event) || event.button === 0) {
@@ -26208,7 +26217,7 @@ var __publicField = (obj, key, value) => {
26208
26217
  }
26209
26218
  }
26210
26219
  }
26211
- const inEditor = event.target instanceof Node && this.editor.rootElement.contains(event.target);
26220
+ const inEditor = isDOMNode(event.target) && this.editor.rootElement.contains(event.target);
26212
26221
  const inFinder = !inEditor && this.finders.some((finder) => !finder.isInScope || finder.isInScope(this.editor, event));
26213
26222
  if (!inEditor && !inFinder) {
26214
26223
  this.cancelPendingEvent();
@@ -26579,7 +26588,7 @@ var __publicField = (obj, key, value) => {
26579
26588
  setTimeout(() => {
26580
26589
  this.editor.emit("focus", this.editor);
26581
26590
  this.callbacks.onFocus();
26582
- this.editor.input.focus();
26591
+ this.editor.input.focus({ preventScroll: true });
26583
26592
  this.focused = true;
26584
26593
  });
26585
26594
  }
@@ -55693,11 +55702,11 @@ ${codeText}
55693
55702
  const ele = OnesEditorHoveringBlock.get(this.editor).hoveringElem;
55694
55703
  if (!ele)
55695
55704
  return false;
55696
- if (!(ele instanceof Node))
55705
+ if (!isDOMNode(ele))
55697
55706
  return false;
55698
55707
  if (ele === block)
55699
55708
  return false;
55700
- return isChildNode(block, ele);
55709
+ return block.contains(ele);
55701
55710
  }
55702
55711
  updateItems(updater) {
55703
55712
  const updatedItems = updater(this.toolbar.items);
@@ -98046,7 +98055,7 @@ ${JSON.stringify(error2, null, 2)}`);
98046
98055
  }
98047
98056
  }
98048
98057
  });
98049
- editor.version = "5.0.6-beta.p8216.2";
98058
+ editor.version = "5.0.6-beta.p8216.3";
98050
98059
  return editor;
98051
98060
  }
98052
98061
  function isDoc(doc2) {
@@ -98182,7 +98191,7 @@ ${JSON.stringify(error2, null, 2)}`);
98182
98191
  OnesEditorDropTarget.register(editor);
98183
98192
  OnesEditorTocProvider.register(editor);
98184
98193
  OnesEditorExclusiveBlock.register(editor);
98185
- editor.version = "5.0.6-beta.p8216.2";
98194
+ editor.version = "5.0.6-beta.p8216.3";
98186
98195
  return editor;
98187
98196
  } catch (error2) {
98188
98197
  try {
@@ -98325,7 +98334,7 @@ ${JSON.stringify(error2, null, 2)}`);
98325
98334
  }
98326
98335
  }
98327
98336
  });
98328
- editor.version = "5.0.6-beta.p8216.2";
98337
+ editor.version = "5.0.6-beta.p8216.3";
98329
98338
  return editor;
98330
98339
  }
98331
98340
  const emojis$1 = {
@@ -144748,6 +144757,7 @@ ${JSON.stringify(error2, null, 2)}`);
144748
144757
  exports2.isContainerBlocksElement = isContainerBlocksElement;
144749
144758
  exports2.isContainerSelectedAllChildBlocks = isContainerSelectedAllChildBlocks;
144750
144759
  exports2.isControlEvent = isControlEvent;
144760
+ exports2.isDOMNode = isDOMNode;
144751
144761
  exports2.isDelete = isDelete;
144752
144762
  exports2.isDraggingFiles = isDraggingFiles;
144753
144763
  exports2.isElementVisible = isElementVisible;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "5.0.6-beta.p8216.2",
3
+ "version": "5.0.6-beta.p8216.3",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {