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
193
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.14.5 to 0.15.0

4

index.d.ts

@@ -97,2 +97,4 @@ /**

*/
export declare function toggleLink(url: null | string, attributes?: LinkAttributes): void;
export declare function $toggleLink(url: null | string, attributes?: LinkAttributes): void;
/** @deprecated renamed to {@link $toggleLink} by @lexical/eslint-plugin rules-of-lexical */
export declare const toggleLink: typeof $toggleLink;

@@ -6,3 +6,5 @@ /**

* LICENSE file in the root directory of this source tree.
*
*/
'use strict';

@@ -20,2 +22,3 @@

*/
const SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:']);

@@ -104,3 +107,3 @@

a: node => ({
conversion: convertAnchorElement,
conversion: $convertAnchorElement,
priority: 1

@@ -202,3 +205,3 @@ })

}
function convertAnchorElement(domNode) {
function $convertAnchorElement(domNode) {
let node = null;

@@ -315,3 +318,3 @@ if (utils.isHTMLAnchorElement(domNode)) {

*/
function toggleLink(url, attributes = {}) {
function $toggleLink(url, attributes = {}) {
const {

@@ -417,2 +420,4 @@ target,

}
/** @deprecated renamed to {@link $toggleLink} by @lexical/eslint-plugin rules-of-lexical */
const toggleLink = $toggleLink;
function $getAncestor(node, predicate) {

@@ -430,2 +435,3 @@ let parent = node;

exports.$isLinkNode = $isLinkNode;
exports.$toggleLink = $toggleLink;
exports.AutoLinkNode = AutoLinkNode;

@@ -432,0 +438,0 @@ exports.LinkNode = LinkNode;

@@ -6,5 +6,7 @@ /**

* LICENSE file in the root directory of this source tree.
*
*/
'use strict'
const LexicalLink = process.env.NODE_ENV === 'development' ? require('./LexicalLink.dev.js') : require('./LexicalLink.prod.js');
module.exports = LexicalLink;

@@ -6,3 +6,5 @@ /**

* LICENSE file in the root directory of this source tree.
*
*/
'use strict';var l=require("@lexical/utils"),m=require("lexical");let n=new Set(["http:","https:","mailto:","sms:","tel:"]);

@@ -15,5 +17,5 @@ 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={},e){super(e);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,

class v extends p{static getType(){return"autolink"}static clone(a){return new v(a.__url,{rel:a.__rel,target:a.__target,title:a.__title},a.__key)}static importJSON(a){let b=w(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}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=w(this.__url,{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))}let x=m.createCommand("TOGGLE_LINK_COMMAND");function y(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=function(a){return a instanceof v};exports.$isLinkNode=u;exports.AutoLinkNode=v;exports.LinkNode=p;
exports.TOGGLE_LINK_COMMAND=x;
exports.toggleLink=function(a,b={}){let {target:e,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=>{f=f.getParent();if(u(f)){let d=f.getChildren();for(let c=0;c<d.length;c++)f.insertBefore(d[c]);f.remove()}});else{if(1===b.length){let c=y(b[0],u);if(null!==c){c.setURL(a);void 0!==e&&c.setTarget(e);null!==k&&c.setRel(k);void 0!==h&&c.setTitle(h);return}}let f=null,d=null;b.forEach(c=>{var g=c.getParent();if(g!==d&&null!==
g&&(!m.$isElementNode(c)||c.isInline()))if(u(g))d=g,g.setURL(a),void 0!==e&&g.setTarget(e),null!==k&&d.setRel(k),void 0!==h&&d.setTitle(h);else if(g.is(f)||(f=g,d=r(a,{rel:k,target:e,title:h}),u(g)?null===c.getPreviousSibling()?g.insertBefore(d):g.insertAfter(d):c.insertBefore(d)),u(c)){if(!c.is(d)){if(null!==d){g=c.getChildren();for(let t=0;t<g.length;t++)d.append(g[t])}c.remove()}}else null!==d&&d.append(c)})}}
(b=w(this.__url,{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))}let x=m.createCommand("TOGGLE_LINK_COMMAND");
function y(a,b={}){let {target:e,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=>{f=f.getParent();if(u(f)){let d=f.getChildren();for(let c=0;c<d.length;c++)f.insertBefore(d[c]);f.remove()}});else{if(1===b.length){let c=z(b[0],u);if(null!==c){c.setURL(a);void 0!==e&&c.setTarget(e);null!==k&&c.setRel(k);void 0!==h&&c.setTitle(h);return}}let f=null,d=null;b.forEach(c=>{var g=c.getParent();if(g!==d&&null!==g&&(!m.$isElementNode(c)||
c.isInline()))if(u(g))d=g,g.setURL(a),void 0!==e&&g.setTarget(e),null!==k&&d.setRel(k),void 0!==h&&d.setTitle(h);else if(g.is(f)||(f=g,d=r(a,{rel:k,target:e,title:h}),u(g)?null===c.getPreviousSibling()?g.insertBefore(d):g.insertAfter(d):c.insertBefore(d)),u(c)){if(!c.is(d)){if(null!==d){g=c.getChildren();for(let t=0;t<g.length;t++)d.append(g[t])}c.remove()}}else null!==d&&d.append(c)})}}function z(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=function(a){return a instanceof v};exports.$isLinkNode=u;exports.$toggleLink=y;exports.AutoLinkNode=v;exports.LinkNode=p;exports.TOGGLE_LINK_COMMAND=x;exports.toggleLink=y

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

"license": "MIT",
"version": "0.14.5",
"version": "0.15.0",
"main": "LexicalLink.js",
"types": "index.d.ts",
"dependencies": {
"@lexical/utils": "0.14.5",
"lexical": "0.14.5"
"@lexical/utils": "0.15.0",
"lexical": "0.15.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

Sorry, the diff of this file is not supported yet

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