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

@lexical/code

Package Overview
Dependencies
Maintainers
0
Versions
196
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.17.2-nightly.20240906.0 to 0.17.2-nightly.20240909.0

1

CodeHighlighterPrism.d.ts

@@ -29,1 +29,2 @@ /**

}
export declare const Prism: typeof import('prismjs');

1

CodeNode.d.ts

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

import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, ParagraphNode, RangeSelection, SerializedElementNode, Spread, TabNode } from 'lexical';
import './CodeHighlighterPrism';
import { ElementNode } from 'lexical';

@@ -13,0 +12,0 @@ export type SerializedCodeNode = Spread<{

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

const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
/**

@@ -47,2 +49,12 @@ * Copyright (c) Meta Platforms, Inc. and affiliates.

const Prism = CAN_USE_DOM ? window.Prism : global.Prism;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// invariant(condition, message) will refine types based on "condition", and

@@ -69,3 +81,3 @@ // if "condition" is false will throw an error. This function is special-cased

// eslint-disable-next-line no-prototype-builtins
return language ? window.Prism.languages.hasOwnProperty(language) : false;
return language ? Prism.languages.hasOwnProperty(language) : false;
} catch (_unused) {

@@ -1085,3 +1097,5 @@ return false;

const isMoveToStart = type === lexical.MOVE_TO_START;
if (!($isCodeHighlightNode(anchorNode) || lexical.$isTabNode(anchorNode)) || !($isCodeHighlightNode(focusNode) || lexical.$isTabNode(focusNode))) {
// Ensure the selection is within the codeblock
if (!$isSelectionInCode(selection) || !($isCodeHighlightNode(anchorNode) || lexical.$isTabNode(anchorNode)) || !($isCodeHighlightNode(focusNode) || lexical.$isTabNode(focusNode))) {
return false;

@@ -1088,0 +1102,0 @@ }

@@ -11,11 +11,11 @@ /**

require("prismjs/components/prism-swift");require("prismjs/components/prism-typescript");require("prismjs/components/prism-java");require("prismjs/components/prism-cpp");var d=require("@lexical/utils"),m=require("lexical");"use strict";var q;
function v(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}q=v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v["default"]:v;let x=a=>{try{return a?window.Prism.languages.hasOwnProperty(a):!1}catch(b){return!1}};
function y(a,b){for(let c of a.childNodes){if(d.isHTMLElement(c)&&c.tagName===b)return!0;y(c,b)}return!1}
function v(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}q=v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v["default"]:v;
let aa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?window.Prism:global.Prism,x=a=>{try{return a?aa.languages.hasOwnProperty(a):!1}catch(b){return!1}};function y(a,b){for(let c of a.childNodes){if(d.isHTMLElement(c)&&c.tagName===b)return!0;y(c,b)}return!1}
class z extends m.ElementNode{static getType(){return"code"}static clone(a){return new z(a.__language,a.__key)}constructor(a,b){super(b);this.__language=a;this.__isSyntaxHighlightSupported=x(a)}createDOM(a){let b=document.createElement("code");d.addClassNamesToElement(b,a.theme.code);b.setAttribute("spellcheck","false");if(a=this.getLanguage())b.setAttribute("data-language",a),this.getIsSyntaxHighlightSupported()&&b.setAttribute("data-highlight-language",a);return b}updateDOM(a,b){let c=this.__language,
e=a.__language;c?c!==e&&(b.setAttribute("data-language",c),this.__isSyntaxHighlightSupported&&b.setAttribute("data-highlight-language",c)):e&&(b.removeAttribute("data-language"),a.__isSyntaxHighlightSupported&&b.removeAttribute("data-highlight-language"));return!1}exportDOM(a){let b=document.createElement("pre");d.addClassNamesToElement(b,a._config.theme.code);b.setAttribute("spellcheck","false");if(a=this.getLanguage())b.setAttribute("data-language",a),this.getIsSyntaxHighlightSupported()&&b.setAttribute("data-highlight-language",
a);return{element:b}}static importDOM(){return{code:a=>null!=a.textContent&&(/\r?\n/.test(a.textContent)||y(a,"BR"))?{conversion:A,priority:1}:null,div:()=>({conversion:aa,priority:1}),pre:()=>({conversion:A,priority:0}),table:a=>B(a)?{conversion:ba,priority:3}:null,td:a=>{let b=a.closest("table");return a.classList.contains("js-file-line")||b&&B(b)?{conversion:C,priority:3}:null},tr:a=>(a=a.closest("table"))&&B(a)?{conversion:C,priority:3}:null}}static importJSON(a){let b=D(a.language);b.setFormat(a.format);
a);return{element:b}}static importDOM(){return{code:a=>null!=a.textContent&&(/\r?\n/.test(a.textContent)||y(a,"BR"))?{conversion:A,priority:1}:null,div:()=>({conversion:ba,priority:1}),pre:()=>({conversion:A,priority:0}),table:a=>B(a)?{conversion:ca,priority:3}:null,td:a=>{let b=a.closest("table");return a.classList.contains("js-file-line")||b&&B(b)?{conversion:C,priority:3}:null},tr:a=>(a=a.closest("table"))&&B(a)?{conversion:C,priority:3}:null}}static importJSON(a){let b=D(a.language);b.setFormat(a.format);
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),type:"code",version:1}}insertNewAfter(a,b=!0){var c=this.getChildren(),e=c.length;if(2<=e&&"\n"===c[e-1].getTextContent()&&"\n"===c[e-2].getTextContent()&&a.isCollapsed()&&a.anchor.key===this.__key&&a.anchor.offset===e)return c[e-1].remove(),c[e-2].remove(),a=m.$createParagraphNode(),this.insertAfter(a,b),a;let {anchor:f,focus:g}=a;b=(f.isBefore(g)?f:g).getNode();if(m.$isTextNode(b)){e=
E(b);for(c=[];;)if(m.$isTabNode(e))c.push(m.$createTabNode()),e=e.getNextSibling();else if(F(e)){for(var h=0,k=e.getTextContent(),l=e.getTextContentSize();h<l&&" "===k[h];)h++;0!==h&&c.push(G(" ".repeat(h)));if(h!==l)break;e=e.getNextSibling()}else break;e=b.splitText(f.offset)[0];h=0===f.offset?0:1;h=e.getIndexWithinParent()+h;k=b.getParentOrThrow();l=[m.$createLineBreakNode(),...c];k.splice(h,0,l);(c=c[c.length-1])?c.select():0===f.offset?e.selectPrevious():e.getNextSibling().selectNext(0,0)}H(b)&&
({offset:a}=a.anchor,b.splice(a,0,[m.$createLineBreakNode()]),b.select(a+1,a+1));return null}canIndent(){return!1}collapseAtStart(){let a=m.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}setLanguage(a){let b=this.getWritable();b.__language=a;b.__isSyntaxHighlightSupported=x(a)}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}}
function D(a){return m.$applyNodeReplacement(new z(a))}function H(a){return a instanceof z}function A(a){a=a.getAttribute("data-language");return{node:D(a)}}function aa(a){let b=null!==a.style.fontFamily.match("monospace");var c;if(c=!b){a:{for(a=a.parentElement;null!==a;){if(null!==a.style.fontFamily.match("monospace")){a=!0;break a}a=a.parentElement}a=!1}c=!a}return c?{node:null}:{node:b?D():null}}function ba(){return{node:D()}}function C(){return{node:null}}
function D(a){return m.$applyNodeReplacement(new z(a))}function H(a){return a instanceof z}function A(a){a=a.getAttribute("data-language");return{node:D(a)}}function ba(a){let b=null!==a.style.fontFamily.match("monospace");var c;if(c=!b){a:{for(a=a.parentElement;null!==a;){if(null!==a.style.fontFamily.match("monospace")){a=!0;break a}a=a.parentElement}a=!1}c=!a}return c?{node:null}:{node:b?D():null}}function ca(){return{node:D()}}function C(){return{node:null}}
function B(a){return a.classList.contains("js-file-line-container")}let I={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},J={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function L(a){return J[a]||a}

@@ -27,21 +27,21 @@ class M extends m.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new M(a.__text,a.__highlightType||void 0,a.__key)}getHighlightType(){return this.getLatest().__highlightType}canHaveFormat(){return!1}createDOM(a){let b=super.createDOM(a);a=N(a.theme,this.__highlightType);d.addClassNamesToElement(b,a);return b}updateDOM(a,b,c){let e=super.updateDOM(a,b,c);a=N(c.theme,a.__highlightType);c=N(c.theme,this.__highlightType);a!==

e&&" "!==e)return c;a:for(e=a,f=a.getTextContent(),a=a.getTextContentSize();;){if(!F(e)||b===a){e=e.getNextSibling();if(null===e||m.$isLineBreakNode(e)){a=null;break a}F(e)&&(b=0,f=e.getTextContent(),a=e.getTextContentSize())}if(F(e)){if(" "!==f[b]){a={node:e,offset:b};break a}b++}}return null!==a?a:c}function R(a){a=O(a);m.$isLineBreakNode(a)&&q(168);return a}function S(a,b,c){let e=a.getParent();H(e)?T(e,b,c):F(a)&&a.replace(m.$createTextNode(a.__text))}let U=new Set;
function T(a,b,c){let e=a.getKey();U.has(e)||(U.add(e),void 0===a.getLanguage()&&a.setLanguage(c.defaultLanguage),b.update(()=>{ca(e,()=>{var f=m.$getNodeByKey(e);if(!H(f)||!f.isAttached())return!1;var g=f.getTextContent();g=c.tokenize(g,f.getLanguage()||c.defaultLanguage);g=V(g);var h=f.getChildren();for(f=0;f<h.length&&W(h[f],g[f]);)f++;var k=h.length;let l=g.length,r=Math.min(k,l)-f,n=0;for(;n<r;)if(n++,!W(h[k-n],g[l-n])){n--;break}h=f;k-=n;g=g.slice(f,l-n);let {from:p,to:w,nodesForReplacement:u}=
function T(a,b,c){let e=a.getKey();U.has(e)||(U.add(e),void 0===a.getLanguage()&&a.setLanguage(c.defaultLanguage),b.update(()=>{da(e,()=>{var f=m.$getNodeByKey(e);if(!H(f)||!f.isAttached())return!1;var g=f.getTextContent();g=c.tokenize(g,f.getLanguage()||c.defaultLanguage);g=V(g);var h=f.getChildren();for(f=0;f<h.length&&W(h[f],g[f]);)f++;var k=h.length;let l=g.length,r=Math.min(k,l)-f,n=0;for(;n<r;)if(n++,!W(h[k-n],g[l-n])){n--;break}h=f;k-=n;g=g.slice(f,l-n);let {from:p,to:w,nodesForReplacement:u}=
{from:h,nodesForReplacement:g,to:k};return p!==w||u.length?(a.splice(p,w-p,u),!0):!1})},{onUpdate:()=>{U.delete(e)},skipTransforms:!0}))}
function V(a,b){let c=[];for(let e of a)if("string"===typeof e){a=e.split(/(\n|\t)/);let f=a.length;for(let g=0;g<f;g++){let h=a[g];"\n"===h||"\r\n"===h?c.push(m.$createLineBreakNode()):"\t"===h?c.push(m.$createTabNode()):0<h.length&&c.push(G(h,b))}}else({content:a}=e),"string"===typeof a?c.push(...V([a],e.type)):Array.isArray(a)&&c.push(...V(a,e.type));return c}
function ca(a,b){a=m.$getNodeByKey(a);if(H(a)&&a.isAttached()){var c=m.$getSelection();if(m.$isRangeSelection(c)){c=c.anchor;var e=c.offset,f="element"===c.type&&m.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),g=0;if(!f){let h=c.getNode();g=e+h.getPreviousSiblings().reduce((k,l)=>k+l.getTextContentSize(),0)}b()&&(f?c.getNode().select(e,e):a.getChildren().some(h=>{let k=m.$isTextNode(h);if(k||m.$isLineBreakNode(h)){let l=h.getTextContentSize();if(k&&l>=g)return h.select(g,g),!0;g-=l}return!1}))}else b()}}
function da(a,b){a=m.$getNodeByKey(a);if(H(a)&&a.isAttached()){var c=m.$getSelection();if(m.$isRangeSelection(c)){c=c.anchor;var e=c.offset,f="element"===c.type&&m.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),g=0;if(!f){let h=c.getNode();g=e+h.getPreviousSiblings().reduce((k,l)=>k+l.getTextContentSize(),0)}b()&&(f?c.getNode().select(e,e):a.getChildren().some(h=>{let k=m.$isTextNode(h);if(k||m.$isLineBreakNode(h)){let l=h.getTextContentSize();if(k&&l>=g)return h.select(g,g),!0;g-=l}return!1}))}else b()}}
function W(a,b){return F(a)&&F(b)&&a.__text===b.__text&&a.__highlightType===b.__highlightType||m.$isTabNode(a)&&m.$isTabNode(b)||m.$isLineBreakNode(a)&&m.$isLineBreakNode(b)}function X(a){if(!m.$isRangeSelection(a))return!1;var b=a.anchor.getNode();a=a.focus.getNode();if(b.is(a)&&H(b))return!0;b=b.getParent();return H(b)&&b.is(a.getParent())}
function Y(a){a=a.getNodes();let b=[[]];if(1===a.length&&H(a[0]))return b;let c=b[0];for(let e=0;e<a.length;e++){let f=a[e];F(f)||m.$isTabNode(f)||m.$isLineBreakNode(f)||q(169);m.$isLineBreakNode(f)?0!==e&&0<c.length&&(c=[],b.push(c)):c.push(f)}return b}
function da(a){var b=m.$getSelection();if(!m.$isRangeSelection(b)||!X(b))return null;let c=a?m.OUTDENT_CONTENT_COMMAND:m.INDENT_CONTENT_COMMAND;a=a?m.OUTDENT_CONTENT_COMMAND:m.INSERT_TAB_COMMAND;if(1<Y(b).length)return c;var e=b.getNodes()[0];H(e)||F(e)||m.$isTabNode(e)||m.$isLineBreakNode(e)||q(170);if(H(e))return c;let f=E(e);e=O(e);var g=b.anchor;let h=b.focus;h.isBefore(g)?b=h:(b=g,g=h);return null!==f&&null!==e&&b.key===f.getKey()&&0===b.offset&&g.key===e.getKey()&&g.offset===e.getTextContentSize()?
function ea(a){var b=m.$getSelection();if(!m.$isRangeSelection(b)||!X(b))return null;let c=a?m.OUTDENT_CONTENT_COMMAND:m.INDENT_CONTENT_COMMAND;a=a?m.OUTDENT_CONTENT_COMMAND:m.INSERT_TAB_COMMAND;if(1<Y(b).length)return c;var e=b.getNodes()[0];H(e)||F(e)||m.$isTabNode(e)||m.$isLineBreakNode(e)||q(170);if(H(e))return c;let f=E(e);e=O(e);var g=b.anchor;let h=b.focus;h.isBefore(g)?b=h:(b=g,g=h);return null!==f&&null!==e&&b.key===f.getKey()&&0===b.offset&&g.key===e.getKey()&&g.offset===e.getTextContentSize()?
c:a}
function Z(a){var b=m.$getSelection();if(!m.$isRangeSelection(b)||!X(b))return!1;var c=Y(b);let e=c.length;if(1<c.length){for(b=0;b<e;b++){var f=c[b];0<f.length&&(f=f[0],0===b&&(f=E(f)),null!==f&&(a===m.INDENT_CONTENT_COMMAND?f.insertBefore(m.$createTabNode()):m.$isTabNode(f)&&f.remove()))}return!0}c=b.getNodes()[0];H(c)||F(c)||m.$isTabNode(c)||m.$isLineBreakNode(c)||q(171);if(H(c))return a===m.INDENT_CONTENT_COMMAND&&b.insertNodes([m.$createTabNode()]),!0;c=E(c);null===c&&q(172);a===m.INDENT_CONTENT_COMMAND?m.$isLineBreakNode(c)?
c.insertAfter(m.$createTabNode()):c.insertBefore(m.$createTabNode()):m.$isTabNode(c)&&c.remove();return!0}
function ea(a,b){let c=m.$getSelection();if(!m.$isRangeSelection(c))return!1;let {anchor:e,focus:f}=c,g=e.offset,h=f.offset,k=e.getNode(),l=f.getNode();var r=a===m.KEY_ARROW_UP_COMMAND;if(!X(c)||!F(k)&&!m.$isTabNode(k)||!F(l)&&!m.$isTabNode(l))return!1;if(!b.altKey){if(c.isCollapsed())if(a=k.getParentOrThrow(),r&&0===g&&null===k.getPreviousSibling()){if(null===a.getPreviousSibling())return a.selectPrevious(),b.preventDefault(),!0}else if(!r&&g===k.getTextContentSize()&&null===k.getNextSibling()&&
function fa(a,b){let c=m.$getSelection();if(!m.$isRangeSelection(c))return!1;let {anchor:e,focus:f}=c,g=e.offset,h=f.offset,k=e.getNode(),l=f.getNode();var r=a===m.KEY_ARROW_UP_COMMAND;if(!X(c)||!F(k)&&!m.$isTabNode(k)||!F(l)&&!m.$isTabNode(l))return!1;if(!b.altKey){if(c.isCollapsed())if(a=k.getParentOrThrow(),r&&0===g&&null===k.getPreviousSibling()){if(null===a.getPreviousSibling())return a.selectPrevious(),b.preventDefault(),!0}else if(!r&&g===k.getTextContentSize()&&null===k.getNextSibling()&&
null===a.getNextSibling())return a.selectNext(),b.preventDefault(),!0;return!1}let n;if(k.isBefore(l)){var p=E(k);n=O(l)}else p=E(l),n=O(k);if(null==p||null==n)return!1;let w=p.getNodesBetween(n);for(let t=0;t<w.length;t++){let K=w[t];if(!F(K)&&!m.$isTabNode(K)&&!m.$isLineBreakNode(K))return!1}b.preventDefault();b.stopPropagation();b=r?p.getPreviousSibling():n.getNextSibling();if(!m.$isLineBreakNode(b))return!0;p=r?b.getPreviousSibling():b.getNextSibling();if(null==p)return!0;r=F(p)||m.$isTabNode(p)||
m.$isLineBreakNode(p)?r?E(p):O(p):null;let u=null!=r?r:p;b.remove();w.forEach(t=>t.remove());a===m.KEY_ARROW_UP_COMMAND?(w.forEach(t=>u.insertBefore(t)),u.insertBefore(b)):(u.insertAfter(b),u=b,w.forEach(t=>{u.insertAfter(t);u=t}));c.setTextNodeRange(k,g,l,h);return!0}
function fa(a,b){let c=m.$getSelection();if(!m.$isRangeSelection(c))return!1;let {anchor:e,focus:f}=c;var g=e.getNode();let h=f.getNode();a=a===m.MOVE_TO_START;if(!F(g)&&!m.$isTabNode(g)||!F(h)&&!m.$isTabNode(h))return!1;if(a)if(g=Q(h,f.offset),null!==g){let {node:k,offset:l}=g;m.$isLineBreakNode(k)?k.selectNext(0,0):c.setTextNodeRange(k,l,k,l)}else h.getParentOrThrow().selectStart();else R(h).select();b.preventDefault();b.stopPropagation();return!0}exports.$createCodeHighlightNode=G;
function ha(a,b){let c=m.$getSelection();if(!m.$isRangeSelection(c))return!1;let {anchor:e,focus:f}=c;var g=e.getNode();let h=f.getNode();a=a===m.MOVE_TO_START;if(!X(c)||!F(g)&&!m.$isTabNode(g)||!F(h)&&!m.$isTabNode(h))return!1;if(a)if(g=Q(h,f.offset),null!==g){let {node:k,offset:l}=g;m.$isLineBreakNode(k)?k.selectNext(0,0):c.setTextNodeRange(k,l,k,l)}else h.getParentOrThrow().selectStart();else R(h).select();b.preventDefault();b.stopPropagation();return!0}exports.$createCodeHighlightNode=G;
exports.$createCodeNode=D;exports.$isCodeHighlightNode=F;exports.$isCodeNode=H;exports.CODE_LANGUAGE_FRIENDLY_NAME_MAP=I;exports.CODE_LANGUAGE_MAP=J;exports.CodeHighlightNode=M;exports.CodeNode=z;exports.DEFAULT_CODE_LANGUAGE="javascript";exports.PrismTokenizer=P;exports.getCodeLanguages=()=>Object.keys(window.Prism.languages).filter(a=>"function"!==typeof window.Prism.languages[a]).sort();exports.getDefaultCodeLanguage=()=>"javascript";exports.getEndOfCodeInLine=R;
exports.getFirstCodeNodeOfLine=E;exports.getLanguageFriendlyName=function(a){a=L(a);return I[a]||a};exports.getLastCodeNodeOfLine=O;exports.getStartOfCodeInLine=Q;exports.normalizeCodeLang=L;
exports.registerCodeHighlighting=function(a,b){if(!a.hasNodes([z,M]))throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==b&&(b=P);return d.mergeRegister(a.registerMutationListener(z,c=>{a.update(()=>{for(let [g,h]of c)if("destroyed"!==h){var e=m.$getNodeByKey(g);if(null!==e)a:{var f=e;e=a.getElementByKey(f.getKey());if(null===e)break a;f=f.getChildren();let k=f.length;if(k===e.__cachedChildrenLength)break a;e.__cachedChildrenLength=k;let l="1",r=1;for(let n=
0;n<k;n++)m.$isLineBreakNode(f[n])&&(l+="\n"+ ++r);e.setAttribute("data-gutter",l)}}})},{skipInitialization:!1}),a.registerNodeTransform(z,c=>T(c,a,b)),a.registerNodeTransform(m.TextNode,c=>S(c,a,b)),a.registerNodeTransform(M,c=>S(c,a,b)),a.registerCommand(m.KEY_TAB_COMMAND,c=>{let e=da(c.shiftKey);if(null===e)return!1;c.preventDefault();a.dispatchCommand(e,void 0);return!0},m.COMMAND_PRIORITY_LOW),a.registerCommand(m.INSERT_TAB_COMMAND,()=>{let c=m.$getSelection();if(!X(c))return!1;m.$insertNodes([m.$createTabNode()]);
return!0},m.COMMAND_PRIORITY_LOW),a.registerCommand(m.INDENT_CONTENT_COMMAND,()=>Z(m.INDENT_CONTENT_COMMAND),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.OUTDENT_CONTENT_COMMAND,()=>Z(m.OUTDENT_CONTENT_COMMAND),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.KEY_ARROW_UP_COMMAND,c=>ea(m.KEY_ARROW_UP_COMMAND,c),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.KEY_ARROW_DOWN_COMMAND,c=>ea(m.KEY_ARROW_DOWN_COMMAND,c),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.MOVE_TO_END,c=>fa(m.MOVE_TO_END,c),m.COMMAND_PRIORITY_LOW),
a.registerCommand(m.MOVE_TO_START,c=>fa(m.MOVE_TO_START,c),m.COMMAND_PRIORITY_LOW))}
0;n<k;n++)m.$isLineBreakNode(f[n])&&(l+="\n"+ ++r);e.setAttribute("data-gutter",l)}}})},{skipInitialization:!1}),a.registerNodeTransform(z,c=>T(c,a,b)),a.registerNodeTransform(m.TextNode,c=>S(c,a,b)),a.registerNodeTransform(M,c=>S(c,a,b)),a.registerCommand(m.KEY_TAB_COMMAND,c=>{let e=ea(c.shiftKey);if(null===e)return!1;c.preventDefault();a.dispatchCommand(e,void 0);return!0},m.COMMAND_PRIORITY_LOW),a.registerCommand(m.INSERT_TAB_COMMAND,()=>{let c=m.$getSelection();if(!X(c))return!1;m.$insertNodes([m.$createTabNode()]);
return!0},m.COMMAND_PRIORITY_LOW),a.registerCommand(m.INDENT_CONTENT_COMMAND,()=>Z(m.INDENT_CONTENT_COMMAND),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.OUTDENT_CONTENT_COMMAND,()=>Z(m.OUTDENT_CONTENT_COMMAND),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.KEY_ARROW_UP_COMMAND,c=>fa(m.KEY_ARROW_UP_COMMAND,c),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.KEY_ARROW_DOWN_COMMAND,c=>fa(m.KEY_ARROW_DOWN_COMMAND,c),m.COMMAND_PRIORITY_LOW),a.registerCommand(m.MOVE_TO_END,c=>ha(m.MOVE_TO_END,c),m.COMMAND_PRIORITY_LOW),
a.registerCommand(m.MOVE_TO_START,c=>ha(m.MOVE_TO_START,c),m.COMMAND_PRIORITY_LOW))}

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

"license": "MIT",
"version": "0.17.2-nightly.20240906.0",
"version": "0.17.2-nightly.20240909.0",
"main": "LexicalCode.js",
"types": "index.d.ts",
"dependencies": {
"@lexical/utils": "0.17.2-nightly.20240906.0",
"lexical": "0.17.2-nightly.20240906.0",
"@lexical/utils": "0.17.2-nightly.20240909.0",
"lexical": "0.17.2-nightly.20240909.0",
"prismjs": "^1.27.0"

@@ -19,0 +19,0 @@ },

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