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

lexical

Package Overview
Dependencies
Maintainers
3
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lexical - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

24

Lexical.d.ts

@@ -100,3 +100,3 @@ /**

): () => void;
addTransform<T extends LexicalNode>(
addNodeTransform<T extends LexicalNode>(
klass: Class<T>,

@@ -148,13 +148,5 @@ listener: Transform<T>,

ul?: EditorThemeClassName;
ul1?: EditorThemeClassName;
ul2?: EditorThemeClassName;
ul3?: EditorThemeClassName;
ul4?: EditorThemeClassName;
ul5?: EditorThemeClassName;
ulDepth?: Array<EditorThemeClassName>;
ol?: EditorThemeClassName;
ol1?: EditorThemeClassName;
ol2?: EditorThemeClassName;
ol3?: EditorThemeClassName;
ol4?: EditorThemeClassName;
ol5?: EditorThemeClassName;
olDepth?: Array<EditorThemeClassName>;
listitem?: EditorThemeClassName;

@@ -375,6 +367,14 @@ nested?: {

}
export type GridSelectionShape = {
fromX: number;
fromY: number;
toX: number;
toY: number;
};
export declare class GridSelection {
gridKey: NodeKey;
anchorCellKey: NodeKey;
anchor: PointType;
focusCellKey: NodeKey;
focus: PointType;
dirty: boolean;

@@ -386,4 +386,6 @@ constructor(gridKey: NodeKey, anchorCellKey: NodeKey, focusCellKey: NodeKey);

extract(): Array<LexicalNode>;
isCollapsed(): boolean;
insertRawText(): void;
insertText(): void;
getShape(): GridSelectionShape;
getNodes(): Array<LexicalNode>;

@@ -390,0 +392,0 @@ getTextContent(): string;

@@ -9,26 +9,6 @@ /**

var utils = require('@lexical/utils');
var lexical = require('lexical');
/**
* 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.
*
*
*/
function addClassNamesToElement(element, ...classNames) {
classNames.forEach(className => {
if (className != null && typeof className === 'string') {
element.classList.add(...className.split(' '));
}
});
}
function removeClassNamesFromElement(element, ...classNames) {
classNames.forEach(className => {
element.classList.remove(...className.split(' '));
});
}
/**
* Copyright (c) Facebook, Inc. and its affiliates.

@@ -58,3 +38,3 @@ *

const className = getHighlightThemeClass(config.theme, this.__highlightType);
addClassNamesToElement(element, className);
utils.addClassNamesToElement(element, className);
return element;

@@ -71,7 +51,7 @@ }

if (prevClassName) {
removeClassNamesFromElement(dom, prevClassName);
utils.removeClassNamesFromElement(dom, prevClassName);
}
if (nextClassName) {
addClassNamesToElement(dom, nextClassName);
utils.addClassNamesToElement(dom, nextClassName);
}

@@ -78,0 +58,0 @@ }

@@ -7,4 +7,4 @@ /**

*/
var d=require("lexical");function e(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}function f(a,...b){b.forEach(c=>{a.classList.remove(...c.split(" "))})}
class g extends d.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new g(a.__text,a.__highlightType||void 0,a.__key)}createDOM(a){const b=super.createDOM(a);a=h(a.theme,this.__highlightType);e(b,a);return b}updateDOM(a,b,c){const k=super.updateDOM(a,b,c);a=h(c.theme,a.__highlightType);c=h(c.theme,this.__highlightType);a!==c&&(a&&f(b,a),c&&e(b,c));return k}setFormat(){return this.getWritable()}}
function h(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}exports.$createCodeHighlightNode=function(a,b){return new g(a,b)};exports.$isCodeHighlightNode=function(a){return a instanceof g};exports.CodeHighlightNode=g;
var d=require("@lexical/utils"),e=require("lexical");
class f extends e.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new f(a.__text,a.__highlightType||void 0,a.__key)}createDOM(a){const b=super.createDOM(a);a=g(a.theme,this.__highlightType);d.addClassNamesToElement(b,a);return b}updateDOM(a,b,c){const h=super.updateDOM(a,b,c);a=g(c.theme,a.__highlightType);c=g(c.theme,this.__highlightType);a!==c&&(a&&d.removeClassNamesFromElement(b,a),c&&d.addClassNamesToElement(b,c));return h}setFormat(){return this.getWritable()}}
function g(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}exports.$createCodeHighlightNode=function(a,b){return new f(a,b)};exports.$isCodeHighlightNode=function(a){return a instanceof f};exports.CodeHighlightNode=f;

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

var utils = require('@lexical/utils');
var lexical = require('lexical');

@@ -21,18 +22,2 @@ var CodeHighlightNode = require('lexical/CodeHighlightNode');

*/
function addClassNamesToElement(element, ...classNames) {
classNames.forEach(className => {
if (className != null && typeof className === 'string') {
element.classList.add(...className.split(' '));
}
});
}
/**
* 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.
*
*
*/
class CodeNode extends lexical.ElementNode {

@@ -55,3 +40,3 @@ static getType() {

const element = document.createElement('code');
addClassNamesToElement(element, config.theme.code);
utils.addClassNamesToElement(element, config.theme.code);
element.setAttribute('spellcheck', 'false');

@@ -58,0 +43,0 @@ return element;

@@ -7,7 +7,7 @@ /**

*/
var d=require("lexical"),f=require("lexical/CodeHighlightNode");function g(a,...c){c.forEach(b=>{null!=b&&"string"===typeof b&&a.classList.add(...b.split(" "))})}
class h extends d.ElementNode{static getType(){return"code"}static clone(a){return new h(a.__language,a.__key)}constructor(a,c){super(c);this.__language=a}createDOM(a){const c=document.createElement("code");g(c,a.theme.code);c.setAttribute("spellcheck","false");return c}updateDOM(){return!1}static convertDOM(){return{div:()=>({conversion:k,priority:1}),pre:()=>({conversion:l,priority:0}),table:a=>a.classList.contains("js-file-line-container")?{conversion:m,priority:1}:null,td:a=>a.classList.contains("js-file-line")?
{conversion:n,priority:1}:null}}insertNewAfter(a){var c=this.getChildren(),b=c.length;if(2<=b&&"\n"===c[b-1].getTextContent()&&"\n"===c[b-2].getTextContent()&&a.isCollapsed()&&a.anchor.key===this.__key&&a.anchor.offset===b)return c[b-1].remove(),c[b-2].remove(),a=d.$createParagraphNode(),this.insertAfter(a),a;c=a.anchor.getNode();var e=p(c);if(null!=e){b=0;for(e=e.getTextContent();b<e.length&&/[\t ]/.test(e[b]);)b+=1;if(0<b)return b=e.substring(0,b),b=f.$createCodeHighlightNode(b),c.insertAfter(b),
a.insertNodes([d.$createLineBreakNode()]),b.select(),b}return null}canInsertTab(){return!0}collapseAtStart(){const a=d.$createParagraphNode();this.getChildren().forEach(c=>a.append(c));this.replace(a);return!0}setLanguage(a){this.getWritable().__language=a}getLanguage(){return this.getLatest().__language}}function q(a){return new h(a)}function p(a){let c=null;const b=a.getPreviousSiblings();for(b.push(a);0<b.length&&(a=b.pop(),f.$isCodeHighlightNode(a)&&(c=a),!d.$isLineBreakNode(a)););return c}
function l(){return{node:q()}}function k(a){return{after:c=>{const b=a.parentNode;null!=b&&a!==b.lastChild&&c.push(d.$createLineBreakNode());return c},node:null!==a.style.fontFamily.match("monospace")?q():null}}function m(){return{node:q()}}function n(a){return{after:c=>{a.parentNode&&a.parentNode.nextSibling&&c.push(d.$createLineBreakNode());return c},node:null}}exports.$createCodeNode=q;exports.$isCodeNode=function(a){return a instanceof h};exports.CodeNode=h;
exports.getFirstCodeHighlightNodeOfLine=p;exports.getLastCodeHighlightNodeOfLine=function(a){let c=null;const b=a.getNextSiblings();for(b.unshift(a);0<b.length&&(a=b.shift(),f.$isCodeHighlightNode(a)&&(c=a),!d.$isLineBreakNode(a)););return c};
var d=require("@lexical/utils"),f=require("lexical"),g=require("lexical/CodeHighlightNode");
class h extends f.ElementNode{static getType(){return"code"}static clone(a){return new h(a.__language,a.__key)}constructor(a,c){super(c);this.__language=a}createDOM(a){const c=document.createElement("code");d.addClassNamesToElement(c,a.theme.code);c.setAttribute("spellcheck","false");return c}updateDOM(){return!1}static convertDOM(){return{div:()=>({conversion:k,priority:1}),pre:()=>({conversion:l,priority:0}),table:a=>a.classList.contains("js-file-line-container")?{conversion:m,priority:1}:null,
td:a=>a.classList.contains("js-file-line")?{conversion:n,priority:1}:null}}insertNewAfter(a){var c=this.getChildren(),b=c.length;if(2<=b&&"\n"===c[b-1].getTextContent()&&"\n"===c[b-2].getTextContent()&&a.isCollapsed()&&a.anchor.key===this.__key&&a.anchor.offset===b)return c[b-1].remove(),c[b-2].remove(),a=f.$createParagraphNode(),this.insertAfter(a),a;c=a.anchor.getNode();var e=p(c);if(null!=e){b=0;for(e=e.getTextContent();b<e.length&&/[\t ]/.test(e[b]);)b+=1;if(0<b)return b=e.substring(0,b),b=g.$createCodeHighlightNode(b),
c.insertAfter(b),a.insertNodes([f.$createLineBreakNode()]),b.select(),b}return null}canInsertTab(){return!0}collapseAtStart(){const a=f.$createParagraphNode();this.getChildren().forEach(c=>a.append(c));this.replace(a);return!0}setLanguage(a){this.getWritable().__language=a}getLanguage(){return this.getLatest().__language}}function q(a){return new h(a)}
function p(a){let c=null;const b=a.getPreviousSiblings();for(b.push(a);0<b.length&&(a=b.pop(),g.$isCodeHighlightNode(a)&&(c=a),!f.$isLineBreakNode(a)););return c}function l(){return{node:q()}}function k(a){return{after:c=>{const b=a.parentNode;null!=b&&a!==b.lastChild&&c.push(f.$createLineBreakNode());return c},node:null!==a.style.fontFamily.match("monospace")?q():null}}function m(){return{node:q()}}
function n(a){return{after:c=>{a.parentNode&&a.parentNode.nextSibling&&c.push(f.$createLineBreakNode());return c},node:null}}exports.$createCodeNode=q;exports.$isCodeNode=function(a){return a instanceof h};exports.CodeNode=h;exports.getFirstCodeHighlightNodeOfLine=p;exports.getLastCodeHighlightNodeOfLine=function(a){let c=null;const b=a.getNextSiblings();for(b.unshift(a);0<b.length&&(a=b.shift(),g.$isCodeHighlightNode(a)&&(c=a),!f.$isLineBreakNode(a)););return c};

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

var hashtag = require('@lexical/hashtag');
var list = require('@lexical/list');

@@ -15,3 +16,2 @@ var table = require('@lexical/table');

var CodeNode = require('lexical/CodeNode');
var HashtagNode = require('lexical/HashtagNode');
var HeadingNode = require('lexical/HeadingNode');

@@ -30,4 +30,4 @@ var LinkNode = require('lexical/LinkNode');

*/
const LexicalExtendedNodes = [HeadingNode.HeadingNode, list.ListNode, list.ListItemNode, QuoteNode.QuoteNode, CodeNode.CodeNode, table.TableNode, table.TableCellNode, table.TableRowNode, HashtagNode.HashtagNode, CodeHighlightNode.CodeHighlightNode, AutoLinkNode.AutoLinkNode, LinkNode.LinkNode, OverflowNode.OverflowNode];
const LexicalExtendedNodes = [HeadingNode.HeadingNode, list.ListNode, list.ListItemNode, QuoteNode.QuoteNode, CodeNode.CodeNode, table.TableNode, table.TableCellNode, table.TableRowNode, hashtag.HashtagNode, CodeHighlightNode.CodeHighlightNode, AutoLinkNode.AutoLinkNode, LinkNode.LinkNode, OverflowNode.OverflowNode];
module.exports = LexicalExtendedNodes;

@@ -7,3 +7,3 @@ /**

*/
var a=require("@lexical/list"),b=require("@lexical/table"),c=require("lexical/AutoLinkNode"),d=require("lexical/CodeHighlightNode"),e=require("lexical/CodeNode"),f=require("lexical/HashtagNode"),g=require("lexical/HeadingNode"),h=require("lexical/LinkNode"),k=require("lexical/OverflowNode"),l=require("lexical/QuoteNode");
module.exports=[g.HeadingNode,a.ListNode,a.ListItemNode,l.QuoteNode,e.CodeNode,b.TableNode,b.TableCellNode,b.TableRowNode,f.HashtagNode,d.CodeHighlightNode,c.AutoLinkNode,h.LinkNode,k.OverflowNode];
var a=require("@lexical/hashtag"),b=require("@lexical/list"),c=require("@lexical/table"),d=require("lexical/AutoLinkNode"),e=require("lexical/CodeHighlightNode"),f=require("lexical/CodeNode"),g=require("lexical/HeadingNode"),h=require("lexical/LinkNode"),k=require("lexical/OverflowNode"),l=require("lexical/QuoteNode");
module.exports=[g.HeadingNode,b.ListNode,b.ListItemNode,l.QuoteNode,f.CodeNode,c.TableNode,c.TableCellNode,c.TableRowNode,a.HashtagNode,e.CodeHighlightNode,d.AutoLinkNode,h.LinkNode,k.OverflowNode];

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

var utils = require('@lexical/utils');
var lexical = require('lexical');

@@ -20,18 +21,2 @@

*/
function addClassNamesToElement(element, ...classNames) {
classNames.forEach(className => {
if (className != null && typeof className === 'string') {
element.classList.add(...className.split(' '));
}
});
}
/**
* 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.
*
*
*/
class HeadingNode extends lexical.ElementNode {

@@ -65,3 +50,3 @@ static getType() {

const className = classNames[tag];
addClassNamesToElement(element, className);
utils.addClassNamesToElement(element, className);
}

@@ -68,0 +53,0 @@

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

*/
var d=require("lexical");function e(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}
class f extends d.ElementNode{static getType(){return"heading"}static clone(a){return new f(a.__tag,a.__key)}constructor(a,b){super(b);this.__tag=a}getTag(){return this.__tag}createDOM(a){const b=this.__tag,c=document.createElement(b);a=a.theme.heading;void 0!==a&&e(c,a[b]);return c}updateDOM(){return!1}static convertDOM(){return{h1:()=>({conversion:g,priority:0}),h2:()=>({conversion:g,priority:0}),h3:()=>({conversion:g,priority:0}),h4:()=>({conversion:g,priority:0}),h5:()=>({conversion:g,priority:0})}}insertNewAfter(){const a=
d.$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=d.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}}function g(a){a=a.nodeName.toLowerCase();let b=null;if("h1"===a||"h2"===a||"h3"===a||"h4"===a||"h5"===a)b=h(a);return{node:b}}function h(a){return new f(a)}exports.$createHeadingNode=h;exports.$isHeadingNode=function(a){return a instanceof f};exports.HeadingNode=f;
var c=require("@lexical/utils"),d=require("lexical");
class e extends d.ElementNode{static getType(){return"heading"}static clone(a){return new e(a.__tag,a.__key)}constructor(a,b){super(b);this.__tag=a}getTag(){return this.__tag}createDOM(a){const b=this.__tag,f=document.createElement(b);a=a.theme.heading;void 0!==a&&c.addClassNamesToElement(f,a[b]);return f}updateDOM(){return!1}static convertDOM(){return{h1:()=>({conversion:g,priority:0}),h2:()=>({conversion:g,priority:0}),h3:()=>({conversion:g,priority:0}),h4:()=>({conversion:g,priority:0}),h5:()=>
({conversion:g,priority:0})}}insertNewAfter(){const a=d.$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=d.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}}function g(a){a=a.nodeName.toLowerCase();let b=null;if("h1"===a||"h2"===a||"h3"===a||"h4"===a||"h5"===a)b=h(a);return{node:b}}function h(a){return new e(a)}exports.$createHeadingNode=h;
exports.$isHeadingNode=function(a){return a instanceof e};exports.HeadingNode=e;

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

var utils = require('@lexical/utils');
var lexical = require('lexical');

@@ -20,18 +21,2 @@

*/
function addClassNamesToElement(element, ...classNames) {
classNames.forEach(className => {
if (className != null && typeof className === 'string') {
element.classList.add(...className.split(' '));
}
});
}
/**
* 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.
*
*
*/
class LinkNode extends lexical.ElementNode {

@@ -54,3 +39,3 @@ static getType() {

element.href = this.__url;
addClassNamesToElement(element, config.theme.link);
utils.addClassNamesToElement(element, config.theme.link);
return element;

@@ -57,0 +42,0 @@ }

@@ -7,4 +7,4 @@ /**

*/
var d=require("lexical");function e(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}
class f extends d.ElementNode{static getType(){return"link"}static clone(a){return new f(a.__url,a.__key)}constructor(a,b){super(b);this.__url=a}createDOM(a){const b=document.createElement("a");b.href=this.__url;e(b,a.theme.link);return b}updateDOM(a,b){const c=this.__url;c!==a.__url&&(b.href=c);return!1}static convertDOM(){return{a:()=>({conversion:g,priority:1})}}getURL(){return this.getLatest().__url}setURL(a){this.getWritable().__url=a}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);
if(d.$isElementNode(a)){const b=h(this.__url);a.append(b);return b}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function g(a){let b=null;a instanceof HTMLAnchorElement&&(b=h(a.href));return{node:b}}function h(a){return new f(a)}exports.$createLinkNode=h;exports.$isLinkNode=function(a){return a instanceof f};exports.LinkNode=f;
var c=require("@lexical/utils"),d=require("lexical");
class e extends d.ElementNode{static getType(){return"link"}static clone(a){return new e(a.__url,a.__key)}constructor(a,b){super(b);this.__url=a}createDOM(a){const b=document.createElement("a");b.href=this.__url;c.addClassNamesToElement(b,a.theme.link);return b}updateDOM(a,b){const f=this.__url;f!==a.__url&&(b.href=f);return!1}static convertDOM(){return{a:()=>({conversion:g,priority:1})}}getURL(){return this.getLatest().__url}setURL(a){this.getWritable().__url=a}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);
if(d.$isElementNode(a)){const b=h(this.__url);a.append(b);return b}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function g(a){let b=null;a instanceof HTMLAnchorElement&&(b=h(a.href));return{node:b}}function h(a){return new e(a)}exports.$createLinkNode=h;exports.$isLinkNode=function(a){return a instanceof e};exports.LinkNode=e;

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

var utils = require('@lexical/utils');
var lexical = require('lexical');

@@ -20,18 +21,2 @@

*/
function addClassNamesToElement(element, ...classNames) {
classNames.forEach(className => {
if (className != null && typeof className === 'string') {
element.classList.add(...className.split(' '));
}
});
}
/**
* 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.
*
*
*/
class QuoteNode extends lexical.ElementNode {

@@ -53,3 +38,3 @@ static getType() {

const element = document.createElement('blockquote');
addClassNamesToElement(element, config.theme.quote);
utils.addClassNamesToElement(element, config.theme.quote);
return element;

@@ -56,0 +41,0 @@ }

@@ -7,4 +7,4 @@ /**

*/
var c=require("lexical");function d(a,...b){b.forEach(e=>{null!=e&&"string"===typeof e&&a.classList.add(...e.split(" "))})}
class f extends c.ElementNode{static getType(){return"quote"}static clone(a){return new f(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("blockquote");d(b,a.theme.quote);return b}updateDOM(){return!1}insertNewAfter(){const a=c.$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=c.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}}exports.$createQuoteNode=function(){return new f};
exports.$isQuoteNode=function(a){return a instanceof f};exports.QuoteNode=f;
var c=require("@lexical/utils"),d=require("lexical");
class e extends d.ElementNode{static getType(){return"quote"}static clone(a){return new e(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("blockquote");c.addClassNamesToElement(b,a.theme.quote);return b}updateDOM(){return!1}insertNewAfter(){const a=d.$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=d.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}}
exports.$createQuoteNode=function(){return new e};exports.$isQuoteNode=function(a){return a instanceof e};exports.QuoteNode=e;

@@ -16,3 +16,3 @@ {

"license": "MIT",
"version": "0.1.14",
"version": "0.1.15",
"main": "Lexical.js",

@@ -19,0 +19,0 @@ "typings": "Lexical.d.ts",

@@ -92,3 +92,3 @@ # `lexical`

- Setting the editor state via `editor.setEditorState()`
- Applying a change as part of an existing update via `editor.addTransform()`
- Applying a change as part of an existing update via `editor.addNodeTransform()`
- Using a command listener with `editor.addListener('command', () => {...}, priority)`

@@ -95,0 +95,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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