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

@lexical/code

Package Overview
Dependencies
Maintainers
7
Versions
194
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.8.0 to 0.8.1

2

CodeHighlighter.d.ts

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

import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-cpp';
import { TextNode } from 'lexical';

@@ -23,0 +25,0 @@ declare type TokenContent = string | Token | (string | Token)[];

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

import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-cpp';
export declare const DEFAULT_CODE_LANGUAGE = "javascript";

@@ -23,0 +25,0 @@ declare type SerializedCodeHighlightNode = Spread<{

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

import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-cpp';
import { ElementNode } from 'lexical';

@@ -24,0 +26,0 @@ export declare type SerializedCodeNode = Spread<{

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

require('prismjs/components/prism-typescript');
require('prismjs/components/prism-java');
require('prismjs/components/prism-cpp');
var utils = require('@lexical/utils');

@@ -39,3 +41,3 @@ var lexical = require('lexical');

for (const child of node.childNodes) {
if (child instanceof HTMLElement && child.tagName === tagName) {
if (utils.isHTMLElement(child) && child.tagName === tagName) {
return true;

@@ -316,4 +318,6 @@ }

clike: 'C-like',
cpp: 'C++',
css: 'CSS',
html: 'HTML',
java: 'Java',
js: 'JavaScript',

@@ -331,2 +335,4 @@ markdown: 'Markdown',

const CODE_LANGUAGE_MAP = {
cpp: 'cpp',
java: 'java',
javascript: 'js',

@@ -333,0 +339,0 @@ md: 'markdown',

4

LexicalCode.prod.js

@@ -8,3 +8,3 @@ /**

'use strict';var e=require("prismjs");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");
require("prismjs/components/prism-typescript");var n=require("@lexical/utils"),u=require("lexical");let v=a=>null!=a&&e.languages.hasOwnProperty(a)?a:void 0;function x(a,b){for(let c of a.childNodes){if(c instanceof HTMLElement&&c.tagName===b)return!0;x(c,b)}return!1}
require("prismjs/components/prism-typescript");require("prismjs/components/prism-java");require("prismjs/components/prism-cpp");var n=require("@lexical/utils"),u=require("lexical");let v=a=>null!=a&&e.languages.hasOwnProperty(a)?a:void 0;function x(a,b){for(let c of a.childNodes){if(n.isHTMLElement(c)&&c.tagName===b)return!0;x(c,b)}return!1}
class y extends u.ElementNode{static getType(){return"code"}static clone(a){return new y(a.__language,a.__key)}constructor(a,b){super(b);this.__language=v(a)}createDOM(a){let 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){let c=this.__language;a=a.__language;c?c!==a&&b.setAttribute("data-highlight-language",c):a&&b.removeAttribute("data-highlight-language");

@@ -16,3 +16,3 @@ return!1}static importDOM(){return{code:a=>null!=a.textContent&&(/\r?\n/.test(a.textContent)||x(a,"BR"))?{conversion:z,priority:1}:null,div:()=>({conversion:aa,priority:1}),pre:()=>({conversion:z,priority:0}),table:a=>A(a)?{conversion:ba,priority:3}:null,td:a=>{let b=a.closest("table");return a.classList.contains("js-file-line")?{conversion:ca,priority:3}:b&&A(b)?{conversion:B,priority:3}:null},tr:a=>(a=a.closest("table"))&&A(a)?{conversion:B,priority:3}:null}}static importJSON(a){let b=C(a.language);

function ca(a){return{after:b=>{a.parentNode&&a.parentNode.nextSibling&&b.push(u.$createLineBreakNode());return b},node:null}}function da(a){for(a=a.parentElement;null!==a;){if(null!==a.style.fontFamily.match("monospace"))return!0;a=a.parentElement}return!1}function A(a){return a.classList.contains("js-file-line-container")}
let G={c:"C",clike:"C-like",css:"CSS",html:"HTML",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},H={javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function I(a){return H[a]||a}
let G={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},H={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function I(a){return H[a]||a}
class J extends u.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new J(a.__text,a.__highlightType||void 0,a.__key)}getHighlightType(){return this.getLatest().__highlightType}createDOM(a){let b=super.createDOM(a);a=K(a.theme,this.__highlightType);n.addClassNamesToElement(b,a);return b}updateDOM(a,b,c){let d=super.updateDOM(a,b,c);a=K(c.theme,a.__highlightType);c=K(c.theme,this.__highlightType);a!==c&&(a&&n.removeClassNamesFromElement(b,

@@ -19,0 +19,0 @@ a),c&&n.addClassNamesToElement(b,c));return d}static importJSON(a){let b=E(a.text,a.highlightType);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType(),type:"code-highlight",version:1}}setFormat(){return this}isParentRequired(){return!0}createParentElementNode(){return C()}}function K(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}

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

"license": "MIT",
"version": "0.8.0",
"version": "0.8.1",
"main": "LexicalCode.js",
"peerDependencies": {
"lexical": "0.8.0"
"lexical": "0.8.1"
},
"dependencies": {
"@lexical/utils": "0.8.0",
"@lexical/utils": "0.8.1",
"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