Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lexical/link

Package Overview
Dependencies
Maintainers
5
Versions
188
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.17.2-nightly.20240924.0 to 0.17.2-nightly.20240925.0

10

LexicalLink.dev.js

@@ -365,9 +365,9 @@ /**

nodes.forEach(node => {
const parent = node.getParent();
if (!$isAutoLinkNode(parent) && $isLinkNode(parent)) {
const children = parent.getChildren();
const parentLink = utils.$findMatchingParent(node, parent => !$isAutoLinkNode(parent) && $isLinkNode(parent));
if (parentLink) {
const children = parentLink.getChildren();
for (let i = 0; i < children.length; i++) {
parent.insertBefore(children[i]);
parentLink.insertBefore(children[i]);
}
parent.remove();
parentLink.remove();
}

@@ -374,0 +374,0 @@ });

@@ -10,12 +10,12 @@ /**

'use strict';var l=require("@lexical/utils"),m=require("lexical");let n=new Set(["http:","https:","mailto:","sms:","tel:"]);
class p extends m.ElementNode{static getType(){return"link"}static clone(a){return new p(a.__url,{rel:a.__rel,target:a.__target,title:a.__title},a.__key)}constructor(a,b={},d){super(d);let {target:h=null,rel:k=null,title:e=null}=b;this.__url=a;this.__target=h;this.__rel=k;this.__title=e}createDOM(a){let b=document.createElement("a");b.href=this.sanitizeUrl(this.__url);null!==this.__target&&(b.target=this.__target);null!==this.__rel&&(b.rel=this.__rel);null!==this.__title&&(b.title=this.__title);l.addClassNamesToElement(b,
a.theme.link);return b}updateDOM(a,b){if(b instanceof HTMLAnchorElement){let d=this.__url,h=this.__target,k=this.__rel,e=this.__title;d!==a.__url&&(b.href=d);h!==a.__target&&(h?b.target=h:b.removeAttribute("target"));k!==a.__rel&&(k?b.rel=k:b.removeAttribute("rel"));e!==a.__title&&(e?b.title=e:b.removeAttribute("title"))}return!1}static importDOM(){return{a:()=>({conversion:q,priority:1})}}static importJSON(a){let b=r(a.url,{rel:a.rel,target:a.target,title:a.title});b.setFormat(a.format);b.setIndent(a.indent);
class p extends m.ElementNode{static getType(){return"link"}static clone(a){return new p(a.__url,{rel:a.__rel,target:a.__target,title:a.__title},a.__key)}constructor(a,b={},d){super(d);let {target:h=null,rel:k=null,title:f=null}=b;this.__url=a;this.__target=h;this.__rel=k;this.__title=f}createDOM(a){let b=document.createElement("a");b.href=this.sanitizeUrl(this.__url);null!==this.__target&&(b.target=this.__target);null!==this.__rel&&(b.rel=this.__rel);null!==this.__title&&(b.title=this.__title);l.addClassNamesToElement(b,
a.theme.link);return b}updateDOM(a,b){if(b instanceof HTMLAnchorElement){let d=this.__url,h=this.__target,k=this.__rel,f=this.__title;d!==a.__url&&(b.href=d);h!==a.__target&&(h?b.target=h:b.removeAttribute("target"));k!==a.__rel&&(k?b.rel=k:b.removeAttribute("rel"));f!==a.__title&&(f?b.title=f:b.removeAttribute("title"))}return!1}static importDOM(){return{a:()=>({conversion:q,priority:1})}}static importJSON(a){let b=r(a.url,{rel:a.rel,target:a.target,title:a.title});b.setFormat(a.format);b.setIndent(a.indent);
b.setDirection(a.direction);return b}sanitizeUrl(a){try{let b=new URL(a);if(!n.has(b.protocol))return"about:blank"}catch(b){}return a}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),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}getTitle(){return this.getLatest().__title}setTitle(a){this.getWritable().__title=a}insertNewAfter(a,b=!0){a=r(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});this.insertAfter(a,b);return a}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 d=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(d)&&0<b.getTextContent().length}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||
this.__url.startsWith("http://")}}function q(a){let b=null;if(l.isHTMLAnchorElement(a)){let d=a.textContent;if(null!==d&&""!==d||0<a.children.length)b=r(a.getAttribute("href")||"",{rel:a.getAttribute("rel"),target:a.getAttribute("target"),title:a.getAttribute("title")})}return{node:b}}function r(a,b){return m.$applyNodeReplacement(new p(a,b))}function u(a){return a instanceof p}
this.__url.startsWith("http://")}}function q(a){let b=null;if(l.isHTMLAnchorElement(a)){let d=a.textContent;if(null!==d&&""!==d||0<a.children.length)b=r(a.getAttribute("href")||"",{rel:a.getAttribute("rel"),target:a.getAttribute("target"),title:a.getAttribute("title")})}return{node:b}}function r(a,b){return m.$applyNodeReplacement(new p(a,b))}function t(a){return a instanceof p}
class v extends p{constructor(a,b={},d){super(a,b,d);this.__isUnlinked=void 0!==b.isUnlinked&&null!==b.isUnlinked?b.isUnlinked:!1}static getType(){return"autolink"}static clone(a){return new v(a.__url,{isUnlinked:a.__isUnlinked,rel:a.__rel,target:a.__target,title:a.__title},a.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(a){let b=this.getWritable();b.__isUnlinked=a;return b}createDOM(a){return this.__isUnlinked?document.createElement("span"):super.createDOM(a)}updateDOM(a,b,d){return super.updateDOM(a,
b,d)||a.__isUnlinked!==this.__isUnlinked}static importJSON(a){let b=w(a.url,{isUnlinked:a.isUnlinked,rel:a.rel,target:a.target,title:a.title});b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(a,b=!0){a=this.getParentOrThrow().insertNewAfter(a,b);return m.$isElementNode(a)?(b=w(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,
target:this.__target,title:this.__title}),a.append(b),b):null}}function w(a,b){return m.$applyNodeReplacement(new v(a,b))}function x(a){return a instanceof v}let y=m.createCommand("TOGGLE_LINK_COMMAND");
function z(a,b={}){let {target:d,title:h}=b,k=void 0===b.rel?"noreferrer":b.rel;b=m.$getSelection();if(m.$isRangeSelection(b))if(b=b.extract(),null===a)b.forEach(e=>{e=e.getParent();if(!x(e)&&u(e)){let f=e.getChildren();for(let c=0;c<f.length;c++)e.insertBefore(f[c]);e.remove()}});else{if(1===b.length){let c=A(b[0],u);if(null!==c){c.setURL(a);void 0!==d&&c.setTarget(d);null!==k&&c.setRel(k);void 0!==h&&c.setTitle(h);return}}let e=null,f=null;b.forEach(c=>{var g=c.getParent();if(g!==f&&null!==g&&(!m.$isElementNode(c)||
c.isInline()))if(u(g))f=g,g.setURL(a),void 0!==d&&g.setTarget(d),null!==k&&f.setRel(k),void 0!==h&&f.setTitle(h);else if(g.is(e)||(e=g,f=r(a,{rel:k,target:d,title:h}),u(g)?null===c.getPreviousSibling()?g.insertBefore(f):g.insertAfter(f):c.insertBefore(f)),u(c)){if(!c.is(f)){if(null!==f){g=c.getChildren();for(let t=0;t<g.length;t++)f.append(g[t])}c.remove()}}else null!==f&&f.append(c)})}}function A(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}
exports.$createAutoLinkNode=w;exports.$createLinkNode=r;exports.$isAutoLinkNode=x;exports.$isLinkNode=u;exports.$toggleLink=z;exports.AutoLinkNode=v;exports.LinkNode=p;exports.TOGGLE_LINK_COMMAND=y;exports.toggleLink=z
function z(a,b={}){let {target:d,title:h}=b,k=void 0===b.rel?"noreferrer":b.rel;b=m.$getSelection();if(m.$isRangeSelection(b))if(b=b.extract(),null===a)b.forEach(f=>{if(f=l.$findMatchingParent(f,e=>!x(e)&&t(e))){let e=f.getChildren();for(let c=0;c<e.length;c++)f.insertBefore(e[c]);f.remove()}});else{if(1===b.length){let c=A(b[0],t);if(null!==c){c.setURL(a);void 0!==d&&c.setTarget(d);null!==k&&c.setRel(k);void 0!==h&&c.setTitle(h);return}}let f=null,e=null;b.forEach(c=>{var g=c.getParent();if(g!==
e&&null!==g&&(!m.$isElementNode(c)||c.isInline()))if(t(g))e=g,g.setURL(a),void 0!==d&&g.setTarget(d),null!==k&&e.setRel(k),void 0!==h&&e.setTitle(h);else if(g.is(f)||(f=g,e=r(a,{rel:k,target:d,title:h}),t(g)?null===c.getPreviousSibling()?g.insertBefore(e):g.insertAfter(e):c.insertBefore(e)),t(c)){if(!c.is(e)){if(null!==e){g=c.getChildren();for(let u=0;u<g.length;u++)e.append(g[u])}c.remove()}}else null!==e&&e.append(c)})}}
function A(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}exports.$createAutoLinkNode=w;exports.$createLinkNode=r;exports.$isAutoLinkNode=x;exports.$isLinkNode=t;exports.$toggleLink=z;exports.AutoLinkNode=v;exports.LinkNode=p;exports.TOGGLE_LINK_COMMAND=y;exports.toggleLink=z

@@ -11,8 +11,8 @@ {

"license": "MIT",
"version": "0.17.2-nightly.20240924.0",
"version": "0.17.2-nightly.20240925.0",
"main": "LexicalLink.js",
"types": "index.d.ts",
"dependencies": {
"@lexical/utils": "0.17.2-nightly.20240924.0",
"lexical": "0.17.2-nightly.20240924.0"
"@lexical/utils": "0.17.2-nightly.20240925.0",
"lexical": "0.17.2-nightly.20240925.0"
},

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

Sorry, the diff of this file is not supported yet

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