@lexical/rich-text
Advanced tools
Comparing version 0.21.1-nightly.20241223.0 to 0.22.0
@@ -25,3 +25,2 @@ /** | ||
static importJSON(serializedNode: SerializedQuoteNode): QuoteNode; | ||
exportJSON(): SerializedElementNode; | ||
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode; | ||
@@ -28,0 +27,0 @@ collapseAtStart(): true; |
@@ -144,8 +144,2 @@ /** | ||
} | ||
exportJSON() { | ||
return { | ||
...super.exportJSON(), | ||
type: 'quote' | ||
}; | ||
} | ||
@@ -296,5 +290,3 @@ // Mutation | ||
...super.exportJSON(), | ||
tag: this.getTag(), | ||
type: 'heading', | ||
version: 1 | ||
tag: this.getTag() | ||
}; | ||
@@ -301,0 +293,0 @@ } |
@@ -13,8 +13,7 @@ /** | ||
class y extends k.ElementNode{static getType(){return"quote"}static clone(b){return new y(b.__key)}constructor(b){super(b)}createDOM(b){let a=document.createElement("blockquote");h.addClassNamesToElement(a,b.theme.quote);return a}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:z,priority:0})}}exportDOM(b){({element:b}=super.exportDOM(b));if(h.isHTMLElement(b)){this.isEmpty()&&b.append(document.createElement("br"));var a=this.getFormatType();b.style.textAlign=a;if(a=this.getDirection())b.dir= | ||
a}return{element:b}}static importJSON(b){let a=A();a.setFormat(b.format);a.setIndent(b.indent);a.setDirection(b.direction);return a}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(b,a){b=k.$createParagraphNode();let d=this.getDirection();b.setDirection(d);this.insertAfter(b,a);return b}collapseAtStart(){let b=k.$createParagraphNode();this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}canMergeWhenEmpty(){return!0}} | ||
function A(){return k.$applyNodeReplacement(new y)} | ||
a}return{element:b}}static importJSON(b){let a=A();a.setFormat(b.format);a.setIndent(b.indent);a.setDirection(b.direction);return a}insertNewAfter(b,a){b=k.$createParagraphNode();let d=this.getDirection();b.setDirection(d);this.insertAfter(b,a);return b}collapseAtStart(){let b=k.$createParagraphNode();this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}canMergeWhenEmpty(){return!0}}function A(){return k.$applyNodeReplacement(new y)} | ||
class B extends k.ElementNode{static getType(){return"heading"}static clone(b){return new B(b.__tag,b.__key)}constructor(b,a){super(a);this.__tag=b}getTag(){return this.__tag}createDOM(b){let a=this.__tag,d=document.createElement(a);b=b.theme.heading;void 0!==b&&h.addClassNamesToElement(d,b[a]);return d}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:C,priority:0}),h2:()=>({conversion:C,priority:0}),h3:()=>({conversion:C,priority:0}),h4:()=>({conversion:C,priority:0}),h5:()=>({conversion:C, | ||
priority:0}),h6:()=>({conversion:C,priority:0}),p:b=>{b=b.firstChild;return null!==b&&E(b)?{conversion:()=>({node:null}),priority:3}:null},span:b=>E(b)?{conversion:()=>({node:F("h1")}),priority:3}:null}}exportDOM(b){({element:b}=super.exportDOM(b));if(h.isHTMLElement(b)){this.isEmpty()&&b.append(document.createElement("br"));var a=this.getFormatType();b.style.textAlign=a;if(a=this.getDirection())b.dir=a}return{element:b}}static importJSON(b){let a=F(b.tag);a.setFormat(b.format);a.setIndent(b.indent); | ||
a.setDirection(b.direction);return a}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(b,a=!0){let d=b?b.anchor.offset:0;var e=this.getLastDescendant();e=!e||b&&b.anchor.key===e.getKey()&&d===e.getTextContentSize()||!b?k.$createParagraphNode():F(this.getTag());let f=this.getDirection();e.setDirection(f);this.insertAfter(e,a);0===d&&!this.isEmpty()&&b&&(b=k.$createParagraphNode(),b.select(),this.replace(b,!0));return e}collapseAtStart(){let b=this.isEmpty()? | ||
k.$createParagraphNode():F(this.getTag());this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}extractWithChild(){return!0}}function E(b){return"span"===b.nodeName.toLowerCase()?"26pt"===b.style.fontSize:!1}function C(b){let a=b.nodeName.toLowerCase(),d=null;if("h1"===a||"h2"===a||"h3"===a||"h4"===a||"h5"===a||"h6"===a)d=F(a),null!==b.style&&(k.setNodeIndentFromDOM(b,d),d.setFormat(b.style.textAlign));return{node:d}} | ||
a.setDirection(b.direction);return a}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(b,a=!0){let d=b?b.anchor.offset:0;var e=this.getLastDescendant();e=!e||b&&b.anchor.key===e.getKey()&&d===e.getTextContentSize()||!b?k.$createParagraphNode():F(this.getTag());let f=this.getDirection();e.setDirection(f);this.insertAfter(e,a);0===d&&!this.isEmpty()&&b&&(b=k.$createParagraphNode(),b.select(),this.replace(b,!0));return e}collapseAtStart(){let b=this.isEmpty()?k.$createParagraphNode(): | ||
F(this.getTag());this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}extractWithChild(){return!0}}function E(b){return"span"===b.nodeName.toLowerCase()?"26pt"===b.style.fontSize:!1}function C(b){let a=b.nodeName.toLowerCase(),d=null;if("h1"===a||"h2"===a||"h3"===a||"h4"===a||"h5"===a||"h6"===a)d=F(a),null!==b.style&&(k.setNodeIndentFromDOM(b,d),d.setFormat(b.style.textAlign));return{node:d}} | ||
function z(b){let a=A();null!==b.style&&(a.setFormat(b.style.textAlign),k.setNodeIndentFromDOM(b,a));return{node:a}}function F(b){return k.$applyNodeReplacement(new B(b))}function G(b,a){b.preventDefault();a.update(()=>{let d=k.$getSelection(),e=h.objectKlassEquals(b,InputEvent)||h.objectKlassEquals(b,KeyboardEvent)?null:b.clipboardData;null!=e&&null!==d&&c.$insertDataTransferForRichText(e,d,a)},{tag:"paste"})} | ||
@@ -21,0 +20,0 @@ async function H(b,a){await c.copyToClipboard(a,h.objectKlassEquals(b,ClipboardEvent)?b:null);a.update(()=>{let d=k.$getSelection();k.$isRangeSelection(d)?d.removeText():k.$isNodeSelection(d)&&d.getNodes().forEach(e=>e.remove())})} |
@@ -10,3 +10,3 @@ { | ||
"license": "MIT", | ||
"version": "0.21.1-nightly.20241223.0", | ||
"version": "0.22.0", | ||
"main": "LexicalRichText.js", | ||
@@ -39,7 +39,7 @@ "types": "index.d.ts", | ||
"dependencies": { | ||
"@lexical/clipboard": "0.21.1-nightly.20241223.0", | ||
"@lexical/selection": "0.21.1-nightly.20241223.0", | ||
"@lexical/utils": "0.21.1-nightly.20241223.0", | ||
"lexical": "0.21.1-nightly.20241223.0" | ||
"@lexical/clipboard": "0.22.0", | ||
"@lexical/selection": "0.22.0", | ||
"@lexical/utils": "0.22.0", | ||
"lexical": "0.22.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
88938
1786
+ Added@lexical/clipboard@0.22.0(transitive)
+ Added@lexical/html@0.22.0(transitive)
+ Added@lexical/list@0.22.0(transitive)
+ Added@lexical/selection@0.22.0(transitive)
+ Added@lexical/table@0.22.0(transitive)
+ Added@lexical/utils@0.22.0(transitive)
+ Addedlexical@0.22.0(transitive)
- Removed@lexical/clipboard@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/html@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/list@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/selection@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/table@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/utils@0.21.1-nightly.20241223.0(transitive)
- Removedlexical@0.21.1-nightly.20241223.0(transitive)
Updated@lexical/clipboard@0.22.0
Updated@lexical/selection@0.22.0
Updated@lexical/utils@0.22.0
Updatedlexical@0.22.0