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

@lexical/code

Package Overview
Dependencies
Maintainers
6
Versions
193
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.3.11 to 0.4.0

2

CodeHighlightNode.d.ts

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

export declare const getCodeLanguages: () => Array<string>;
/** @noInheritDoc */
export declare class CodeHighlightNode extends TextNode {
/** @internal */
__highlightType: string | null | undefined;

@@ -35,0 +37,0 @@ constructor(text: string, highlightType?: string | null | undefined, key?: NodeKey);

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

}, SerializedElementNode>;
/** @noInheritDoc */
export declare class CodeNode extends ElementNode {
/** @internal */
__language: string | null | undefined;

@@ -30,0 +32,0 @@ static getType(): string;

@@ -0,1 +1,2 @@

/** @module @lexical/code */
/**

@@ -7,2 +8,3 @@ * Copyright (c) Meta Platforms, Inc. and affiliates.

*
*
*/

@@ -9,0 +11,0 @@ export { getEndOfCodeInLine, getStartOfCodeInLine, registerCodeHighlighting, } from './CodeHighlighter';

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

language => typeof Prism.languages[language] !== 'function').sort();
/** @noInheritDoc */
class CodeHighlightNode extends lexical.TextNode {
/** @internal */
constructor(text, highlightType, key) {

@@ -198,3 +201,6 @@ super(text, key);

const LANGUAGE_DATA_ATTRIBUTE = 'data-highlight-language';
/** @noInheritDoc */
class CodeNode extends lexical.ElementNode {
/** @internal */
static getType() {

@@ -746,5 +752,7 @@ return 'code';

function updateAndRetainSelection(node, updateFn) {
const selection = lexical.$getSelection();
const selection = lexical.$getSelection(); // If it's not range selection (or null selection) there's no need to change it,
// but we can still run highlighting logic
if (!lexical.$isRangeSelection(selection) || !selection.anchor) {
if (!lexical.$isRangeSelection(selection)) {
updateFn();
return;

@@ -751,0 +759,0 @@ }

2

LexicalCode.prod.js

@@ -22,3 +22,3 @@ /**

p-n,w),!0):!1})},{onUpdate:()=>{S=!1},skipTransforms:!0}))}function T(a){let b=[];a.forEach(c=>{if("string"===typeof c){c=c.split("\n");for(var d=0;d<c.length;d++){let f=c[d];f.length&&b.push(A(f));d<c.length-1&&b.push(r.$createLineBreakNode())}}else({content:d}=c),"string"===typeof d?b.push(A(d,c.type)):Array.isArray(d)&&1===d.length&&"string"===typeof d[0]?b.push(A(d[0],c.type)):Array.isArray(d)&&b.push(...T(d))});return b}
function ca(a,b){var c=r.$getSelection();if(r.$isRangeSelection(c)&&c.anchor){c=c.anchor;var d=c.offset,f="element"===c.type&&r.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),g=0;if(!f){let l=c.getNode();g=d+l.getPreviousSiblings().reduce((h,k)=>h+(r.$isLineBreakNode(k)?0:k.getTextContentSize()),0)}b()&&(f?c.getNode().select(d,d):a.getChildren().some(l=>{if(r.$isTextNode(l)){let h=l.getTextContentSize();if(h>=g)return l.select(g,g),!0;g-=h}return!1}))}}
function ca(a,b){var c=r.$getSelection();if(r.$isRangeSelection(c)){c=c.anchor;var d=c.offset,f="element"===c.type&&r.$isLineBreakNode(a.getChildAtIndex(c.offset-1)),g=0;if(!f){let l=c.getNode();g=d+l.getPreviousSiblings().reduce((h,k)=>h+(r.$isLineBreakNode(k)?0:k.getTextContentSize()),0)}b()&&(f?c.getNode().select(d,d):a.getChildren().some(l=>{if(r.$isTextNode(l)){let h=l.getTextContentSize();if(h>=g)return l.select(g,g),!0;g-=h}return!1}))}else b()}
function U(a,b){return C(a)&&C(b)?a.__text===b.__text&&a.__highlightType===b.__highlightType:r.$isLineBreakNode(a)&&r.$isLineBreakNode(b)?!0:!1}function V(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(!C(d)&&!r.$isLineBreakNode(d))return!1}c=D(b[0]);null!=c&&W(c,a);for(c=1;c<b.length;c++)d=b[c],r.$isLineBreakNode(b[c-1])&&C(d)&&W(d,a);return!0}

@@ -25,0 +25,0 @@ function W(a,b){let c=a.getTextContent();b===r.INDENT_CONTENT_COMMAND?0<c.length&&/\s/.test(c[0])?a.setTextContent("\t"+c):(b=A("\t"),a.insertBefore(b)):0===c.indexOf("\t")&&(1===c.length?a.remove():a.setTextContent(c.substring(1)))}

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

"license": "MIT",
"version": "0.3.11",
"version": "0.4.0",
"main": "LexicalCode.js",
"peerDependencies": {
"lexical": "0.3.11"
"lexical": "0.4.0"
},
"dependencies": {
"@lexical/utils": "0.3.11",
"@lexical/utils": "0.4.0",
"prismjs": "^1.27.0"

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

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