@lexical/selection
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -518,3 +518,7 @@ /** | ||
startOffset = 0; | ||
anchor.set(firstNode.getKey(), startOffset, 'text'); | ||
if (isBefore) { | ||
anchor.set(firstNode.getKey(), startOffset, 'text'); | ||
} else { | ||
focus.set(firstNode.getKey(), startOffset, 'text'); | ||
} | ||
} | ||
@@ -521,0 +525,0 @@ $patchStyle(firstNode, patch); |
@@ -9,25 +9,26 @@ /** | ||
'use strict';var k=require("lexical"),v;function w(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}v=w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w["default"]:w;let x=new Map; | ||
function y(a){for(;null!=a;){if(a.nodeType===Node.TEXT_NODE)return a;a=a.firstChild}return null}function z(a){let b=a.parentNode;if(null==b)throw Error("Should never happen");return[b,Array.from(b.childNodes).indexOf(a)]}function A(a){let b={};a=a.split(";");for(let c of a)if(""!==c){let [e,d]=c.split(/:([^]+)/);e&&d&&(b[e.trim()]=d.trim())}return b}function B(a){let b=x.get(a);void 0===b&&(b=A(a),x.set(a,b));return b}function C(a){let b="";for(let c in a)c&&(b+=`${c}: ${a[c]};`);return b} | ||
function D(a,b,c){let e=b.getNode();if(k.$isElementNode(e)){var d=e.getDescendantByIndex(b.offset);null!==d&&(e=d)}for(;0<c&&null!==e;){k.$isElementNode(e)&&(d=e.getLastDescendant(),null!==d&&(e=d));var g=e.getPreviousSibling(),h=0;if(null===g){d=e.getParentOrThrow();for(var f=d.getPreviousSibling();null===f;){d=d.getParent();if(null===d){g=null;break}f=d.getPreviousSibling()}null!==d&&(h=d.isInline()?0:2,g=f)}f=e.getTextContent();""===f&&k.$isElementNode(e)&&!e.isInline()&&(f="\n\n");d=f.length; | ||
'use strict';var k=require("lexical"),u;function w(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}u=w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w["default"]:w;let x=new Map; | ||
function y(a){for(;null!=a;){if(a.nodeType===Node.TEXT_NODE)return a;a=a.firstChild}return null}function z(a){let b=a.parentNode;if(null==b)throw Error("Should never happen");return[b,Array.from(b.childNodes).indexOf(a)]}function B(a){let b={};a=a.split(";");for(let c of a)if(""!==c){let [e,d]=c.split(/:([^]+)/);e&&d&&(b[e.trim()]=d.trim())}return b}function C(a){let b=x.get(a);void 0===b&&(b=B(a),x.set(a,b));return b}function D(a){let b="";for(let c in a)c&&(b+=`${c}: ${a[c]};`);return b} | ||
function E(a,b,c){let e=b.getNode();if(k.$isElementNode(e)){var d=e.getDescendantByIndex(b.offset);null!==d&&(e=d)}for(;0<c&&null!==e;){k.$isElementNode(e)&&(d=e.getLastDescendant(),null!==d&&(e=d));var g=e.getPreviousSibling(),h=0;if(null===g){d=e.getParentOrThrow();for(var f=d.getPreviousSibling();null===f;){d=d.getParent();if(null===d){g=null;break}f=d.getPreviousSibling()}null!==d&&(h=d.isInline()?0:2,g=f)}f=e.getTextContent();""===f&&k.$isElementNode(e)&&!e.isInline()&&(f="\n\n");d=f.length; | ||
if(!k.$isTextNode(e)||c>=d)f=e.getParent(),e.remove(),null==f||0!==f.getChildrenSize()||k.$isRootNode(f)||f.remove(),c-=d+h,e=g;else{let l=e.getKey();h=a.getEditorState().read(()=>{const p=k.$getNodeByKey(l);return k.$isTextNode(p)&&p.isSimpleText()?p.getTextContent():null});g=d-c;let m=f.slice(0,g);null!==h&&h!==f?(c=k.$getPreviousSelection(),d=e,e.isSimpleText()?e.setTextContent(h):(d=k.$createTextNode(h),e.replace(d)),k.$isRangeSelection(c)&&c.isCollapsed()&&(c=c.anchor.offset,d.select(c,c))): | ||
e.isSimpleText()?(h=b.key===l,f=b.offset,f<c&&(f=d),c=h?f-c:0,d=h?f:g,h&&0===c?([c]=e.splitText(c,d),c.remove()):([,c]=e.splitText(c,d),c.remove())):(c=k.$createTextNode(m),e.replace(c));c=0}}}function E(a,b){let c=B("getStyle"in a?a.getStyle():a.style);b=Object.entries(b).reduce((d,[g,h])=>{h instanceof Function?d[g]=h(c[g]):null===h?delete d[g]:d[g]=h;return d},{...c});let e=C(b);a.setStyle(e);x.set(e,b)} | ||
function F(a){for(;null!==a&&!k.$isRootOrShadowRoot(a);){let b=a.getLatest(),c=a.getParent();0===b.getChildrenSize()&&a.remove(!0);a=c}} | ||
function G(a,b,c,e,d=null){if(0!==b.length){var g=b[0],h=new Map,f=[];g=k.$isElementNode(g)?g:g.getParentOrThrow();g.isInline()&&(g=g.getParentOrThrow());for(var l=!1;null!==g;){var m=g.getPreviousSibling();if(null!==m){g=m;l=!0;break}g=g.getParentOrThrow();if(k.$isRootOrShadowRoot(g))break}m=new Set;for(var p=0;p<c;p++){var q=b[p];k.$isElementNode(q)&&0===q.getChildrenSize()&&m.add(q.getKey())}var n=new Set;for(p=0;p<c;p++){q=b[p];var r=q.getParent();null!==r&&r.isInline()&&(r=r.getParent());if(null!== | ||
r&&k.$isLeafNode(q)&&!n.has(q.getKey())){if(q=r.getKey(),void 0===h.get(q)){let t=e();t.setFormat(r.getFormatType());t.setIndent(r.getIndent());f.push(t);h.set(q,t);r.getChildren().forEach(u=>{t.append(u);n.add(u.getKey());k.$isElementNode(u)&&u.getChildrenKeys().forEach(K=>n.add(K))});F(r)}}else m.has(q.getKey())&&(k.$isElementNode(q)||v(179),r=e(),r.setFormat(q.getFormatType()),r.setIndent(q.getIndent()),f.push(r),q.remove(!0))}if(null!==d)for(b=0;b<f.length;b++)d.append(f[b]);b=null;if(k.$isRootOrShadowRoot(g))if(l)if(null!== | ||
e.isSimpleText()?(h=b.key===l,f=b.offset,f<c&&(f=d),c=h?f-c:0,d=h?f:g,h&&0===c?([c]=e.splitText(c,d),c.remove()):([,c]=e.splitText(c,d),c.remove())):(c=k.$createTextNode(m),e.replace(c));c=0}}}function F(a,b){let c=C("getStyle"in a?a.getStyle():a.style);b=Object.entries(b).reduce((d,[g,h])=>{h instanceof Function?d[g]=h(c[g]):null===h?delete d[g]:d[g]=h;return d},{...c});let e=D(b);a.setStyle(e);x.set(e,b)} | ||
function G(a){for(;null!==a&&!k.$isRootOrShadowRoot(a);){let b=a.getLatest(),c=a.getParent();0===b.getChildrenSize()&&a.remove(!0);a=c}} | ||
function H(a,b,c,e,d=null){if(0!==b.length){var g=b[0],h=new Map,f=[];g=k.$isElementNode(g)?g:g.getParentOrThrow();g.isInline()&&(g=g.getParentOrThrow());for(var l=!1;null!==g;){var m=g.getPreviousSibling();if(null!==m){g=m;l=!0;break}g=g.getParentOrThrow();if(k.$isRootOrShadowRoot(g))break}m=new Set;for(var p=0;p<c;p++){var q=b[p];k.$isElementNode(q)&&0===q.getChildrenSize()&&m.add(q.getKey())}var n=new Set;for(p=0;p<c;p++){q=b[p];var r=q.getParent();null!==r&&r.isInline()&&(r=r.getParent());if(null!== | ||
r&&k.$isLeafNode(q)&&!n.has(q.getKey())){if(q=r.getKey(),void 0===h.get(q)){let t=e();t.setFormat(r.getFormatType());t.setIndent(r.getIndent());f.push(t);h.set(q,t);r.getChildren().forEach(v=>{t.append(v);n.add(v.getKey());k.$isElementNode(v)&&v.getChildrenKeys().forEach(A=>n.add(A))});G(r)}}else m.has(q.getKey())&&(k.$isElementNode(q)||u(179),r=e(),r.setFormat(q.getFormatType()),r.setIndent(q.getIndent()),f.push(r),q.remove(!0))}if(null!==d)for(b=0;b<f.length;b++)d.append(f[b]);b=null;if(k.$isRootOrShadowRoot(g))if(l)if(null!== | ||
d)g.insertAfter(d);else for(d=f.length-1;0<=d;d--)g.insertAfter(f[d]);else if(l=g.getFirstChild(),k.$isElementNode(l)&&(g=l),null===l)if(d)g.append(d);else for(d=0;d<f.length;d++)l=f[d],g.append(l),b=l;else if(null!==d)l.insertBefore(d);else for(g=0;g<f.length;g++)d=f[g],l.insertBefore(d),b=d;else if(d)g.insertAfter(d);else for(d=f.length-1;0<=d;d--)l=f[d],g.insertAfter(l),b=l;f=k.$getPreviousSelection();k.$isRangeSelection(f)&&f.anchor.getNode().isAttached()&&f.focus.getNode().isAttached()?k.$setSelection(f.clone()): | ||
null!==b?b.selectEnd():a.dirty=!0}}function H(a,b,c,e){a.modify(b?"extend":"move",c,e)}function I(a){a=a.anchor.getNode();return"rtl"===(k.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function J(a){if(k.$isDecoratorNode(a)||!k.$isElementNode(a)||k.$isRootOrShadowRoot(a))return!1;var b=a.getFirstChild();b=null===b||k.$isLineBreakNode(b)||k.$isTextNode(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}exports.$addNodeStyle=function(a){a=a.getStyle();let b=A(a);x.set(a,b)}; | ||
null!==b?b.selectEnd():a.dirty=!0}}function I(a,b,c,e){a.modify(b?"extend":"move",c,e)}function J(a){a=a.anchor.getNode();return"rtl"===(k.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function K(a){if(k.$isDecoratorNode(a)||!k.$isElementNode(a)||k.$isRootOrShadowRoot(a))return!1;var b=a.getFirstChild();b=null===b||k.$isLineBreakNode(b)||k.$isTextNode(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}exports.$addNodeStyle=function(a){a=a.getStyle();let b=B(a);x.set(a,b)}; | ||
exports.$cloneWithProperties=function(a){let b=a.constructor.clone(a);b.__parent=a.__parent;b.__next=a.__next;b.__prev=a.__prev;if(k.$isElementNode(a)&&k.$isElementNode(b))return 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;if(k.$isTextNode(a)&&k.$isTextNode(b))return b.__format=a.__format,b.__style=a.__style,b.__mode=a.__mode,b.__detail=a.__detail,b;k.$isParagraphNode(a)&&k.$isParagraphNode(b)&&(b.__textFormat=a.__textFormat); | ||
return b};exports.$getSelectionStyleValueForProperty=function(a,b,c=""){let e=null,d=a.getNodes();var g=a.anchor,h=a.focus,f=a.isBackward();let l=f?h.offset:g.offset;g=f?h.getNode():g.getNode();if(k.$isRangeSelection(a)&&a.isCollapsed()&&""!==a.style&&(a=B(a.style),null!==a&&b in a))return a[b];for(a=0;a<d.length;a++){var m=d[a];if((0===a||0!==l||!m.is(g))&&k.$isTextNode(m))if(h=b,f=c,m=m.getStyle(),m=B(m),h=null!==m?m[h]||f:f,null===e)e=h;else if(e!==h){e="";break}}return null===e?c:e}; | ||
exports.$isAtNodeEnd=function(a){if("text"===a.type)return a.offset===a.getNode().getTextContentSize();let b=a.getNode();k.$isElementNode(b)||v(177);return a.offset===b.getChildrenSize()};exports.$isParentElementRTL=I;exports.$moveCaretSelection=H;exports.$moveCharacter=function(a,b,c){let e=I(a);H(a,b,c?!e:e,"character")}; | ||
exports.$patchStyleText=function(a,b){var c=a.getNodes(),e=c.length,d=a.getStartEndPoints();if(null!==d){var [g,h]=d;--e;d=c[0];var f=c[e];if(a.isCollapsed()&&k.$isRangeSelection(a))E(a,b);else{var l=d.getTextContent().length,m=h.offset,p=g.offset,q=g.isBefore(h),n=q?p:m;a=q?m:p;var r=q?g.type:h.type,t=q?h.type:g.type;q=q?h.key:g.key;if(k.$isTextNode(d)&&n===l){let u=d.getNextSibling();k.$isTextNode(u)&&(n=p=0,d=u)}if(1===c.length)k.$isTextNode(d)&&d.canHaveFormat()&&(n="element"===r?0:p>m?m:p,a= | ||
"element"===t?l:p>m?p:m,n!==a&&(0===n&&a===l?(E(d,b),d.select(n,a)):(c=d.splitText(n,a),c=0===n?c[0]:c[1],E(c,b),c.select(0,a-n))));else for(k.$isTextNode(d)&&n<d.getTextContentSize()&&d.canHaveFormat()&&(0!==n&&(d=d.splitText(n)[1],n=0,g.set(d.getKey(),n,"text")),E(d,b)),k.$isTextNode(f)&&f.canHaveFormat()&&(n=f.getTextContent().length,f.__key!==q&&0!==a&&(a=n),a!==n&&([f]=f.splitText(a)),0===a&&"element"!==t||E(f,b)),a=1;a<e;a++)n=c[a],t=n.getKey(),k.$isTextNode(n)&&n.canHaveFormat()&&t!==d.getKey()&& | ||
t!==f.getKey()&&!n.isToken()&&E(n,b)}}};exports.$selectAll=function(a){let b=a.anchor;a=a.focus;var c=b.getNode().getTopLevelElementOrThrow().getParentOrThrow();let e=c.getFirstDescendant();c=c.getLastDescendant();let d="element",g="element",h=0;k.$isTextNode(e)?d="text":k.$isElementNode(e)||null===e||(e=e.getParentOrThrow());k.$isTextNode(c)?(g="text",h=c.getTextContentSize()):k.$isElementNode(c)||null===c||(c=c.getParentOrThrow());e&&c&&(b.set(e.getKey(),0,d),a.set(c.getKey(),h,g))}; | ||
exports.$setBlocksType=function(a,b){if(null!==a){var c=a.getStartEndPoints();c=c?c[0]:null;if(null!==c&&"root"===c.key)b=b(),a=k.$getRoot(),(c=a.getFirstChild())?c.replace(b,!0):a.append(b);else{a=a.getNodes();if(null!==c){for(c=c.getNode();null!==c&&null!==c.getParent()&&!J(c);)c=c.getParentOrThrow();c=J(c)?c:null}else c=!1;c&&-1===a.indexOf(c)&&a.push(c);for(c=0;c<a.length;c++){let e=a[c];if(!J(e))continue;k.$isElementNode(e)||v(178);let d=b();d.setFormat(e.getFormatType());d.setIndent(e.getIndent()); | ||
return b};exports.$getSelectionStyleValueForProperty=function(a,b,c=""){let e=null,d=a.getNodes();var g=a.anchor,h=a.focus,f=a.isBackward();let l=f?h.offset:g.offset;g=f?h.getNode():g.getNode();if(k.$isRangeSelection(a)&&a.isCollapsed()&&""!==a.style&&(a=C(a.style),null!==a&&b in a))return a[b];for(a=0;a<d.length;a++){var m=d[a];if((0===a||0!==l||!m.is(g))&&k.$isTextNode(m))if(h=b,f=c,m=m.getStyle(),m=C(m),h=null!==m?m[h]||f:f,null===e)e=h;else if(e!==h){e="";break}}return null===e?c:e}; | ||
exports.$isAtNodeEnd=function(a){if("text"===a.type)return a.offset===a.getNode().getTextContentSize();let b=a.getNode();k.$isElementNode(b)||u(177);return a.offset===b.getChildrenSize()};exports.$isParentElementRTL=J;exports.$moveCaretSelection=I;exports.$moveCharacter=function(a,b,c){let e=J(a);I(a,b,c?!e:e,"character")}; | ||
exports.$patchStyleText=function(a,b){var c=a.getNodes(),e=c.length,d=a.getStartEndPoints();if(null!==d){var [g,h]=d;--e;d=c[0];var f=c[e];if(a.isCollapsed()&&k.$isRangeSelection(a))F(a,b);else{var l=d.getTextContent().length,m=h.offset,p=g.offset,q=g.isBefore(h),n=q?p:m;a=q?m:p;var r=q?g.type:h.type,t=q?h.type:g.type,v=q?h.key:g.key;if(k.$isTextNode(d)&&n===l){let A=d.getNextSibling();k.$isTextNode(A)&&(n=p=0,d=A)}if(1===c.length)k.$isTextNode(d)&&d.canHaveFormat()&&(n="element"===r?0:p>m?m:p,a= | ||
"element"===t?l:p>m?p:m,n!==a&&(0===n&&a===l?(F(d,b),d.select(n,a)):(c=d.splitText(n,a),c=0===n?c[0]:c[1],F(c,b),c.select(0,a-n))));else for(k.$isTextNode(d)&&n<d.getTextContentSize()&&d.canHaveFormat()&&(0!==n&&(d=d.splitText(n)[1],n=0,q?g.set(d.getKey(),n,"text"):h.set(d.getKey(),n,"text")),F(d,b)),k.$isTextNode(f)&&f.canHaveFormat()&&(n=f.getTextContent().length,f.__key!==v&&0!==a&&(a=n),a!==n&&([f]=f.splitText(a)),0===a&&"element"!==t||F(f,b)),a=1;a<e;a++)n=c[a],t=n.getKey(),k.$isTextNode(n)&& | ||
n.canHaveFormat()&&t!==d.getKey()&&t!==f.getKey()&&!n.isToken()&&F(n,b)}}}; | ||
exports.$selectAll=function(a){let b=a.anchor;a=a.focus;var c=b.getNode().getTopLevelElementOrThrow().getParentOrThrow();let e=c.getFirstDescendant();c=c.getLastDescendant();let d="element",g="element",h=0;k.$isTextNode(e)?d="text":k.$isElementNode(e)||null===e||(e=e.getParentOrThrow());k.$isTextNode(c)?(g="text",h=c.getTextContentSize()):k.$isElementNode(c)||null===c||(c=c.getParentOrThrow());e&&c&&(b.set(e.getKey(),0,d),a.set(c.getKey(),h,g))}; | ||
exports.$setBlocksType=function(a,b){if(null!==a){var c=a.getStartEndPoints();c=c?c[0]:null;if(null!==c&&"root"===c.key)b=b(),a=k.$getRoot(),(c=a.getFirstChild())?c.replace(b,!0):a.append(b);else{a=a.getNodes();if(null!==c){for(c=c.getNode();null!==c&&null!==c.getParent()&&!K(c);)c=c.getParentOrThrow();c=K(c)?c:null}else c=!1;c&&-1===a.indexOf(c)&&a.push(c);for(c=0;c<a.length;c++){let e=a[c];if(!K(e))continue;k.$isElementNode(e)||u(178);let d=b();d.setFormat(e.getFormatType());d.setIndent(e.getIndent()); | ||
e.replace(d,!0)}}}};exports.$shouldOverrideDefaultCharacterSelection=function(a,b){a=k.$getAdjacentNode(a.focus,b);return k.$isDecoratorNode(a)&&!a.isIsolated()||k.$isElementNode(a)&&!a.isInline()&&!a.canBeEmpty()}; | ||
exports.$sliceSelectedTextNodeContent=function(a,b){var c=a.getStartEndPoints();if(b.isSelected(a)&&!b.isSegmented()&&!b.isToken()&&null!==c){let [f,l]=c;c=a.isBackward();var e=f.getNode(),d=l.getNode(),g=b.is(e),h=b.is(d);if(g||h){let [m,p]=k.$getCharacterOffsets(a);a=e.is(d);g=b.is(c?d:e);d=b.is(c?e:d);e=0;h=void 0;a?(e=m>p?p:m,h=m>p?m:p):g?(e=c?p:m,h=void 0):d&&(c=c?m:p,e=0,h=c);b.__text=b.__text.slice(e,h)}}return b};exports.$trimTextContentFromAnchor=D; | ||
exports.$wrapNodes=function(a,b,c=null){var e=a.getStartEndPoints(),d=e?e[0]:null;e=a.getNodes();let g=e.length;if(null!==d&&(0===g||1===g&&"element"===d.type&&0===d.getNode().getChildrenSize())){a="text"===d.type?d.getNode().getParentOrThrow():d.getNode();e=a.getChildren();let f=b();f.setFormat(a.getFormatType());f.setIndent(a.getIndent());e.forEach(l=>f.append(l));c&&(f=c.append(f));a.replace(f)}else{d=null;var h=[];for(let f=0;f<g;f++){let l=e[f];k.$isRootOrShadowRoot(l)?(G(a,h,h.length,b,c),h= | ||
[],d=l):null===d||null!==d&&k.$hasAncestor(l,d)?h.push(l):(G(a,h,h.length,b,c),h=[l])}G(a,h,h.length,b,c)}}; | ||
exports.$sliceSelectedTextNodeContent=function(a,b){var c=a.getStartEndPoints();if(b.isSelected(a)&&!b.isSegmented()&&!b.isToken()&&null!==c){let [f,l]=c;c=a.isBackward();var e=f.getNode(),d=l.getNode(),g=b.is(e),h=b.is(d);if(g||h){let [m,p]=k.$getCharacterOffsets(a);a=e.is(d);g=b.is(c?d:e);d=b.is(c?e:d);e=0;h=void 0;a?(e=m>p?p:m,h=m>p?m:p):g?(e=c?p:m,h=void 0):d&&(c=c?m:p,e=0,h=c);b.__text=b.__text.slice(e,h)}}return b};exports.$trimTextContentFromAnchor=E; | ||
exports.$wrapNodes=function(a,b,c=null){var e=a.getStartEndPoints(),d=e?e[0]:null;e=a.getNodes();let g=e.length;if(null!==d&&(0===g||1===g&&"element"===d.type&&0===d.getNode().getChildrenSize())){a="text"===d.type?d.getNode().getParentOrThrow():d.getNode();e=a.getChildren();let f=b();f.setFormat(a.getFormatType());f.setIndent(a.getIndent());e.forEach(l=>f.append(l));c&&(f=c.append(f));a.replace(f)}else{d=null;var h=[];for(let f=0;f<g;f++){let l=e[f];k.$isRootOrShadowRoot(l)?(H(a,h,h.length,b,c),h= | ||
[],d=l):null===d||null!==d&&k.$hasAncestor(l,d)?h.push(l):(H(a,h,h.length,b,c),h=[l])}H(a,h,h.length,b,c)}}; | ||
exports.createDOMRange=function(a,b,c,e,d){let g=b.getKey(),h=e.getKey(),f=document.createRange(),l=a.getElementByKey(g);a=a.getElementByKey(h);k.$isTextNode(b)&&(l=y(l));k.$isTextNode(e)&&(a=y(a));if(void 0===b||void 0===e||null===l||null===a)return null;"BR"===l.nodeName&&([l,c]=z(l));"BR"===a.nodeName&&([a,d]=z(a));b=l.firstChild;l===a&&null!=b&&"BR"===b.nodeName&&0===c&&0===d&&(d=1);try{f.setStart(l,c),f.setEnd(a,d)}catch(m){return null}!f.collapsed||c===d&&g===h||(f.setStart(a,d),f.setEnd(l, | ||
c));return f};exports.createRectsFromDOMRange=function(a,b){var c=a.getRootElement();if(null===c)return[];a=c.getBoundingClientRect();c=getComputedStyle(c);c=parseFloat(c.paddingLeft)+parseFloat(c.paddingRight);b=Array.from(b.getClientRects());let e=b.length;b.sort((g,h)=>{let f=g.top-h.top;return 3>=Math.abs(f)?g.left-h.left:f});let d;for(let g=0;g<e;g++){let h=b[g],f=h.width+c===a.width;d&&d.top<=h.top&&d.top+d.height>h.top&&d.left+d.width>h.left||f?(b.splice(g--,1),e--):d=h}return b}; | ||
exports.getStyleObjectFromCSS=B;exports.trimTextContentFromAnchor=D | ||
exports.getStyleObjectFromCSS=C;exports.trimTextContentFromAnchor=E |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"main": "LexicalSelection.js", | ||
@@ -41,4 +41,4 @@ "types": "index.d.ts", | ||
"dependencies": { | ||
"lexical": "0.15.0" | ||
"lexical": "0.16.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115156
2287
+ Addedlexical@0.16.0(transitive)
- Removedlexical@0.15.0(transitive)
Updatedlexical@0.16.0