@haklex/rich-editor 0.64.2 → 0.65.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.
@@ -2591,10 +2591,15 @@ function getTopLevelBlockById(blockId) {
2591
2591
  for (const child of $getRoot().getChildren()) if ($getState(child, blockIdState) === blockId && $isElementNode(child)) return child;
2592
2592
  return null;
2593
2593
  }
2594
+ function isDetailsSummary(element) {
2595
+ return element.tagName === "SUMMARY" && element.parentElement?.tagName === "DETAILS";
2596
+ }
2594
2597
  function getTextLengthOfDomNode(node) {
2595
2598
  if (node.nodeType === Node.TEXT_NODE) return node.textContent?.length ?? 0;
2596
2599
  if (node.nodeType !== Node.ELEMENT_NODE) return 0;
2597
- if (node.tagName === "BR") return 1;
2600
+ const element = node;
2601
+ if (isDetailsSummary(element)) return 0;
2602
+ if (element.tagName === "BR") return 1;
2598
2603
  let length = 0;
2599
2604
  for (const child of node.childNodes) length += getTextLengthOfDomNode(child);
2600
2605
  return length;
@@ -2740,7 +2745,9 @@ function getTextOffsetFromDOMPoint(container, targetNode, targetOffset) {
2740
2745
  return false;
2741
2746
  }
2742
2747
  if (node.nodeType !== Node.ELEMENT_NODE) return false;
2743
- if (node.tagName === "BR") {
2748
+ const element = node;
2749
+ if (isDetailsSummary(element)) return false;
2750
+ if (element.tagName === "BR") {
2744
2751
  offset += 1;
2745
2752
  return false;
2746
2753
  }
@@ -2765,6 +2772,7 @@ function findDOMPointByTextOffset(container, requestedOffset) {
2765
2772
  }
2766
2773
  if (node.nodeType !== Node.ELEMENT_NODE) return null;
2767
2774
  const element = node;
2775
+ if (isDetailsSummary(element)) return null;
2768
2776
  if (element.tagName === "BR") {
2769
2777
  const parent = element.parentNode;
2770
2778
  if (!parent) return null;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { B as VideoUploadProvider, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, H as ImageUploadProvider, J as CorePlugins, K as FileUploadProvider, L as FileUploadPlugin, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, W as ImagePreprocessProvider, _ as $getRootBlock, a as EditorRefPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as FootnotePlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as SubmitShortcutPlugin, o as VideoUploadPlugin, p as getBlockElementById, r as OnChangePlugin, s as TextSelectionPlugin, t as AutoFocusPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./VirtualizationPlugin-YlqElmf0.js";
1
+ import { B as VideoUploadProvider, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, H as ImageUploadProvider, J as CorePlugins, K as FileUploadProvider, L as FileUploadPlugin, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, W as ImagePreprocessProvider, _ as $getRootBlock, a as EditorRefPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as FootnotePlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as SubmitShortcutPlugin, o as VideoUploadPlugin, p as getBlockElementById, r as OnChangePlugin, s as TextSelectionPlugin, t as AutoFocusPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./VirtualizationPlugin-D2ejRMj1.js";
2
2
  import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-8OWu2S8i.js";
3
3
  import { n as useEditorBlock } from "./EditorBlockContext-DytAx9Tg.js";
4
4
  import { J as NestedContentRendererProvider, X as useOptionalNestedContentRenderer, Y as useNestedContentRenderer, t as editorTheme } from "./theme-DH4xzxU-.js";
@@ -1,4 +1,4 @@
1
- import { $ as HorizontalRulePlugin, A as presentImageDialog, B as VideoUploadProvider, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as registerImageEditor, G as useImagePreprocess, H as ImageUploadProvider, I as resolvePreprocessTargets, J as CorePlugins, K as FileUploadProvider, L as FileUploadPlugin, M as getImageEditor, N as keepsOriginal, O as defaultImageUpload, P as markKeepOriginal, Q as InlineDndPlugin, R as setFileUploadEntry, U as useImageUpload, V as useVideoUpload, W as ImagePreprocessProvider, X as MarkdownPastePlugin, Y as MarkdownShortcutsPlugin, Z as ALL_TRANSFORMERS, a as EditorRefPlugin, et as ClickBelowPlugin, i as FootnotePlugin, j as ImageDialog, k as uploadImageFile, n as SubmitShortcutPlugin, nt as BlockExitPlugin, o as VideoUploadPlugin, q as useFileUpload, r as OnChangePlugin, rt as AutoLinkPlugin, s as TextSelectionPlugin, t as AutoFocusPlugin, tt as registerClickBelowCommand, z as useFileUploadEntry } from "./VirtualizationPlugin-YlqElmf0.js";
1
+ import { $ as HorizontalRulePlugin, A as presentImageDialog, B as VideoUploadProvider, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as registerImageEditor, G as useImagePreprocess, H as ImageUploadProvider, I as resolvePreprocessTargets, J as CorePlugins, K as FileUploadProvider, L as FileUploadPlugin, M as getImageEditor, N as keepsOriginal, O as defaultImageUpload, P as markKeepOriginal, Q as InlineDndPlugin, R as setFileUploadEntry, U as useImageUpload, V as useVideoUpload, W as ImagePreprocessProvider, X as MarkdownPastePlugin, Y as MarkdownShortcutsPlugin, Z as ALL_TRANSFORMERS, a as EditorRefPlugin, et as ClickBelowPlugin, i as FootnotePlugin, j as ImageDialog, k as uploadImageFile, n as SubmitShortcutPlugin, nt as BlockExitPlugin, o as VideoUploadPlugin, q as useFileUpload, r as OnChangePlugin, rt as AutoLinkPlugin, s as TextSelectionPlugin, t as AutoFocusPlugin, tt as registerClickBelowCommand, z as useFileUploadEntry } from "./VirtualizationPlugin-D2ejRMj1.js";
2
2
  import { $ as markInlineDraggable, Z as INLINE_DRAG_ATTR } from "./theme-DH4xzxU-.js";
3
3
  import { c as PasteLinkPlugin } from "./AlertQuoteEditNode-Ck4v29Wg.js";
4
4
  import { i as EditorSurfacePlugins, n as ActiveEditorScope, o as useActiveEditor, r as EditorSurfacePlugin, t as VirtualizationPlugin } from "./VirtualizationPlugin-nD_x-4yR.js";
@@ -1 +1 @@
1
- {"version":3,"file":"text-selection.d.ts","sourceRoot":"","sources":["../../src/utils/text-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,cAAc,EAAE,MAAM,SAAS,CAAC;AAgBxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAsID,wBAAgB,uCAAuC,CACrD,SAAS,EAAE,cAAc,GACxB,qBAAqB,GAAG,IAAI,CA2B9B;AAED,wBAAgB,qBAAqB,IAAI,qBAAqB,GAAG,IAAI,CAOpE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAe9E;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,IAAI,EAChB,YAAY,EAAE,MAAM,GACnB,MAAM,CA4CR;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,OAAO,EAClB,eAAe,EAAE,MAAM,GACtB,kBAAkB,GAAG,IAAI,CAiD3B;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WA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GAAG,WAAW,GAAG,IAAI,CAEjG;AAED,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,qBAAqB,GAC9B,KAAK,GAAG,IAAI,CA6Bd;AAED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,GAAG,IAAI,CAYhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-editor",
3
- "version": "0.64.2",
3
+ "version": "0.65.1",
4
4
  "description": "Core rich text editor based on Lexical",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,9 +57,9 @@
57
57
  "dist"
58
58
  ],
59
59
  "dependencies": {
60
- "@haklex/rich-editor-ui": "0.64.2",
61
- "@haklex/rich-headless": "0.64.2",
62
- "@haklex/rich-style-token": "0.64.2",
60
+ "@haklex/rich-editor-ui": "0.65.1",
61
+ "@haklex/rich-headless": "0.65.1",
62
+ "@haklex/rich-style-token": "0.65.1",
63
63
  "@lexical/code-core": "^0.53.0",
64
64
  "nanoid": "^6.0.2",
65
65
  "thumbhash": "^0.1.1"