@lexical/selection 0.6.4 → 0.6.5
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/LexicalSelection.dev.js
CHANGED
|
@@ -684,6 +684,9 @@ function $getSelectionStyleValueForProperty(selection, styleProperty, defaultVal
|
|
|
684
684
|
|
|
685
685
|
function $updateElementNodeProperties(target, source) {
|
|
686
686
|
target.__children = Array.from(source.__children);
|
|
687
|
+
target.__first = source.__first;
|
|
688
|
+
target.__last = source.__last;
|
|
689
|
+
target.__size = source.__size;
|
|
687
690
|
target.__format = source.__format;
|
|
688
691
|
target.__indent = source.__indent;
|
|
689
692
|
target.__dir = source.__dir;
|
|
@@ -704,6 +707,8 @@ function $cloneWithProperties(node) {
|
|
|
704
707
|
|
|
705
708
|
const clone = constructor.clone(latest);
|
|
706
709
|
clone.__parent = latest.__parent;
|
|
710
|
+
clone.__next = latest.__next;
|
|
711
|
+
clone.__prev = latest.__prev;
|
|
707
712
|
|
|
708
713
|
if (lexical.$isElementNode(latest) && lexical.$isElementNode(clone)) {
|
|
709
714
|
return $updateElementNodeProperties(clone, latest);
|
package/LexicalSelection.prod.js
CHANGED
|
@@ -11,7 +11,8 @@ r&&l.$isLeafNode(m)&&!n.has(m.getKey())){if(m=r.getKey(),void 0===k.get(m)){let
|
|
|
11
11
|
d)e.insertAfter(d);else for(d=g.length-1;0<=d;d--)e.insertAfter(g[d]);else if(h=e.getFirstChild(),l.$isElementNode(h)&&(e=h),null===h)if(d)e.append(d);else for(d=0;d<g.length;d++)h=g[d],e.append(h),b=h;else if(null!==d)h.insertBefore(d);else for(e=0;e<g.length;e++)d=g[e],h.insertBefore(d),b=d;else if(d)e.insertAfter(d);else for(d=g.length-1;0<=d;d--)h=g[d],e.insertAfter(h),b=h;g=l.$getPreviousSelection();l.$isRangeSelection(g)&&g.anchor.getNode().isAttached()&&g.focus.getNode().isAttached()?l.$setSelection(g.clone()):
|
|
12
12
|
null!==b?b.selectEnd():a.dirty=!0}}function F(a,b,c,f){a.modify(b?"extend":"move",c,f)}function G(a){a=a.anchor.getNode();return"rtl"===(l.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}
|
|
13
13
|
function H(a,b,c,f,d,e){for(var k=b;null!==a;){for(b=a.getParent();null!==b&&b.excludeFromCopy("clone");)b=b.getParent();if(null===b)break;if(!l.$isElementNode(a)||!a.excludeFromCopy("clone")){let g=a.getKey(),h=e.get(g),p=void 0===h;p&&(h=w(a),e.set(g,h));!l.$isTextNode(h)||h.isSegmented()||h.isToken()?l.$isElementNode(h)&&(h.__children=h.__children.slice(f?k:0,f?void 0:(k||0)+1)):h.__text=h.__text.slice(f?k:0,f?c:k);if(l.$isRootNode(b)){p&&d.push(g);break}}k=e.get(b.getKey());k=l.$isElementNode(k)?
|
|
14
|
-
k.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=b}}
|
|
14
|
+
k.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=b}}
|
|
15
|
+
function w(a){a=a.getLatest();let b=a.constructor.clone(a);b.__parent=a.__parent;b.__next=a.__next;b.__prev=a.__prev;if(l.$isElementNode(a)&&l.$isElementNode(b))return b.__children=Array.from(a.__children),b.__first=a.__first,b.__last=a.__last,b.__size=a.__size,b.__format=a.__format,b.__indent=a.__indent,b.__dir=a.__dir,b;l.$isTextNode(a)&&l.$isTextNode(b)&&(b.__format=a.__format,b.__style=a.__style,b.__mode=a.__mode,b.__detail=a.__detail);return b}
|
|
15
16
|
function I(a,b){var c=B(a.getStyle());b=Object.entries(b).reduce((f,[d,e])=>{null===e?delete f[d]:f[d]=e;return f},{...c});c=C(b);a.setStyle(c);u.set(c,b)}exports.$addNodeStyle=function(a){a=a.getStyle();let b=A(a);u.set(a,b)};
|
|
16
17
|
exports.$cloneContents=function(a){var b={nodeMap:[],range:[]};if(l.$isRangeSelection(a)){{var c=a.anchor,f=a.focus;let [p,q]=a.getCharacterOffsets();b=a.getNodes();if(0===b.length||1===b.length&&l.$isElementNode(b[0])&&b[0].excludeFromCopy("clone"))b={nodeMap:[],range:[]};else{a=b.length;var d=b[0],e=d.getParent();if(null!==e&&(!e.canBeEmpty()||l.$isRootNode(e))){var k=e.__children;if(k.length===a){var g=!0;for(var h=0;h<k.length;h++)if(k[h]!==b[h].__key){g=!1;break}g&&(a++,b.push(e))}}e=b[a-1];
|
|
17
18
|
c=c.isBefore(f);f=new Map;k=[];g=l.$isTextNode(d)&&1===a;H(d,c?p:q,g?c?q:p:void 0,!0,k,f);for(d=0;d<a;d++){h=b[d];let m=h.getKey();if(!(f.has(m)||l.$isElementNode(h)&&h.excludeFromCopy("clone"))){let n=w(h);l.$isRootNode(h.getParent())&&k.push(h.getKey());"root"!==m&&f.set(m,n)}}H(e,g?void 0:c?q:p,void 0,!1,k,f);b={nodeMap:Array.from(f.entries()),range:k}}}}else if(l.DEPRECATED_$isGridSelection(a))b=v(a);else if(l.$isNodeSelection(a))throw Error("Minified Lexical error #1; visit https://lexical.dev/docs/error?code=1 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
package/package.json
CHANGED