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

@lexical/code

Package Overview
Dependencies
Maintainers
3
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/code - npm Package Compare versions

Comparing version 0.1.20 to 0.1.21

118

LexicalCode.dev.js

@@ -94,2 +94,3 @@ /**

}
const LANGUAGE_DATA_ATTRIBUTE = 'data-highlight-language';
class CodeNode extends lexical.ElementNode {

@@ -114,2 +115,8 @@ static getType() {

element.setAttribute('spellcheck', 'false');
const language = this.getLanguage();
if (language) {
element.setAttribute(LANGUAGE_DATA_ATTRIBUTE, language);
}
return element;

@@ -119,6 +126,17 @@ }

updateDOM(prevNode, dom) {
const language = this.__language;
const prevLanguage = prevNode.__language;
if (language) {
if (language !== prevLanguage) {
dom.setAttribute(LANGUAGE_DATA_ATTRIBUTE, language);
}
} else if (prevLanguage) {
dom.removeAttribute(LANGUAGE_DATA_ATTRIBUTE);
}
return false;
}
static convertDOM() {
static importDOM() {
return {

@@ -364,3 +382,3 @@ div: node => ({

if ($isCodeNode(parentNode)) {
codeNodeTransform(parentNode, editor);
codeNodeTransform(parentNode);
} else if ($isCodeHighlightNode(node)) {

@@ -371,48 +389,56 @@ // When code block converted into paragraph or other element

}
} // Using `skipTransforms` to prevent extra transforms since reformatting the code
// will not affect code block content itself.
//
// Using extra flag (`isHighlighting`) since both CodeNode and CodeHighlightNode
// trasnforms might be called at the same time (e.g. new CodeHighlight node inserted) and
// in both cases we'll rerun whole reformatting over CodeNode, which is redundant.
// Especially when pasting code into CodeBlock.
}
function updateCodeGutter(node, editor) {
const codeElement = editor.getElementByKey(node.getKey());
let isHighlighting = false;
function codeNodeTransform(node, editor) {
if (isHighlighting) {
if (codeElement === null) {
return;
}
isHighlighting = true;
editor.update(() => {
// When new code block inserted it might not have language selected
if (node.getLanguage() === undefined) {
node.setLanguage(DEFAULT_CODE_LANGUAGE);
const children = node.getChildren();
const childrenLength = children.length; // $FlowFixMe: internal field
if (childrenLength === codeElement.__cachedChildrenLength) {
// Avoid updating the attribute if the children length hasn't changed.
return;
} // $FlowFixMe: internal field
codeElement.__cachedChildrenLength = childrenLength;
let gutter = '1';
let count = 1;
for (let i = 0; i < childrenLength; i++) {
if (lexical.$isLineBreakNode(children[i])) {
gutter += '\n' + ++count;
}
}
updateAndRetainSelection(node, () => {
const code = node.getTextContent();
const tokens = Prism.tokenize(code, Prism.languages[node.getLanguage() || ''] || Prism.languages[DEFAULT_CODE_LANGUAGE]);
const highlightNodes = getHighlightNodes(tokens);
const diffRange = getDiffRange(node.getChildren(), highlightNodes);
const {
from,
to,
nodesForReplacement
} = diffRange;
codeElement.setAttribute('data-gutter', gutter);
}
if (from !== to || nodesForReplacement.length) {
node.splice(from, to - from, nodesForReplacement);
return true;
}
function codeNodeTransform(node, editor) {
// When new code block inserted it might not have language selected
if (node.getLanguage() === undefined) {
node.setLanguage(DEFAULT_CODE_LANGUAGE);
}
return false;
});
}, {
onUpdate: () => {
isHighlighting = false;
},
skipTransforms: true
updateAndRetainSelection(node, () => {
const code = node.getTextContent();
const tokens = Prism.tokenize(code, Prism.languages[node.getLanguage() || ''] || Prism.languages[DEFAULT_CODE_LANGUAGE]);
const highlightNodes = getHighlightNodes(tokens);
const diffRange = getDiffRange(node.getChildren(), highlightNodes);
const {
from,
to,
nodesForReplacement
} = diffRange;
if (from !== to || nodesForReplacement.length) {
node.splice(from, to - from, nodesForReplacement);
return true;
}
return false;
});

@@ -707,3 +733,15 @@ }

return utils.mergeRegister(editor.registerNodeTransform(CodeNode, node => codeNodeTransform(node, editor)), editor.registerNodeTransform(lexical.TextNode, node => textNodeTransform(node, editor)), editor.registerNodeTransform(CodeHighlightNode, node => textNodeTransform(node, editor)), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, payload => handleMultilineIndent(lexical.INDENT_CONTENT_COMMAND), 1), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, payload => handleMultilineIndent(lexical.OUTDENT_CONTENT_COMMAND), 1), editor.registerCommand(lexical.KEY_ARROW_UP_COMMAND, payload => handleShiftLines(lexical.KEY_ARROW_UP_COMMAND, payload), 1), editor.registerCommand(lexical.KEY_ARROW_DOWN_COMMAND, payload => handleShiftLines(lexical.KEY_ARROW_DOWN_COMMAND, payload), 1));
return utils.mergeRegister(editor.registerMutationListener(CodeNode, mutations => {
editor.update(() => {
for (const [key, type] of mutations) {
if (type !== 'destroyed') {
const node = lexical.$getNodeByKey(key);
if (node !== null) {
updateCodeGutter(node, editor);
}
}
}
});
}), editor.registerNodeTransform(CodeNode, node => codeNodeTransform(node)), editor.registerNodeTransform(lexical.TextNode, node => textNodeTransform(node)), editor.registerNodeTransform(CodeHighlightNode, node => textNodeTransform(node)), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, payload => handleMultilineIndent(lexical.INDENT_CONTENT_COMMAND), 1), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, payload => handleMultilineIndent(lexical.OUTDENT_CONTENT_COMMAND), 1), editor.registerCommand(lexical.KEY_ARROW_UP_COMMAND, payload => handleShiftLines(lexical.KEY_ARROW_UP_COMMAND, payload), 1), editor.registerCommand(lexical.KEY_ARROW_DOWN_COMMAND, payload => handleShiftLines(lexical.KEY_ARROW_DOWN_COMMAND, payload), 1));
}

@@ -710,0 +748,0 @@

@@ -8,19 +8,20 @@ /**

var e=require("prismjs/components/prism-core");require("prismjs/components/prism-clike");require("prismjs/components/prism-javascript");require("prismjs/components/prism-markup");require("prismjs/components/prism-markdown");require("prismjs/components/prism-c");require("prismjs/components/prism-css");require("prismjs/components/prism-objectivec");require("prismjs/components/prism-sql");require("prismjs/components/prism-python");require("prismjs/components/prism-rust");require("prismjs/components/prism-swift");
var l=require("@lexical/utils"),t=require("lexical");
class u extends t.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new u(a.__text,a.__highlightType||void 0,a.__key)}createDOM(a){const b=super.createDOM(a);a=v(a.theme,this.__highlightType);l.addClassNamesToElement(b,a);return b}updateDOM(a,b,c){const d=super.updateDOM(a,b,c);a=v(c.theme,a.__highlightType);c=v(c.theme,this.__highlightType);a!==c&&(a&&l.removeClassNamesFromElement(b,a),c&&l.addClassNamesToElement(b,c));return d}setFormat(){return this.getWritable()}}
function v(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}function x(a,b){return new u(a,b)}function y(a){return a instanceof u}
class z extends t.ElementNode{static getType(){return"code"}static clone(a){return new z(a.__language,a.__key)}constructor(a,b){super(b);this.__language=a}createDOM(a){const b=document.createElement("code");l.addClassNamesToElement(b,a.theme.code);b.setAttribute("spellcheck","false");return b}updateDOM(){return!1}static convertDOM(){return{div:()=>({conversion:A,priority:1}),pre:()=>({conversion:B,priority:0}),table:a=>C(a)?{conversion:D,priority:4}:null,td:a=>{const b=a.closest("table");return a.classList.contains("js-file-line")?
{conversion:E,priority:4}:b&&C(b)?{conversion:F,priority:4}:null},tr:a=>(a=a.closest("table"))&&C(a)?{conversion:F,priority:4}:null}}insertNewAfter(a){var b=this.getChildren(),c=b.length;if(2<=c&&"\n"===b[c-1].getTextContent()&&"\n"===b[c-2].getTextContent()&&a.isCollapsed()&&a.anchor.key===this.__key&&a.anchor.offset===c)return b[c-1].remove(),b[c-2].remove(),a=t.$createParagraphNode(),this.insertAfter(a),a;b=a.anchor.getNode();var d=G(b);if(null!=d){c=0;for(d=d.getTextContent();c<d.length&&/[\t ]/.test(d[c]);)c+=
1;if(0<c)return c=d.substring(0,c),c=x(c),b.insertAfter(c),a.insertNodes([t.$createLineBreakNode()]),c.select(),c}return null}canInsertTab(){return!0}collapseAtStart(){const a=t.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}setLanguage(a){this.getWritable().__language=a}getLanguage(){return this.getLatest().__language}}function H(a){return new z(a)}function I(a){return a instanceof z}
function G(a){let b=null;const c=a.getPreviousSiblings();for(c.push(a);0<c.length&&(a=c.pop(),y(a)&&(b=a),!t.$isLineBreakNode(a)););return b}function J(a){let b=null;const c=a.getNextSiblings();for(c.unshift(a);0<c.length&&(a=c.shift(),y(a)&&(b=a),!t.$isLineBreakNode(a)););return b}function B(){return{node:H()}}function A(a){return{after:b=>{const c=a.parentNode;null!=c&&a!==c.lastChild&&b.push(t.$createLineBreakNode());return b},node:null!==a.style.fontFamily.match("monospace")?H():null}}
function D(){return{node:H()}}function F(){return{node:null}}function E(a){return{after:b=>{a.parentNode&&a.parentNode.nextSibling&&b.push(t.$createLineBreakNode());return b},node:null}}function C(a){return a.classList.contains("js-file-line-container")}function K(a,b){const c=a.getParent();I(c)?L(c,b):y(a)&&a.replace(t.$createTextNode(a.__text))}let M=!1;
function L(a,b){M||(M=!0,b.update(()=>{void 0===a.getLanguage()&&a.setLanguage("javascript");N(a,()=>{var c=a.getTextContent();c=e.tokenize(c,e.languages[a.getLanguage()||""]||e.languages.javascript);c=P(c);var d=a.getChildren();let f=0;for(;f<d.length&&Q(d[f],c[f]);)f++;var k=d.length;const m=c.length,p=Math.min(k,m)-f;let h=0;for(;h<p;)if(h++,!Q(d[k-h],c[m-h])){h--;break}d=f;k-=h;c=c.slice(f,m-h);const {from:g,to:n,nodesForReplacement:r}={from:d,nodesForReplacement:c,to:k};return g!==n||r.length?
(a.splice(g,n-g,r),!0):!1})},{onUpdate:()=>{M=!1},skipTransforms:!0}))}function P(a){const b=[];a.forEach(c=>{if("string"===typeof c){c=c.split("\n");for(var d=0;d<c.length;d++){const f=c[d];f.length&&b.push(x(f));d<c.length-1&&b.push(t.$createLineBreakNode())}}else({content:d}=c),"string"===typeof d?b.push(x(d,c.type)):1===d.length&&"string"===typeof d[0]?b.push(x(d[0],c.type)):b.push(...P(d))});return b}
function N(a,b){var c=t.$getSelection();if(t.$isRangeSelection(c)&&c.anchor){c=c.anchor;var d=c.offset,f="element"===c.type&&t.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),k=0;if(!f){const m=c.getNode();k=d+m.getPreviousSiblings().reduce((p,h)=>p+(t.$isLineBreakNode(h)?0:h.getTextContentSize()),0)}b()&&(f?c.getNode().select(d,d):a.getChildren().some(m=>{if(t.$isTextNode(m)){const p=m.getTextContentSize();if(p>=k)return m.select(k,k),!0;k-=p}return!1}))}}
function Q(a,b){return y(a)&&y(b)?a.__text===b.__text&&a.__highlightType===b.__highlightType:t.$isLineBreakNode(a)&&t.$isLineBreakNode(b)?!0:!1}function R(a){var b=t.$getSelection();if(!t.$isRangeSelection(b)||b.isCollapsed())return!1;b=b.getNodes();for(var c=0;c<b.length;c++){var d=b[c];if(!y(d)&&!t.$isLineBreakNode(d))return!1}c=G(b[0]);null!=c&&S(c,a);for(c=1;c<b.length;c++)d=b[c],t.$isLineBreakNode(b[c-1])&&y(d)&&S(d,a);return!0}
function S(a,b){const c=a.getTextContent();b===t.INDENT_CONTENT_COMMAND?0<c.length&&/\s/.test(c[0])?a.setTextContent("\t"+c):(b=x("\t"),a.insertBefore(b)):0===c.indexOf("\t")&&(1===c.length?a.remove():a.setTextContent(c.substring(1)))}
function T(a,b){const c=t.$getSelection();if(!b.altKey||!t.$isRangeSelection(c))return!1;const {anchor:d,focus:f}=c,k=d.offset,m=f.offset,p=d.getNode(),h=f.getNode();if(!y(p)||!y(h))return!1;var g=G(p),n=J(h);if(null==g||null==n)return!1;const r=g.getNodesBetween(n);for(let q=0;q<r.length;q++){const O=r[q];if(!y(O)&&!t.$isLineBreakNode(O))return!1}b.preventDefault();b.stopPropagation();g=(b=a===t.KEY_ARROW_UP_COMMAND)?g.getPreviousSibling():n.getNextSibling();if(!t.$isLineBreakNode(g))return!0;n=
b?g.getPreviousSibling():g.getNextSibling();if(null==n)return!0;b=b?G(n):J(n);let w=null!=b?b:n;g.remove();r.forEach(q=>q.remove());a===t.KEY_ARROW_UP_COMMAND?(r.forEach(q=>w.insertBefore(q)),w.insertBefore(g)):(w.insertAfter(g),w=g,r.forEach(q=>{w.insertAfter(q);w=q}));c.setTextNodeRange(p,k,h,m);return!0}exports.$createCodeHighlightNode=x;exports.$createCodeNode=H;exports.$isCodeHighlightNode=y;exports.$isCodeNode=I;exports.CodeHighlightNode=u;exports.CodeNode=z;
var n=require("@lexical/utils"),r=require("lexical");
class t extends r.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new t(a.__text,a.__highlightType||void 0,a.__key)}createDOM(a){const b=super.createDOM(a);a=u(a.theme,this.__highlightType);n.addClassNamesToElement(b,a);return b}updateDOM(a,b,c){const d=super.updateDOM(a,b,c);a=u(c.theme,a.__highlightType);c=u(c.theme,this.__highlightType);a!==c&&(a&&n.removeClassNamesFromElement(b,a),c&&n.addClassNamesToElement(b,c));return d}setFormat(){return this.getWritable()}}
function u(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}function w(a,b){return new t(a,b)}function x(a){return a instanceof t}
class y extends r.ElementNode{static getType(){return"code"}static clone(a){return new y(a.__language,a.__key)}constructor(a,b){super(b);this.__language=a}createDOM(a){const b=document.createElement("code");n.addClassNamesToElement(b,a.theme.code);b.setAttribute("spellcheck","false");(a=this.getLanguage())&&b.setAttribute("data-highlight-language",a);return b}updateDOM(a,b){const c=this.__language;a=a.__language;c?c!==a&&b.setAttribute("data-highlight-language",c):a&&b.removeAttribute("data-highlight-language");
return!1}static importDOM(){return{div:()=>({conversion:A,priority:1}),pre:()=>({conversion:B,priority:0}),table:a=>C(a)?{conversion:D,priority:4}:null,td:a=>{const b=a.closest("table");return a.classList.contains("js-file-line")?{conversion:E,priority:4}:b&&C(b)?{conversion:F,priority:4}:null},tr:a=>(a=a.closest("table"))&&C(a)?{conversion:F,priority:4}:null}}insertNewAfter(a){var b=this.getChildren(),c=b.length;if(2<=c&&"\n"===b[c-1].getTextContent()&&"\n"===b[c-2].getTextContent()&&a.isCollapsed()&&
a.anchor.key===this.__key&&a.anchor.offset===c)return b[c-1].remove(),b[c-2].remove(),a=r.$createParagraphNode(),this.insertAfter(a),a;b=a.anchor.getNode();var d=G(b);if(null!=d){c=0;for(d=d.getTextContent();c<d.length&&/[\t ]/.test(d[c]);)c+=1;if(0<c)return c=d.substring(0,c),c=w(c),b.insertAfter(c),a.insertNodes([r.$createLineBreakNode()]),c.select(),c}return null}canInsertTab(){return!0}collapseAtStart(){const a=r.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);
return!0}setLanguage(a){this.getWritable().__language=a}getLanguage(){return this.getLatest().__language}}function H(a){return new y(a)}function I(a){return a instanceof y}function G(a){let b=null;const c=a.getPreviousSiblings();for(c.push(a);0<c.length&&(a=c.pop(),x(a)&&(b=a),!r.$isLineBreakNode(a)););return b}function J(a){let b=null;const c=a.getNextSiblings();for(c.unshift(a);0<c.length&&(a=c.shift(),x(a)&&(b=a),!r.$isLineBreakNode(a)););return b}function B(){return{node:H()}}
function A(a){return{after:b=>{const c=a.parentNode;null!=c&&a!==c.lastChild&&b.push(r.$createLineBreakNode());return b},node:null!==a.style.fontFamily.match("monospace")?H():null}}function D(){return{node:H()}}function F(){return{node:null}}function E(a){return{after:b=>{a.parentNode&&a.parentNode.nextSibling&&b.push(r.$createLineBreakNode());return b},node:null}}function C(a){return a.classList.contains("js-file-line-container")}
function K(a){const b=a.getParent();I(b)?L(b):x(a)&&a.replace(r.$createTextNode(a.__text))}
function L(a){void 0===a.getLanguage()&&a.setLanguage("javascript");M(a,()=>{var b=a.getTextContent();b=e.tokenize(b,e.languages[a.getLanguage()||""]||e.languages.javascript);b=O(b);var c=a.getChildren();let d=0;for(;d<c.length&&P(c[d],b[d]);)d++;var h=c.length;const k=b.length,l=Math.min(h,k)-d;let f=0;for(;f<l;)if(f++,!P(c[h-f],b[k-f])){f--;break}c=d;h-=f;b=b.slice(d,k-f);const {from:m,to:g,nodesForReplacement:p}={from:c,nodesForReplacement:b,to:h};return m!==g||p.length?(a.splice(m,g-m,p),!0):
!1})}function O(a){const b=[];a.forEach(c=>{if("string"===typeof c){c=c.split("\n");for(var d=0;d<c.length;d++){const h=c[d];h.length&&b.push(w(h));d<c.length-1&&b.push(r.$createLineBreakNode())}}else({content:d}=c),"string"===typeof d?b.push(w(d,c.type)):1===d.length&&"string"===typeof d[0]?b.push(w(d[0],c.type)):b.push(...O(d))});return b}
function M(a,b){var c=r.$getSelection();if(r.$isRangeSelection(c)&&c.anchor){c=c.anchor;var d=c.offset,h="element"===c.type&&r.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),k=0;if(!h){const l=c.getNode();k=d+l.getPreviousSiblings().reduce((f,m)=>f+(r.$isLineBreakNode(m)?0:m.getTextContentSize()),0)}b()&&(h?c.getNode().select(d,d):a.getChildren().some(l=>{if(r.$isTextNode(l)){const f=l.getTextContentSize();if(f>=k)return l.select(k,k),!0;k-=f}return!1}))}}
function P(a,b){return x(a)&&x(b)?a.__text===b.__text&&a.__highlightType===b.__highlightType:r.$isLineBreakNode(a)&&r.$isLineBreakNode(b)?!0:!1}function Q(a){var b=r.$getSelection();if(!r.$isRangeSelection(b)||b.isCollapsed())return!1;b=b.getNodes();for(var c=0;c<b.length;c++){var d=b[c];if(!x(d)&&!r.$isLineBreakNode(d))return!1}c=G(b[0]);null!=c&&R(c,a);for(c=1;c<b.length;c++)d=b[c],r.$isLineBreakNode(b[c-1])&&x(d)&&R(d,a);return!0}
function R(a,b){const c=a.getTextContent();b===r.INDENT_CONTENT_COMMAND?0<c.length&&/\s/.test(c[0])?a.setTextContent("\t"+c):(b=w("\t"),a.insertBefore(b)):0===c.indexOf("\t")&&(1===c.length?a.remove():a.setTextContent(c.substring(1)))}
function S(a,b){const c=r.$getSelection();if(!b.altKey||!r.$isRangeSelection(c))return!1;const {anchor:d,focus:h}=c,k=d.offset,l=h.offset,f=d.getNode(),m=h.getNode();if(!x(f)||!x(m))return!1;var g=G(f),p=J(m);if(null==g||null==p)return!1;const z=g.getNodesBetween(p);for(let q=0;q<z.length;q++){const N=z[q];if(!x(N)&&!r.$isLineBreakNode(N))return!1}b.preventDefault();b.stopPropagation();g=(b=a===r.KEY_ARROW_UP_COMMAND)?g.getPreviousSibling():p.getNextSibling();if(!r.$isLineBreakNode(g))return!0;p=
b?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;b=b?G(p):J(p);let v=null!=b?b:p;g.remove();z.forEach(q=>q.remove());a===r.KEY_ARROW_UP_COMMAND?(z.forEach(q=>v.insertBefore(q)),v.insertBefore(g)):(v.insertAfter(g),v=g,z.forEach(q=>{v.insertAfter(q);v=q}));c.setTextNodeRange(f,k,m,l);return!0}exports.$createCodeHighlightNode=w;exports.$createCodeNode=H;exports.$isCodeHighlightNode=x;exports.$isCodeNode=I;exports.CodeHighlightNode=t;exports.CodeNode=y;
exports.getCodeLanguages=()=>Object.keys(e.languages).filter(a=>"function"!==typeof e.languages[a]).sort();exports.getDefaultCodeLanguage=()=>"javascript";exports.getFirstCodeHighlightNodeOfLine=G;exports.getLastCodeHighlightNodeOfLine=J;
exports.registerCodeHighlighting=function(a){if(!a.hasNodes([z,u]))throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");return l.mergeRegister(a.registerNodeTransform(z,b=>L(b,a)),a.registerNodeTransform(t.TextNode,b=>K(b,a)),a.registerNodeTransform(u,b=>K(b,a)),a.registerCommand(t.INDENT_CONTENT_COMMAND,()=>R(t.INDENT_CONTENT_COMMAND),1),a.registerCommand(t.OUTDENT_CONTENT_COMMAND,()=>R(t.OUTDENT_CONTENT_COMMAND),1),a.registerCommand(t.KEY_ARROW_UP_COMMAND,b=>
T(t.KEY_ARROW_UP_COMMAND,b),1),a.registerCommand(t.KEY_ARROW_DOWN_COMMAND,b=>T(t.KEY_ARROW_DOWN_COMMAND,b),1))};
exports.registerCodeHighlighting=function(a){if(!a.hasNodes([y,t]))throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");return n.mergeRegister(a.registerMutationListener(y,b=>{a.update(()=>{for(const [h,k]of b)if("destroyed"!==k){var c=r.$getNodeByKey(h);if(null!==c)a:{var d=c;c=a.getElementByKey(d.getKey());if(null===c)break a;d=d.getChildren();const l=d.length;if(l===c.__cachedChildrenLength)break a;c.__cachedChildrenLength=l;let f="1",m=1;for(let g=0;g<l;g++)r.$isLineBreakNode(d[g])&&
(f+="\n"+ ++m);c.setAttribute("data-gutter",f)}}})}),a.registerNodeTransform(y,b=>L(b)),a.registerNodeTransform(r.TextNode,b=>K(b)),a.registerNodeTransform(t,b=>K(b)),a.registerCommand(r.INDENT_CONTENT_COMMAND,()=>Q(r.INDENT_CONTENT_COMMAND),1),a.registerCommand(r.OUTDENT_CONTENT_COMMAND,()=>Q(r.OUTDENT_CONTENT_COMMAND),1),a.registerCommand(r.KEY_ARROW_UP_COMMAND,b=>S(r.KEY_ARROW_UP_COMMAND,b),1),a.registerCommand(r.KEY_ARROW_DOWN_COMMAND,b=>S(r.KEY_ARROW_DOWN_COMMAND,b),1))};

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

"license": "MIT",
"version": "0.1.20",
"version": "0.1.21",
"main": "LexicalCode.js",
"peerDependencies": {
"lexical": "0.1.20"
"lexical": "0.1.21"
},
"dependencies": {
"@lexical/utils": "0.1.20",
"@lexical/utils": "0.1.21",
"prismjs": "^1.25.0"

@@ -20,0 +20,0 @@ },

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