@lexical/selection
Advanced tools
Comparing version 0.17.1-nightly.20240812.0 to 0.17.1-nightly.20240813.0
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import { BaseSelection, LexicalEditor, LexicalNode, Point, TextNode } from 'lexical'; | ||
import { BaseSelection, LexicalEditor, LexicalNode, Point, RangeSelection, TextNode } from 'lexical'; | ||
/** | ||
@@ -45,2 +45,2 @@ * Generally used to append text content to HTML and JSON. Grabs the text content and "slices" | ||
*/ | ||
export declare function $patchStyleText(selection: BaseSelection, patch: Record<string, string | null | ((currentStyleValue: string | null) => string)>): void; | ||
export declare function $patchStyleText(selection: BaseSelection, patch: Record<string, string | null | ((currentStyleValue: string | null, target: TextNode | RangeSelection) => string)>): void; |
@@ -383,4 +383,4 @@ /** | ||
const newStyles = Object.entries(patch).reduce((styles, [key, value]) => { | ||
if (value instanceof Function) { | ||
styles[key] = value(prevStyles[key]); | ||
if (typeof value === 'function') { | ||
styles[key] = value(prevStyles[key], target); | ||
} else if (value === null) { | ||
@@ -387,0 +387,0 @@ delete styles[key]; |
@@ -13,3 +13,3 @@ /** | ||
if(!k.$isTextNode(e)||b>=c)f=e.getParent(),e.remove(),null==f||0!==f.getChildrenSize()||k.$isRootNode(f)||f.remove(),b-=c+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=c-b;let m=f.slice(0,g);null!==h&&h!==f?(b=k.$getPreviousSelection(),c=e,e.isSimpleText()?e.setTextContent(h):(c=k.$createTextNode(h),e.replace(c)),k.$isRangeSelection(b)&&b.isCollapsed()&&(b=b.anchor.offset,c.select(b,b))): | ||
e.isSimpleText()?(h=d.key===l,f=d.offset,f<b&&(f=c),b=h?f-b:0,c=h?f:g,h&&0===b?([b]=e.splitText(b,c),b.remove()):([,b]=e.splitText(b,c),b.remove())):(b=k.$createTextNode(m),e.replace(b));b=0}}}function F(a,d){let b=C("getStyle"in a?a.getStyle():a.style);d=Object.entries(d).reduce((c,[g,h])=>{h instanceof Function?c[g]=h(b[g]):null===h?delete c[g]:c[g]=h;return c},{...b});let e=D(d);a.setStyle(e);x.set(e,d)} | ||
e.isSimpleText()?(h=d.key===l,f=d.offset,f<b&&(f=c),b=h?f-b:0,c=h?f:g,h&&0===b?([b]=e.splitText(b,c),b.remove()):([,b]=e.splitText(b,c),b.remove())):(b=k.$createTextNode(m),e.replace(b));b=0}}}function F(a,d){let b=C("getStyle"in a?a.getStyle():a.style);d=Object.entries(d).reduce((c,[g,h])=>{"function"===typeof h?c[g]=h(b[g],a):null===h?delete c[g]:c[g]=h;return c},{...b});let e=D(d);a.setStyle(e);x.set(e,d)} | ||
function G(a){for(;null!==a&&!k.$isRootOrShadowRoot(a);){let d=a.getLatest(),b=a.getParent();0===d.getChildrenSize()&&a.remove(!0);a=b}} | ||
@@ -16,0 +16,0 @@ function H(a,d,b,e,c=null){if(0!==d.length){var g=d[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<b;p++){var q=d[p];k.$isElementNode(q)&&0===q.getChildrenSize()&&m.add(q.getKey())}var n=new Set;for(p=0;p<b;p++){q=d[p];var r=q.getParent();null!==r&&r.isInline()&&(r=r.getParent());if(null!== |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "0.17.1-nightly.20240812.0", | ||
"version": "0.17.1-nightly.20240813.0", | ||
"main": "LexicalSelection.js", | ||
@@ -41,4 +41,4 @@ "types": "index.d.ts", | ||
"dependencies": { | ||
"lexical": "0.17.1-nightly.20240812.0" | ||
"lexical": "0.17.1-nightly.20240813.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
111981
+ Addedlexical@0.17.1-nightly.20240813.0(transitive)
- Removedlexical@0.17.1-nightly.20240812.0(transitive)