Socket
Socket
Sign inDemoInstall

@lexical/link

Package Overview
Dependencies
Maintainers
6
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/link - npm Package Compare versions

Comparing version 0.6.5 to 0.7.0

4

index.d.ts

@@ -42,3 +42,3 @@ /** @module @lexical/link */

setRel(rel: null | string): void;
insertNewAfter(selection: RangeSelection): null | ElementNode;
insertNewAfter(selection: RangeSelection, restoreSelection?: boolean): null | ElementNode;
canInsertTextBefore(): false;

@@ -62,3 +62,3 @@ canInsertTextAfter(): false;

exportJSON(): SerializedAutoLinkNode;
insertNewAfter(selection: RangeSelection): null | ElementNode;
insertNewAfter(selection: RangeSelection, restoreSelection?: boolean): null | ElementNode;
}

@@ -65,0 +65,0 @@ export declare function $createAutoLinkNode(url: string, attributes?: LinkAttributes): AutoLinkNode;

@@ -144,4 +144,4 @@ /**

insertNewAfter(selection) {
const element = this.getParentOrThrow().insertNewAfter(selection);
insertNewAfter(selection, restoreSelection = true) {
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection);

@@ -250,4 +250,4 @@ if (lexical.$isElementNode(element)) {

insertNewAfter(selection) {
const element = this.getParentOrThrow().insertNewAfter(selection);
insertNewAfter(selection, restoreSelection = true) {
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection);

@@ -254,0 +254,0 @@ if (lexical.$isElementNode(element)) {

@@ -10,7 +10,7 @@ /**

c!==a.__url&&(b.href=c);h!==a.__target&&(h?b.target=h:b.removeAttribute("target"));e!==a.__rel&&(e?b.rel=e:b.removeAttribute("rel"));return!1}static importDOM(){return{a:()=>({conversion:p,priority:1})}}static importJSON(a){let b=q(a.url,{rel:a.rel,target:a.target});b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(a){this.getWritable().__url=
a}getTarget(){return this.getLatest().__target}setTarget(a){this.getWritable().__target=a}getRel(){return this.getLatest().__rel}setRel(a){this.getWritable().__rel=a}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);if(m.$isElementNode(a)){let b=q(this.__url,{rel:this.__rel,target:this.__target});a.append(b);return b}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(a,b){if(!m.$isRangeSelection(b))return!1;
a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&0<b.getTextContent().length}}function p(a){let b=null;if(a instanceof HTMLAnchorElement){let c=a.textContent;null!==c&&""!==c&&(b=q(a.getAttribute("href")||"",{rel:a.getAttribute("rel"),target:a.getAttribute("target")}))}return{node:b}}function q(a,b){return new n(a,b)}function r(a){return a instanceof n}
class u extends n{static getType(){return"autolink"}static clone(a){return new u(a.__url,{rel:a.__rel,target:a.__target},a.__key)}static importJSON(a){let b=v(a.url,{rel:a.rel,target:a.target});b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);if(m.$isElementNode(a)){let b=v(this.__url,{rel:this._rel,target:this.__target});
a.append(b);return b}return null}}function v(a,b){return new u(a,b)}let w=m.createCommand("TOGGLE_LINK_COMMAND");function x(a){return y(a,b=>r(b))}function y(a,b){for(;null!==a&&null!==(a=a.getParent())&&!b(a););return a}exports.$createAutoLinkNode=v;exports.$createLinkNode=q;exports.$isAutoLinkNode=function(a){return a instanceof u};exports.$isLinkNode=r;exports.AutoLinkNode=u;exports.LinkNode=n;exports.TOGGLE_LINK_COMMAND=w;
a}getTarget(){return this.getLatest().__target}setTarget(a){this.getWritable().__target=a}getRel(){return this.getLatest().__rel}setRel(a){this.getWritable().__rel=a}insertNewAfter(a,b=!0){a=this.getParentOrThrow().insertNewAfter(a,b);return m.$isElementNode(a)?(b=q(this.__url,{rel:this.__rel,target:this.__target}),a.append(b),b):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(a,b){if(!m.$isRangeSelection(b))return!1;a=b.anchor.getNode();
let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&0<b.getTextContent().length}}function p(a){let b=null;if(a instanceof HTMLAnchorElement){let c=a.textContent;null!==c&&""!==c&&(b=q(a.getAttribute("href")||"",{rel:a.getAttribute("rel"),target:a.getAttribute("target")}))}return{node:b}}function q(a,b){return new n(a,b)}function r(a){return a instanceof n}
class u extends n{static getType(){return"autolink"}static clone(a){return new u(a.__url,{rel:a.__rel,target:a.__target},a.__key)}static importJSON(a){let b=v(a.url,{rel:a.rel,target:a.target});b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(a,b=!0){a=this.getParentOrThrow().insertNewAfter(a,b);return m.$isElementNode(a)?(b=v(this.__url,{rel:this._rel,
target:this.__target}),a.append(b),b):null}}function v(a,b){return new u(a,b)}let w=m.createCommand("TOGGLE_LINK_COMMAND");function x(a){return y(a,b=>r(b))}function y(a,b){for(;null!==a&&null!==(a=a.getParent())&&!b(a););return a}exports.$createAutoLinkNode=v;exports.$createLinkNode=q;exports.$isAutoLinkNode=function(a){return a instanceof u};exports.$isLinkNode=r;exports.AutoLinkNode=u;exports.LinkNode=n;exports.TOGGLE_LINK_COMMAND=w;
exports.toggleLink=function(a,b={}){let {target:c}=b,h=void 0===b.rel?"noopener":b.rel;b=m.$getSelection();if(m.$isRangeSelection(b))if(b=b.extract(),null===a)b.forEach(k=>{k=k.getParent();if(r(k)){let d=k.getChildren();for(let f=0;f<d.length;f++)k.insertBefore(d[f]);k.remove()}});else{if(1===b.length){var e=b[0];e=r(e)?e:x(e);if(null!==e){e.setURL(a);void 0!==c&&e.setTarget(c);null!==h&&e.setRel(h);return}}let k=null,d=null;b.forEach(f=>{var g=f.getParent();if(g!==d&&null!==g&&(!m.$isElementNode(f)||
f.isInline()))if(r(g))d=g,g.setURL(a),void 0!==c&&g.setTarget(c),null!==h&&d.setRel(h);else if(g.is(k)||(k=g,d=q(a,{rel:h,target:c}),r(g)?null===f.getPreviousSibling()?g.insertBefore(d):g.insertAfter(d):f.insertBefore(d)),r(f)){if(!f.is(d)){if(null!==d){g=f.getChildren();for(let t=0;t<g.length;t++)d.append(g[t])}f.remove()}}else null!==d&&d.append(f)})}}

@@ -11,9 +11,9 @@ {

"license": "MIT",
"version": "0.6.5",
"version": "0.7.0",
"main": "LexicalLink.js",
"peerDependencies": {
"lexical": "0.6.5"
"lexical": "0.7.0"
},
"dependencies": {
"@lexical/utils": "0.6.5"
"@lexical/utils": "0.7.0"
},

@@ -20,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc