@lexical/selection 0.44.1-nightly.20260519.0 → 0.45.0

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.
@@ -32,6 +32,7 @@ function formatDevErrorMessage(message) {
32
32
  *
33
33
  */
34
34
 
35
+
35
36
  /*@__INLINE__*/
36
37
  function warnOnlyOnce(message) {
37
38
  {
@@ -549,6 +550,29 @@ function $copyBlockFormatIndent(srcNode, destNode) {
549
550
  destNode.setIndent(indent);
550
551
  }
551
552
  }
553
+ function $isPointAtBlockStart(point, block) {
554
+ if (point.offset !== 0) {
555
+ return false;
556
+ }
557
+ let node = point.getNode();
558
+ // When an ElementNode is empty it's not possible to distinguish if
559
+ // the selection's intent is the entire block or the edge so we consider
560
+ // it to be the entire block
561
+ if (lexical.$isElementNode(node) && node.isEmpty()) {
562
+ return false;
563
+ }
564
+ while (!node.is(block)) {
565
+ if (node.getPreviousSibling() !== null) {
566
+ return false;
567
+ }
568
+ const parent = node.getParent();
569
+ if (parent === null) {
570
+ return false;
571
+ }
572
+ node = parent;
573
+ }
574
+ return true;
575
+ }
552
576
 
553
577
  /**
554
578
  * Converts all nodes in the selection that are of one block type to another.
@@ -557,28 +581,34 @@ function $copyBlockFormatIndent(srcNode, destNode) {
557
581
  * @param $afterCreateElement - The function that updates the new node based on the previous one ($copyBlockFormatIndent by default)
558
582
  */
559
583
  function $setBlocksType(selection, $createElement, $afterCreateElement = $copyBlockFormatIndent) {
560
- if (selection === null) {
584
+ if (!selection) {
561
585
  return;
562
586
  }
563
587
  // Selections tend to not include their containing blocks so we effectively
564
588
  // expand it here
565
589
  const anchorAndFocus = selection.getStartEndPoints();
590
+ let skipFocusAtBlockStart = false;
591
+ let focusBlock = null;
566
592
  const blockMap = new Map();
567
593
  if (anchorAndFocus) {
568
594
  const [anchor, focus] = anchorAndFocus;
569
595
  const anchorBlock = lexical.$findMatchingParent(anchor.getNode(), lexical.INTERNAL_$isBlock);
570
- const focusBlock = lexical.$findMatchingParent(focus.getNode(), lexical.INTERNAL_$isBlock);
596
+ focusBlock = lexical.$findMatchingParent(focus.getNode(), lexical.INTERNAL_$isBlock);
597
+ skipFocusAtBlockStart = lexical.$isElementNode(focusBlock) && !focusBlock.is(anchorBlock) && $isPointAtBlockStart(focus, focusBlock);
571
598
  if (lexical.$isElementNode(anchorBlock)) {
572
599
  blockMap.set(anchorBlock.getKey(), anchorBlock);
573
600
  }
574
- if (lexical.$isElementNode(focusBlock)) {
601
+ if (lexical.$isElementNode(focusBlock) && !skipFocusAtBlockStart) {
575
602
  blockMap.set(focusBlock.getKey(), focusBlock);
576
603
  }
577
604
  }
578
605
  for (const node of selection.getNodes()) {
579
606
  if (lexical.$isElementNode(node) && lexical.INTERNAL_$isBlock(node)) {
607
+ if (skipFocusAtBlockStart && node.is(focusBlock)) {
608
+ continue;
609
+ }
580
610
  blockMap.set(node.getKey(), node);
581
- } else if (anchorAndFocus === null) {
611
+ } else if (!anchorAndFocus) {
582
612
  const ancestorBlock = lexical.$findMatchingParent(node, lexical.INTERNAL_$isBlock);
583
613
  if (lexical.$isElementNode(ancestorBlock)) {
584
614
  blockMap.set(ancestorBlock.getKey(), ancestorBlock);
@@ -588,7 +618,7 @@ function $setBlocksType(selection, $createElement, $afterCreateElement = $copyBl
588
618
  // Selection remapping is delegated to LexicalNode.replace (and the
589
619
  // ListItemNode.replace override): both remap an element-anchored point
590
620
  // on the replaced block to {key: replacement, offset: prevSize + offset}.
591
- for (const [, prevNode] of blockMap) {
621
+ for (const prevNode of blockMap.values()) {
592
622
  const element = $createElement();
593
623
  $afterCreateElement(prevNode, element);
594
624
  prevNode.replace(element, true);
@@ -949,29 +979,43 @@ function $getNodeStyleValueForProperty(node, styleProperty, defaultValue) {
949
979
  function $getSelectionStyleValueForProperty(selection, styleProperty, defaultValue = '') {
950
980
  let styleValue = null;
951
981
  const nodes = selection.getNodes();
952
- const anchor = selection.anchor;
953
- const focus = selection.focus;
954
- const isBackward = selection.isBackward();
955
- const startNode = isBackward ? focus.getNode() : anchor.getNode();
956
- const endNode = isBackward ? anchor.getNode() : focus.getNode();
957
- const startOffset = isBackward ? focus.offset : anchor.offset;
958
- const endOffset = isBackward ? anchor.offset : focus.offset;
959
- if (lexical.$isRangeSelection(selection) && selection.isCollapsed() && selection.style !== '') {
960
- const css = selection.style;
961
- const styleObject = lexical.getStyleObjectFromCSS(css);
962
- if (styleObject !== null && styleProperty in styleObject) {
963
- return styleObject[styleProperty];
982
+
983
+ // The anchor/focus boundary handling below is specific to RangeSelection;
984
+ // other selection types (e.g. table) style every node they contain.
985
+ let startNode;
986
+ let endNode;
987
+ if (lexical.$isRangeSelection(selection)) {
988
+ if (selection.isCollapsed() && selection.style !== '') {
989
+ const styleObject = lexical.getStyleObjectFromCSS(selection.style);
990
+ if (styleObject !== null && styleProperty in styleObject) {
991
+ return styleObject[styleProperty];
992
+ }
993
+ }
994
+ const {
995
+ anchor,
996
+ focus
997
+ } = selection;
998
+ const isBackward = selection.isBackward();
999
+ const firstNode = isBackward ? focus.getNode() : anchor.getNode();
1000
+ const lastNode = isBackward ? anchor.getNode() : focus.getNode();
1001
+ const startOffset = isBackward ? focus.offset : anchor.offset;
1002
+ const endOffset = isBackward ? anchor.offset : focus.offset;
1003
+ // A boundary node contributes no styled text when the selection merely
1004
+ // touches its edge: the first node when the start offset is at its very
1005
+ // end, and the last node when the end offset is at its very beginning.
1006
+ if (lexical.$isTextNode(firstNode) && startOffset === firstNode.getTextContentSize()) {
1007
+ startNode = firstNode;
1008
+ }
1009
+ if (endOffset === 0) {
1010
+ endNode = lastNode;
964
1011
  }
965
1012
  }
966
1013
  for (let i = 0; i < nodes.length; i++) {
967
1014
  const node = nodes[i];
968
- if (i === 0 && node.is(startNode) && lexical.$isTextNode(node) && startOffset === node.getTextContentSize()) {
969
- continue;
970
- }
971
- if (i !== 0 && node.is(endNode) && endOffset === 0) {
972
- continue;
973
- }
974
- if (lexical.$isTextNode(node)) {
1015
+
1016
+ // Skip the excluded boundary node for this position (startNode at the
1017
+ // head, endNode elsewhere); both are undefined when nothing is excluded.
1018
+ if (lexical.$isTextNode(node) && !node.is(i === 0 ? startNode : endNode)) {
975
1019
  const nodeStyleValue = $getNodeStyleValueForProperty(node, styleProperty, defaultValue);
976
1020
  if (styleValue === null) {
977
1021
  styleValue = nodeStyleValue;
@@ -31,6 +31,7 @@ function formatDevErrorMessage(message) {
31
31
  *
32
32
  */
33
33
 
34
+
34
35
  /*@__INLINE__*/
35
36
  function warnOnlyOnce(message) {
36
37
  {
@@ -548,6 +549,29 @@ function $copyBlockFormatIndent(srcNode, destNode) {
548
549
  destNode.setIndent(indent);
549
550
  }
550
551
  }
552
+ function $isPointAtBlockStart(point, block) {
553
+ if (point.offset !== 0) {
554
+ return false;
555
+ }
556
+ let node = point.getNode();
557
+ // When an ElementNode is empty it's not possible to distinguish if
558
+ // the selection's intent is the entire block or the edge so we consider
559
+ // it to be the entire block
560
+ if ($isElementNode(node) && node.isEmpty()) {
561
+ return false;
562
+ }
563
+ while (!node.is(block)) {
564
+ if (node.getPreviousSibling() !== null) {
565
+ return false;
566
+ }
567
+ const parent = node.getParent();
568
+ if (parent === null) {
569
+ return false;
570
+ }
571
+ node = parent;
572
+ }
573
+ return true;
574
+ }
551
575
 
552
576
  /**
553
577
  * Converts all nodes in the selection that are of one block type to another.
@@ -556,28 +580,34 @@ function $copyBlockFormatIndent(srcNode, destNode) {
556
580
  * @param $afterCreateElement - The function that updates the new node based on the previous one ($copyBlockFormatIndent by default)
557
581
  */
558
582
  function $setBlocksType(selection, $createElement, $afterCreateElement = $copyBlockFormatIndent) {
559
- if (selection === null) {
583
+ if (!selection) {
560
584
  return;
561
585
  }
562
586
  // Selections tend to not include their containing blocks so we effectively
563
587
  // expand it here
564
588
  const anchorAndFocus = selection.getStartEndPoints();
589
+ let skipFocusAtBlockStart = false;
590
+ let focusBlock = null;
565
591
  const blockMap = new Map();
566
592
  if (anchorAndFocus) {
567
593
  const [anchor, focus] = anchorAndFocus;
568
594
  const anchorBlock = $findMatchingParent(anchor.getNode(), INTERNAL_$isBlock);
569
- const focusBlock = $findMatchingParent(focus.getNode(), INTERNAL_$isBlock);
595
+ focusBlock = $findMatchingParent(focus.getNode(), INTERNAL_$isBlock);
596
+ skipFocusAtBlockStart = $isElementNode(focusBlock) && !focusBlock.is(anchorBlock) && $isPointAtBlockStart(focus, focusBlock);
570
597
  if ($isElementNode(anchorBlock)) {
571
598
  blockMap.set(anchorBlock.getKey(), anchorBlock);
572
599
  }
573
- if ($isElementNode(focusBlock)) {
600
+ if ($isElementNode(focusBlock) && !skipFocusAtBlockStart) {
574
601
  blockMap.set(focusBlock.getKey(), focusBlock);
575
602
  }
576
603
  }
577
604
  for (const node of selection.getNodes()) {
578
605
  if ($isElementNode(node) && INTERNAL_$isBlock(node)) {
606
+ if (skipFocusAtBlockStart && node.is(focusBlock)) {
607
+ continue;
608
+ }
579
609
  blockMap.set(node.getKey(), node);
580
- } else if (anchorAndFocus === null) {
610
+ } else if (!anchorAndFocus) {
581
611
  const ancestorBlock = $findMatchingParent(node, INTERNAL_$isBlock);
582
612
  if ($isElementNode(ancestorBlock)) {
583
613
  blockMap.set(ancestorBlock.getKey(), ancestorBlock);
@@ -587,7 +617,7 @@ function $setBlocksType(selection, $createElement, $afterCreateElement = $copyBl
587
617
  // Selection remapping is delegated to LexicalNode.replace (and the
588
618
  // ListItemNode.replace override): both remap an element-anchored point
589
619
  // on the replaced block to {key: replacement, offset: prevSize + offset}.
590
- for (const [, prevNode] of blockMap) {
620
+ for (const prevNode of blockMap.values()) {
591
621
  const element = $createElement();
592
622
  $afterCreateElement(prevNode, element);
593
623
  prevNode.replace(element, true);
@@ -948,29 +978,43 @@ function $getNodeStyleValueForProperty(node, styleProperty, defaultValue) {
948
978
  function $getSelectionStyleValueForProperty(selection, styleProperty, defaultValue = '') {
949
979
  let styleValue = null;
950
980
  const nodes = selection.getNodes();
951
- const anchor = selection.anchor;
952
- const focus = selection.focus;
953
- const isBackward = selection.isBackward();
954
- const startNode = isBackward ? focus.getNode() : anchor.getNode();
955
- const endNode = isBackward ? anchor.getNode() : focus.getNode();
956
- const startOffset = isBackward ? focus.offset : anchor.offset;
957
- const endOffset = isBackward ? anchor.offset : focus.offset;
958
- if ($isRangeSelection(selection) && selection.isCollapsed() && selection.style !== '') {
959
- const css = selection.style;
960
- const styleObject = getStyleObjectFromCSS$1(css);
961
- if (styleObject !== null && styleProperty in styleObject) {
962
- return styleObject[styleProperty];
981
+
982
+ // The anchor/focus boundary handling below is specific to RangeSelection;
983
+ // other selection types (e.g. table) style every node they contain.
984
+ let startNode;
985
+ let endNode;
986
+ if ($isRangeSelection(selection)) {
987
+ if (selection.isCollapsed() && selection.style !== '') {
988
+ const styleObject = getStyleObjectFromCSS$1(selection.style);
989
+ if (styleObject !== null && styleProperty in styleObject) {
990
+ return styleObject[styleProperty];
991
+ }
992
+ }
993
+ const {
994
+ anchor,
995
+ focus
996
+ } = selection;
997
+ const isBackward = selection.isBackward();
998
+ const firstNode = isBackward ? focus.getNode() : anchor.getNode();
999
+ const lastNode = isBackward ? anchor.getNode() : focus.getNode();
1000
+ const startOffset = isBackward ? focus.offset : anchor.offset;
1001
+ const endOffset = isBackward ? anchor.offset : focus.offset;
1002
+ // A boundary node contributes no styled text when the selection merely
1003
+ // touches its edge: the first node when the start offset is at its very
1004
+ // end, and the last node when the end offset is at its very beginning.
1005
+ if ($isTextNode(firstNode) && startOffset === firstNode.getTextContentSize()) {
1006
+ startNode = firstNode;
1007
+ }
1008
+ if (endOffset === 0) {
1009
+ endNode = lastNode;
963
1010
  }
964
1011
  }
965
1012
  for (let i = 0; i < nodes.length; i++) {
966
1013
  const node = nodes[i];
967
- if (i === 0 && node.is(startNode) && $isTextNode(node) && startOffset === node.getTextContentSize()) {
968
- continue;
969
- }
970
- if (i !== 0 && node.is(endNode) && endOffset === 0) {
971
- continue;
972
- }
973
- if ($isTextNode(node)) {
1014
+
1015
+ // Skip the excluded boundary node for this position (startNode at the
1016
+ // head, endNode elsewhere); both are undefined when nothing is excluded.
1017
+ if ($isTextNode(node) && !node.is(i === 0 ? startNode : endNode)) {
974
1018
  const nodeStyleValue = $getNodeStyleValueForProperty(node, styleProperty, defaultValue);
975
1019
  if (styleValue === null) {
976
1020
  styleValue = nodeStyleValue;
@@ -30,7 +30,7 @@ declare export function $patchStyleText(
30
30
  },
31
31
  ): void;
32
32
  declare export function $getSelectionStyleValueForProperty(
33
- selection: RangeSelection,
33
+ selection: BaseSelection,
34
34
  styleProperty: string,
35
35
  defaultValue: string,
36
36
  ): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ "use strict";var e=require("lexical");function t(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function n(e){let t=e;for(;null!=t;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function o(e){const t=e.parentNode;if(null==t)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function r(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function i(t){const n=e.$getEditor().getElementByKey(t.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function s(t){return i(e.$isRootNode(t)?t:t.getParentOrThrow())}function l(t,n,o){let r=n.getNode(),i=o;if(e.$isElementNode(r)){const e=r.getDescendantByIndex(n.offset);null!==e&&(r=e)}for(;i>0&&null!==r;){if(e.$isElementNode(r)){const e=r.getLastDescendant();null!==e&&(r=e)}let o=r.getPreviousSibling(),s=0;if(null===o){let e=r.getParentOrThrow(),t=e.getPreviousSibling();for(;null===t;){if(e=e.getParent(),null===e){o=null;break}t=e.getPreviousSibling()}null!==e&&(s=e.isInline()?0:2,o=t)}let l=r.getTextContent();""===l&&e.$isElementNode(r)&&!r.isInline()&&(l="\n\n");const c=l.length;if(!e.$isTextNode(r)||i>=c){const t=r.getParent();r.remove(),null==t||0!==t.getChildrenSize()||e.$isRootNode(t)||t.remove(),i-=c+s,r=o}else{const o=r.getKey(),s=t.getEditorState().read(()=>{const t=e.$getNodeByKey(o);return e.$isTextNode(t)&&t.isSimpleText()?t.getTextContent():null}),f=c-i,d=l.slice(0,f);if(null!==s&&s!==l){const t=e.$getPreviousSelection();let n=r;if(r.isSimpleText())r.setTextContent(s);else{const t=e.$createTextNode(s);r.replace(t),n=t}if(e.$isRangeSelection(t)&&t.isCollapsed()){const e=t.anchor.offset;n.select(e,e)}}else if(r.isSimpleText()){const e=n.key===o;let t=n.offset;t<i&&(t=c);const s=e?t-i:0,l=e?t:f;if(e&&0===s){const[e]=r.splitText(s,l);e.remove()}else{const[,e]=r.splitText(s,l);e.remove()}}else{const t=e.$createTextNode(d);r.replace(t)}i=0}}}const c=()=>{};function f(n,o){(e.$isRangeSelection(n)?n.isCollapsed():e.$isTextNode(n)||e.$isElementNode(n))||t(280);const i=e.getStyleObjectFromCSS(e.$isRangeSelection(n)?n.style:e.$isTextNode(n)?n.getStyle():n.getTextStyle()),s=r(Object.entries(o).reduce((e,[t,o])=>("function"==typeof o?e[t]=o(i[t],n):null===o?delete e[t]:e[t]=o,e),{...i}));e.$isRangeSelection(n)||e.$isTextNode(n)?n.setStyle(s):n.setTextStyle(s)}function d(t){const n=e.$getSelection();if(!n)return;const o=new Map,r=e=>o.get(e.getKey())||[0,e.getTextContentSize()];if(e.$isRangeSelection(n))for(const t of e.$caretRangeFromSelection(n).getTextSlices())t&&o.set(t.caret.origin.getKey(),t.getSliceIndices());const i=n.getNodes();for(const n of i){if(!e.$isTextNode(n)||!n.canHaveFormat())continue;const[o,i]=r(n);if(i!==o)if(e.$isTokenOrSegmented(n)||0===o&&i===n.getTextContentSize())t(n);else{t(n.splitText(o,i)[0===o?0:1])}}e.$isRangeSelection(n)&&"text"===n.anchor.type&&"text"===n.focus.type&&n.anchor.key===n.focus.key&&a(n)}function a(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:r,type:i}=t;t.set(n.key,n.offset,n.type),n.set(o,r,i)}}function g(e,t){const n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function u(e){return e.getNode().isAttached()}function p(t){let n=t;for(;null!==n&&!e.$isRootOrShadowRoot(n);){const e=n.getLatest(),t=n.getParent();0===e.getChildrenSize()&&n.remove(!0),n=t}}function $(n,o,r,i,s=null){if(0===o.length)return;const l=o[0],c=new Map,f=[];let d=e.$isElementNode(l)?l:l.getParentOrThrow();d.isInline()&&(d=d.getParentOrThrow());let a=!1;for(;null!==d;){const t=d.getPreviousSibling();if(null!==t){d=t,a=!0;break}if(d=d.getParentOrThrow(),e.$isRootOrShadowRoot(d))break}const g=new Set;for(let t=0;t<r;t++){const n=o[t];e.$isElementNode(n)&&0===n.getChildrenSize()&&g.add(n.getKey())}const $=new Set;for(let n=0;n<r;n++){const r=o[n];let s=r.getParent();if(null!==s&&s.isInline()&&(s=s.getParent()),null!==s&&e.$isLeafNode(r)&&!$.has(r.getKey())){const t=s.getKey();if(void 0===c.get(t)){const n=i();n.setFormat(s.getFormatType()),n.setIndent(s.getIndent()),f.push(n),c.set(t,n);const o=s.getChildren();n.splice(n.getChildrenSize(),0,o);for(const t of o)if($.add(t.getKey()),e.$isElementNode(t))for(const e of t.getChildrenKeys())$.add(e);p(s)}}else if(g.has(r.getKey())){e.$isElementNode(r)||t(179);const n=i();n.setFormat(r.getFormatType()),n.setIndent(r.getIndent()),f.push(n),r.remove(!0)}}if(null!==s)for(let e=0;e<f.length;e++){const t=f[e];s.append(t)}let S=null;if(e.$isRootOrShadowRoot(d))if(a)if(null!==s)d.insertAfter(s);else for(let e=f.length-1;e>=0;e--){const t=f[e];d.insertAfter(t)}else{const t=d.getFirstChild();if(e.$isElementNode(t)&&(d=t),null===t)if(s)d.append(s);else for(let e=0;e<f.length;e++){const t=f[e];d.append(t),S=t}else if(null!==s)t.insertBefore(s);else for(let e=0;e<f.length;e++){const n=f[e];t.insertBefore(n),S=n}}else if(s)d.insertAfter(s);else for(let e=f.length-1;e>=0;e--){const t=f[e];d.insertAfter(t),S=t}const h=e.$getPreviousSelection();e.$isRangeSelection(h)&&u(h.anchor)&&u(h.focus)?e.$setSelection(h.clone()):null!==S?S.selectEnd():n.dirty=!0}function S(e){const t=h(e);return null!==t&&"vertical-rl"===t.writingMode}function h(t){const n=t.anchor.getNode();return e.$isElementNode(n)?i(n):s(n)}function m(e,t,n,o){e.modify(t?"extend":"move",n,o)}function N(e){const t=h(e);return null!==t&&"rtl"===t.direction}function y(t,n,o){const r=t.getStyle(),i=e.getStyleObjectFromCSS(r);return null!==i&&i[n]||o}const x=e.getStyleObjectFromCSS,T=l;exports.$cloneWithProperties=e.$cloneWithProperties,exports.$selectAll=e.$selectAll,exports.$addNodeStyle=c,exports.$copyBlockFormatIndent=g,exports.$ensureForwardRangeSelection=a,exports.$forEachSelectedTextNode=d,exports.$getComputedStyleForElement=i,exports.$getComputedStyleForParent=s,exports.$getSelectionStyleValueForProperty=function(t,n,o=""){let r=null;const i=t.getNodes();let s,l;if(e.$isRangeSelection(t)){if(t.isCollapsed()&&""!==t.style){const o=e.getStyleObjectFromCSS(t.style);if(null!==o&&n in o)return o[n]}const{anchor:o,focus:r}=t,i=t.isBackward(),c=i?r.getNode():o.getNode(),f=i?o.getNode():r.getNode(),d=i?r.offset:o.offset,a=i?o.offset:r.offset;e.$isTextNode(c)&&d===c.getTextContentSize()&&(s=c),0===a&&(l=f)}for(let t=0;t<i.length;t++){const c=i[t];if(e.$isTextNode(c)&&!c.is(0===t?s:l)){const e=y(c,n,o);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?o:r},exports.$isAtNodeEnd=function(n){if("text"===n.type)return n.offset===n.getNode().getTextContentSize();const o=n.getNode();return e.$isElementNode(o)||t(177),n.offset===o.getChildrenSize()},exports.$isParentElementRTL=N,exports.$isParentRTL=function(e){const t=s(e);return null!==t&&"rtl"===t.direction},exports.$moveCaretSelection=m,exports.$moveCharacter=function(e,t,n){const o=N(e);let r;r=S(e)||o?!n:n,m(e,t,r,"character")},exports.$patchStyleText=function(t,n){if(e.$isRangeSelection(t)&&t.isCollapsed()){f(t,n);const o=t.anchor.getNode();e.$isElementNode(o)&&o.isEmpty()&&f(o,n)}d(e=>{f(e,n)});const o=t.getNodes();if(o.length>0){const t=new Set;for(const r of o){if(!e.$isElementNode(r)||!r.canBeEmpty()||0!==r.getChildrenSize())continue;const o=r.getKey();t.has(o)||(t.add(o),f(r,n))}}},exports.$setBlocksType=function(t,n,o=g){if(!t)return;const r=t.getStartEndPoints();let i=!1,s=null;const l=new Map;if(r){const[t,n]=r,o=e.$findMatchingParent(t.getNode(),e.INTERNAL_$isBlock);s=e.$findMatchingParent(n.getNode(),e.INTERNAL_$isBlock),i=e.$isElementNode(s)&&!s.is(o)&&function(t,n){if(0!==t.offset)return!1;let o=t.getNode();if(e.$isElementNode(o)&&o.isEmpty())return!1;for(;!o.is(n);){if(null!==o.getPreviousSibling())return!1;const e=o.getParent();if(null===e)return!1;o=e}return!0}(n,s),e.$isElementNode(o)&&l.set(o.getKey(),o),e.$isElementNode(s)&&!i&&l.set(s.getKey(),s)}for(const n of t.getNodes())if(e.$isElementNode(n)&&e.INTERNAL_$isBlock(n)){if(i&&n.is(s))continue;l.set(n.getKey(),n)}else if(!r){const t=e.$findMatchingParent(n,e.INTERNAL_$isBlock);e.$isElementNode(t)&&l.set(t.getKey(),t)}for(const e of l.values()){const t=n();o(e,t),e.replace(t,!0)}},exports.$shouldOverrideDefaultCharacterSelection=function(t,n){let o=S(t)?!n:n;N(t)&&(o=!o);const r=e.$caretFromPoint(t.focus,o?"previous":"next");if(e.$isExtendableTextPointCaret(r))return!1;for(const t of e.$extendCaretToRange(r)){if(e.$isChildCaret(t))return!t.origin.isInline();if(!e.$isElementNode(t.origin)){if(e.$isDecoratorNode(t.origin))return!0;break}}return!1},exports.$sliceSelectedTextNodeContent=function(t,n,o="self"){const r=t.getStartEndPoints();if(n.isSelected(t)&&!e.$isTokenOrSegmented(n)&&null!==r){const[i,s]=r,l=t.isBackward(),c=i.getNode(),f=s.getNode(),d=n.is(c),a=n.is(f);if(d||a){const[r,i]=e.$getCharacterOffsets(t),s=c.is(f),d=n.is(l?f:c),a=n.is(l?c:f);let g,u=0;if(s)u=r>i?i:r,g=r>i?r:i;else if(d){u=l?i:r,g=void 0}else if(a){u=0,g=l?r:i}const p=n.__text.slice(u,g);p!==n.__text&&("clone"===o&&(n=e.$cloneWithPropertiesEphemeral(n)),n.__text=p)}}return n},exports.$trimTextContentFromAnchor=l,exports.$wrapNodes=function(t,n,o=null){const r=t.getStartEndPoints(),i=r?r[0]:null,s=t.getNodes(),l=s.length;if(null!==i&&(0===l||1===l&&"element"===i.type&&0===i.getNode().getChildrenSize())){const e="text"===i.type?i.getNode().getParentOrThrow():i.getNode(),t=e.getChildren();let r=n();return r.setFormat(e.getFormatType()),r.setIndent(e.getIndent()),t.forEach(e=>r.append(e)),o&&(r=o.append(r)),void e.replace(r)}let c=null,f=[];for(let r=0;r<l;r++){const i=s[r];e.$isRootOrShadowRoot(i)?($(t,f,f.length,n,o),f=[],c=i):null===c||null!==c&&e.$hasAncestor(i,c)?f.push(i):($(t,f,f.length,n,o),f=[i])}$(t,f,f.length,n,o)},exports.createDOMRange=function(t,r,i,s,l){const c=r.getKey(),f=s.getKey(),d=document.createRange();let a=t.getElementByKey(c),g=t.getElementByKey(f),u=i,p=l;if(e.$isTextNode(r)&&(a=n(a)),e.$isTextNode(s)&&(g=n(g)),void 0===r||void 0===s||null===a||null===g)return null;"BR"===a.nodeName&&([a,u]=o(a)),"BR"===g.nodeName&&([g,p]=o(g));const $=a.firstChild;a===g&&null!=$&&"BR"===$.nodeName&&0===u&&0===p&&(p=1);try{d.setStart(a,u),d.setEnd(g,p)}catch(e){return null}return!d.collapsed||u===p&&c===f||(d.setStart(g,p),d.setEnd(a,u)),d},exports.createRectsFromDOMRange=function(e,t){const n=e.getRootElement();if(null===n)return[];const o=n.getBoundingClientRect(),r=getComputedStyle(n),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects());let l,c=s.length;s.sort((e,t)=>{const n=e.top-t.top;return Math.abs(n)<=3?e.left-t.left:n});for(let e=0;e<c;e++){const t=s[e],n=l&&l.top<=t.top&&l.top+l.height>t.top&&l.left+l.width>t.left,r=t.width+i===o.width;n||r?(s.splice(e--,1),c--):l=t}return s},exports.getCSSFromStyleObject=r,exports.getStyleObjectFromCSS=x,exports.trimTextContentFromAnchor=T;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import{$isTextNode as e,$getEditor as t,$isRootNode as n,$getSelection as o,$isRangeSelection as l,$caretRangeFromSelection as r,$isTokenOrSegmented as i,$isElementNode as s,$getCharacterOffsets as c,$cloneWithPropertiesEphemeral as f,$getNodeByKey as u,$getPreviousSelection as g,$createTextNode as d,getStyleObjectFromCSS as a,$findMatchingParent as p,INTERNAL_$isBlock as h,$caretFromPoint as y,$isExtendableTextPointCaret as m,$extendCaretToRange as S,$isChildCaret as x,$isDecoratorNode as N,$isRootOrShadowRoot as T,$hasAncestor as C,$isLeafNode as v,$setSelection as w}from"lexical";export{$cloneWithProperties,$selectAll}from"lexical";function P(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function K(e){let t=e;for(;null!=t;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function E(e){const t=e.parentNode;if(null==t)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function I(t,n,o,l,r){const i=n.getKey(),s=l.getKey(),c=document.createRange();let f=t.getElementByKey(i),u=t.getElementByKey(s),g=o,d=r;if(e(n)&&(f=K(f)),e(l)&&(u=K(u)),void 0===n||void 0===l||null===f||null===u)return null;"BR"===f.nodeName&&([f,g]=E(f)),"BR"===u.nodeName&&([u,d]=E(u));const a=f.firstChild;f===u&&null!=a&&"BR"===a.nodeName&&0===g&&0===d&&(d=1);try{c.setStart(f,g),c.setEnd(u,d)}catch(e){return null}return!c.collapsed||g===d&&i===s||(c.setStart(u,d),c.setEnd(f,g)),c}function B(e,t){const n=e.getRootElement();if(null===n)return[];const o=n.getBoundingClientRect(),l=getComputedStyle(n),r=parseFloat(l.paddingLeft)+parseFloat(l.paddingRight),i=Array.from(t.getClientRects());let s,c=i.length;i.sort((e,t)=>{const n=e.top-t.top;return Math.abs(n)<=3?e.left-t.left:n});for(let e=0;e<c;e++){const t=i[e],n=s&&s.top<=t.top&&s.top+s.height>t.top&&s.left+s.width>t.left,l=t.width+r===o.width;n||l?(i.splice(e--,1),c--):s=t}return i}function F(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function b(e){const n=t().getElementByKey(e.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function k(e){return b(n(e)?e:e.getParentOrThrow())}function z(e){const t=k(e);return null!==t&&"rtl"===t.direction}function O(e,t,n="self"){const o=e.getStartEndPoints();if(t.isSelected(e)&&!i(t)&&null!==o){const[l,r]=o,i=e.isBackward(),s=l.getNode(),u=r.getNode(),g=t.is(s),d=t.is(u);if(g||d){const[o,l]=c(e),r=s.is(u),g=t.is(i?u:s),d=t.is(i?s:u);let a,p=0;if(r)p=o>l?l:o,a=o>l?o:l;else if(g){p=i?l:o,a=void 0}else if(d){p=0,a=i?o:l}const h=t.__text.slice(p,a);h!==t.__text&&("clone"===n&&(t=f(t)),t.__text=h)}}return t}function R(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return s(t)||P(177),e.offset===t.getChildrenSize()}function A(t,o,r){let i=o.getNode(),c=r;if(s(i)){const e=i.getDescendantByIndex(o.offset);null!==e&&(i=e)}for(;c>0&&null!==i;){if(s(i)){const e=i.getLastDescendant();null!==e&&(i=e)}let r=i.getPreviousSibling(),f=0;if(null===r){let e=i.getParentOrThrow(),t=e.getPreviousSibling();for(;null===t;){if(e=e.getParent(),null===e){r=null;break}t=e.getPreviousSibling()}null!==e&&(f=e.isInline()?0:2,r=t)}let a=i.getTextContent();""===a&&s(i)&&!i.isInline()&&(a="\n\n");const p=a.length;if(!e(i)||c>=p){const e=i.getParent();i.remove(),null==e||0!==e.getChildrenSize()||n(e)||e.remove(),c-=p+f,i=r}else{const n=i.getKey(),r=t.getEditorState().read(()=>{const t=u(n);return e(t)&&t.isSimpleText()?t.getTextContent():null}),s=p-c,f=a.slice(0,s);if(null!==r&&r!==a){const e=g();let t=i;if(i.isSimpleText())i.setTextContent(r);else{const e=d(r);i.replace(e),t=e}if(l(e)&&e.isCollapsed()){const n=e.anchor.offset;t.select(n,n)}}else if(i.isSimpleText()){const e=o.key===n;let t=o.offset;t<c&&(t=p);const l=e?t-c:0,r=e?t:s;if(e&&0===l){const[e]=i.splitText(l,r);e.remove()}else{const[,e]=i.splitText(l,r);e.remove()}}else{const e=d(f);i.replace(e)}c=0}}}const _=()=>{};function L(t,n){(l(t)?t.isCollapsed():e(t)||s(t))||P(280);const o=a(l(t)?t.style:e(t)?t.getStyle():t.getTextStyle()),r=F(Object.entries(n).reduce((e,[n,l])=>("function"==typeof l?e[n]=l(o[n],t):null===l?delete e[n]:e[n]=l,e),{...o}));l(t)||e(t)?t.setStyle(r):t.setTextStyle(r)}function M(e,t){if(l(e)&&e.isCollapsed()){L(e,t);const n=e.anchor.getNode();s(n)&&n.isEmpty()&&L(n,t)}$(e=>{L(e,t)});const n=e.getNodes();if(n.length>0){const e=new Set;for(const o of n){if(!s(o)||!o.canBeEmpty()||0!==o.getChildrenSize())continue;const n=o.getKey();e.has(n)||(e.add(n),L(o,t))}}}function $(t){const n=o();if(!n)return;const s=new Map,c=e=>s.get(e.getKey())||[0,e.getTextContentSize()];if(l(n))for(const e of r(n).getTextSlices())e&&s.set(e.caret.origin.getKey(),e.getSliceIndices());const f=n.getNodes();for(const n of f){if(!e(n)||!n.canHaveFormat())continue;const[o,l]=c(n);if(l!==o)if(i(n)||0===o&&l===n.getTextContentSize())t(n);else{t(n.splitText(o,l)[0===o?0:1])}}l(n)&&"text"===n.anchor.type&&"text"===n.focus.type&&n.anchor.key===n.focus.key&&D(n)}function D(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:l,type:r}=t;t.set(n.key,n.offset,n.type),n.set(o,l,r)}}function j(e,t){const n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function U(e,t,n=j){if(!e)return;const o=e.getStartEndPoints();let l=!1,r=null;const i=new Map;if(o){const[e,t]=o,n=p(e.getNode(),h);r=p(t.getNode(),h),l=s(r)&&!r.is(n)&&function(e,t){if(0!==e.offset)return!1;let n=e.getNode();if(s(n)&&n.isEmpty())return!1;for(;!n.is(t);){if(null!==n.getPreviousSibling())return!1;const e=n.getParent();if(null===e)return!1;n=e}return!0}(t,r),s(n)&&i.set(n.getKey(),n),s(r)&&!l&&i.set(r.getKey(),r)}for(const t of e.getNodes())if(s(t)&&h(t)){if(l&&t.is(r))continue;i.set(t.getKey(),t)}else if(!o){const e=p(t,h);s(e)&&i.set(e.getKey(),e)}for(const e of i.values()){const o=t();n(e,o),e.replace(o,!0)}}function H(e){return e.getNode().isAttached()}function V(e){let t=e;for(;null!==t&&!T(t);){const e=t.getLatest(),n=t.getParent();0===e.getChildrenSize()&&t.remove(!0),t=n}}function W(e,t,n=null){const o=e.getStartEndPoints(),l=o?o[0]:null,r=e.getNodes(),i=r.length;if(null!==l&&(0===i||1===i&&"element"===l.type&&0===l.getNode().getChildrenSize())){const e="text"===l.type?l.getNode().getParentOrThrow():l.getNode(),o=e.getChildren();let r=t();return r.setFormat(e.getFormatType()),r.setIndent(e.getIndent()),o.forEach(e=>r.append(e)),n&&(r=n.append(r)),void e.replace(r)}let s=null,c=[];for(let o=0;o<i;o++){const l=r[o];T(l)?(X(e,c,c.length,t,n),c=[],s=l):null===s||null!==s&&C(l,s)?c.push(l):(X(e,c,c.length,t,n),c=[l])}X(e,c,c.length,t,n)}function X(e,t,n,o,r=null){if(0===t.length)return;const i=t[0],c=new Map,f=[];let u=s(i)?i:i.getParentOrThrow();u.isInline()&&(u=u.getParentOrThrow());let d=!1;for(;null!==u;){const e=u.getPreviousSibling();if(null!==e){u=e,d=!0;break}if(u=u.getParentOrThrow(),T(u))break}const a=new Set;for(let e=0;e<n;e++){const n=t[e];s(n)&&0===n.getChildrenSize()&&a.add(n.getKey())}const p=new Set;for(let e=0;e<n;e++){const n=t[e];let l=n.getParent();if(null!==l&&l.isInline()&&(l=l.getParent()),null!==l&&v(n)&&!p.has(n.getKey())){const e=l.getKey();if(void 0===c.get(e)){const t=o();t.setFormat(l.getFormatType()),t.setIndent(l.getIndent()),f.push(t),c.set(e,t);const n=l.getChildren();t.splice(t.getChildrenSize(),0,n);for(const e of n)if(p.add(e.getKey()),s(e))for(const t of e.getChildrenKeys())p.add(t);V(l)}}else if(a.has(n.getKey())){s(n)||P(179);const e=o();e.setFormat(n.getFormatType()),e.setIndent(n.getIndent()),f.push(e),n.remove(!0)}}if(null!==r)for(let e=0;e<f.length;e++){const t=f[e];r.append(t)}let h=null;if(T(u))if(d)if(null!==r)u.insertAfter(r);else for(let e=f.length-1;e>=0;e--){const t=f[e];u.insertAfter(t)}else{const e=u.getFirstChild();if(s(e)&&(u=e),null===e)if(r)u.append(r);else for(let e=0;e<f.length;e++){const t=f[e];u.append(t),h=t}else if(null!==r)e.insertBefore(r);else for(let t=0;t<f.length;t++){const n=f[t];e.insertBefore(n),h=n}}else if(r)u.insertAfter(r);else for(let e=f.length-1;e>=0;e--){const t=f[e];u.insertAfter(t),h=t}const y=g();l(y)&&H(y.anchor)&&H(y.focus)?w(y.clone()):null!==h?h.selectEnd():e.dirty=!0}function q(e){const t=G(e);return null!==t&&"vertical-rl"===t.writingMode}function G(e){const t=e.anchor.getNode();return s(t)?b(t):k(t)}function J(e,t){let n=q(e)?!t:t;Y(e)&&(n=!n);const o=y(e.focus,n?"previous":"next");if(m(o))return!1;for(const e of S(o)){if(x(e))return!e.origin.isInline();if(!s(e.origin)){if(N(e.origin))return!0;break}}return!1}function Q(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Y(e){const t=G(e);return null!==t&&"rtl"===t.direction}function Z(e,t,n){const o=Y(e);let l;l=q(e)||o?!n:n,Q(e,t,l,"character")}function ee(e,t,n){const o=e.getStyle(),l=a(o);return null!==l&&l[t]||n}function te(t,n,o=""){let r=null;const i=t.getNodes();let s,c;if(l(t)){if(t.isCollapsed()&&""!==t.style){const e=a(t.style);if(null!==e&&n in e)return e[n]}const{anchor:o,focus:l}=t,r=t.isBackward(),i=r?l.getNode():o.getNode(),f=r?o.getNode():l.getNode(),u=r?l.offset:o.offset,g=r?o.offset:l.offset;e(i)&&u===i.getTextContentSize()&&(s=i),0===g&&(c=f)}for(let t=0;t<i.length;t++){const l=i[t];if(e(l)&&!l.is(0===t?s:c)){const e=ee(l,n,o);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?o:r}const ne=a,oe=A;export{_ as $addNodeStyle,j as $copyBlockFormatIndent,D as $ensureForwardRangeSelection,$ as $forEachSelectedTextNode,b as $getComputedStyleForElement,k as $getComputedStyleForParent,te as $getSelectionStyleValueForProperty,R as $isAtNodeEnd,Y as $isParentElementRTL,z as $isParentRTL,Q as $moveCaretSelection,Z as $moveCharacter,M as $patchStyleText,U as $setBlocksType,J as $shouldOverrideDefaultCharacterSelection,O as $sliceSelectedTextNodeContent,A as $trimTextContentFromAnchor,W as $wrapNodes,I as createDOMRange,B as createRectsFromDOMRange,F as getCSSFromStyleObject,ne as getStyleObjectFromCSS,oe as trimTextContentFromAnchor};
@@ -1,10 +1,3 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
1
  import { BaseSelection, ElementNode, LexicalEditor, Point, RangeSelection, TextNode } from 'lexical';
9
2
  /**
10
3
  * Generally used to append text content to HTML and JSON. Grabs the text content and "slices"
@@ -6,7 +6,6 @@
6
6
  *
7
7
  */
8
8
  import type { BaseSelection, ElementNode, LexicalNode, RangeSelection } from 'lexical';
9
- import { TableSelection } from '@lexical/table';
10
9
  export declare function $copyBlockFormatIndent(srcNode: ElementNode, destNode: ElementNode): void;
11
10
  /**
12
11
  * Converts all nodes in the selection that are of one block type to another.
@@ -69,4 +68,4 @@ export declare function $moveCharacter(selection: RangeSelection, isHoldingShift
69
68
  * @param defaultValue - The default value for the property, defaults to an empty string.
70
69
  * @returns The value of the property for the selected TextNodes.
71
70
  */
72
- export declare function $getSelectionStyleValueForProperty(selection: RangeSelection | TableSelection, styleProperty: string, defaultValue?: string): string;
71
+ export declare function $getSelectionStyleValueForProperty(selection: BaseSelection, styleProperty: string, defaultValue?: string): string;
package/package.json CHANGED
@@ -9,34 +9,49 @@
9
9
  "selection"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.44.1-nightly.20260519.0",
13
- "main": "LexicalSelection.js",
14
- "types": "index.d.ts",
12
+ "version": "0.45.0",
13
+ "main": "./dist/LexicalSelection.js",
14
+ "types": "./dist/index.d.ts",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/facebook/lexical.git",
18
18
  "directory": "packages/lexical-selection"
19
19
  },
20
- "module": "LexicalSelection.mjs",
20
+ "module": "./dist/LexicalSelection.mjs",
21
21
  "sideEffects": false,
22
22
  "exports": {
23
23
  ".": {
24
+ "source": "./src/index.ts",
24
25
  "import": {
25
- "types": "./index.d.ts",
26
- "development": "./LexicalSelection.dev.mjs",
27
- "production": "./LexicalSelection.prod.mjs",
28
- "node": "./LexicalSelection.node.mjs",
29
- "default": "./LexicalSelection.mjs"
26
+ "types": "./dist/index.d.ts",
27
+ "development": "./dist/LexicalSelection.dev.mjs",
28
+ "production": "./dist/LexicalSelection.prod.mjs",
29
+ "node": "./dist/LexicalSelection.node.mjs",
30
+ "default": "./dist/LexicalSelection.mjs"
30
31
  },
31
32
  "require": {
32
- "types": "./index.d.ts",
33
- "development": "./LexicalSelection.dev.js",
34
- "production": "./LexicalSelection.prod.js",
35
- "default": "./LexicalSelection.js"
33
+ "types": "./dist/index.d.ts",
34
+ "development": "./dist/LexicalSelection.dev.js",
35
+ "production": "./dist/LexicalSelection.prod.js",
36
+ "default": "./dist/LexicalSelection.js"
36
37
  }
37
38
  }
38
39
  },
39
40
  "dependencies": {
40
- "lexical": "0.44.1-nightly.20260519.0"
41
- }
41
+ "@lexical/internal": "0.45.0",
42
+ "lexical": "0.45.0"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "src",
47
+ "!src/__tests__",
48
+ "!src/__bench__",
49
+ "!src/__mocks__",
50
+ "!src/**/*.test.ts",
51
+ "!src/**/*.test.tsx",
52
+ "!src/**/*.bench.ts",
53
+ "!src/**/*.bench.tsx",
54
+ "README.md",
55
+ "LICENSE"
56
+ ]
42
57
  }
package/src/index.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import {getStyleObjectFromCSS as getStyleObjectFromCSS_} from 'lexical';
10
+
11
+ import {$trimTextContentFromAnchor} from './lexical-node';
12
+
13
+ export {
14
+ $addNodeStyle,
15
+ $ensureForwardRangeSelection,
16
+ $forEachSelectedTextNode,
17
+ $isAtNodeEnd,
18
+ $patchStyleText,
19
+ $sliceSelectedTextNodeContent,
20
+ $trimTextContentFromAnchor,
21
+ } from './lexical-node';
22
+ export {
23
+ $copyBlockFormatIndent,
24
+ $getSelectionStyleValueForProperty,
25
+ $isParentElementRTL,
26
+ $moveCaretSelection,
27
+ $moveCharacter,
28
+ $setBlocksType,
29
+ $shouldOverrideDefaultCharacterSelection,
30
+ $wrapNodes,
31
+ } from './range-selection';
32
+ export {
33
+ $getComputedStyleForElement,
34
+ $getComputedStyleForParent,
35
+ $isParentRTL,
36
+ createDOMRange,
37
+ createRectsFromDOMRange,
38
+ getCSSFromStyleObject,
39
+ } from './utils';
40
+ /** @deprecated moved to the `lexical` package */
41
+ export const getStyleObjectFromCSS = getStyleObjectFromCSS_;
42
+ /** @deprecated renamed to {@link $trimTextContentFromAnchor} by @lexical/eslint-plugin rules-of-lexical */
43
+ export const trimTextContentFromAnchor = $trimTextContentFromAnchor;
44
+ export {
45
+ /** @deprecated moved to the lexical package */ $cloneWithProperties,
46
+ /** @deprecated moved to the lexical package */ $selectAll,
47
+ } from 'lexical';