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

@lexical/clipboard

Package Overview
Dependencies
Maintainers
5
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/clipboard - npm Package Compare versions

Comparing version 0.2.9 to 0.3.0

1

LexicalClipboard.d.ts

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

export function $getHtmlContent(editor: LexicalEditor): string;
export function $getLexicalContent(editor: LexicalEditor): string;

@@ -30,0 +29,0 @@ /*

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

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

@@ -20,5 +20,3 @@ var lexical = require('lexical');

*
*
*/
const IGNORE_TAGS = new Set(['STYLE']);
function $getHtmlContent(editor) {

@@ -36,168 +34,4 @@ const selection = lexical.$getSelection();

return $convertSelectedContentToHtml(editor, selection);
return html.$generateHtmlFromNodes(editor, selection);
}
function $appendSelectedNodesToHTML(editor, selection$1, currentNode, parentElement) {
let shouldInclude = currentNode.isSelected();
const shouldExclude = lexical.$isElementNode(currentNode) && currentNode.excludeFromCopy('html');
let clone = selection.$cloneWithProperties(currentNode);
clone = lexical.$isTextNode(clone) ? $splitClonedTextNode(selection$1, clone) : clone;
const children = lexical.$isElementNode(clone) ? clone.getChildren() : [];
const {
element,
after
} = clone.exportDOM(editor);
if (!element) {
return false;
}
const fragment = new DocumentFragment();
for (let i = 0; i < children.length; i++) {
const childNode = children[i];
const shouldIncludeChild = $appendSelectedNodesToHTML(editor, selection$1, childNode, fragment);
if (!shouldInclude && lexical.$isElementNode(currentNode) && shouldIncludeChild && currentNode.extractWithChild(childNode, selection$1, 'html')) {
shouldInclude = true;
}
}
if (shouldInclude && !shouldExclude) {
element.append(fragment);
parentElement.append(element);
if (after) {
const newElement = after.call(clone, element);
if (newElement) element.replaceWith(newElement);
}
} else {
parentElement.append(fragment);
}
return shouldInclude;
}
function $convertSelectedContentToHtml(editor, selection) {
const container = document.createElement('div');
const root = lexical.$getRoot();
const topLevelChildren = root.getChildren();
for (let i = 0; i < topLevelChildren.length; i++) {
const topLevelNode = topLevelChildren[i];
$appendSelectedNodesToHTML(editor, selection, topLevelNode, container);
}
return container.innerHTML;
}
function $appendSelectedNodesToClone(editor, selection$1, currentNode, nodeMap, range, shouldIncludeInRange = true) {
let shouldInclude = currentNode.isSelected();
const shouldExclude = lexical.$isElementNode(currentNode) && currentNode.excludeFromCopy('clone');
let clone = selection.$cloneWithProperties(currentNode);
clone = lexical.$isTextNode(clone) ? $splitClonedTextNode(selection$1, clone) : clone;
const children = lexical.$isElementNode(clone) ? clone.getChildren() : [];
const nodeKeys = [];
let shouldIncludeChildrenInRange = shouldIncludeInRange;
if (shouldInclude && !shouldExclude) {
nodeMap.set(clone.getKey(), clone);
if (shouldIncludeInRange) {
shouldIncludeChildrenInRange = false;
}
}
for (let i = 0; i < children.length; i++) {
const childNode = children[i];
const childNodeKeys = $appendSelectedNodesToClone(editor, selection$1, childNode, nodeMap, range, shouldIncludeChildrenInRange);
for (let j = 0; j < childNodeKeys.length; j++) {
const childNodeKey = childNodeKeys[j];
nodeKeys.push(childNodeKey);
}
if (!shouldInclude && lexical.$isElementNode(currentNode) && nodeKeys.includes(childNode.getKey()) && currentNode.extractWithChild(childNode, selection$1, 'clone')) {
shouldInclude = true;
}
} // The tree is later built using $generateNodes which works
// by going through the nodes specified in the "range" & their children
// while filtering out nodes not found in the "nodeMap".
// This gets complicated when we want to "exclude" a node but
// keep it's children i.e. a MarkNode and it's Text children.
// The solution is to check if there's a cloned parent already in our map and
// splice the current node's children into the nearest parent.
// If there is no parent in the map already, the children will be added to the
// top level range be default.
if (lexical.$isElementNode(clone) && shouldExclude && shouldInclude) {
let nearestClonedParent;
let idxWithinClonedParent;
let prev = clone;
let curr = clone.getParent();
const root = lexical.$getRoot();
while (curr != null && !curr.is(root)) {
if (nodeMap.has(curr.getKey()) || curr.extractWithChild(currentNode, selection$1, 'clone')) {
nearestClonedParent = selection.$cloneWithProperties(curr);
idxWithinClonedParent = prev.getIndexWithinParent();
nodeMap.set(nearestClonedParent.getKey(), nearestClonedParent);
break;
}
prev = curr;
curr = curr.getParent();
} // Add children to nearest cloned parent at the correct position.
if (lexical.$isElementNode(nearestClonedParent) && idxWithinClonedParent != null) {
nearestClonedParent.__children.splice(idxWithinClonedParent, 1, ...clone.__children);
}
}
if (shouldInclude && !shouldExclude) {
if (!nodeMap.has(clone.getKey())) {
nodeMap.set(clone.getKey(), clone);
}
if (shouldIncludeInRange) {
return [clone.getKey()];
}
}
return shouldIncludeChildrenInRange ? nodeKeys : [];
}
function $cloneSelectedContent(editor, selection) {
const root = lexical.$getRoot();
const nodeMap = new Map();
const range = [];
const topLevelChildren = root.getChildren();
for (let i = 0; i < topLevelChildren.length; i++) {
const topLevelNode = topLevelChildren[i];
const childNodeKeys = $appendSelectedNodesToClone(editor, selection, topLevelNode, nodeMap, range, true);
for (let j = 0; j < childNodeKeys.length; j++) {
const childNodeKey = childNodeKeys[j];
range.push(childNodeKey);
}
}
return {
nodeMap: Array.from(nodeMap),
range
};
}
function $getLexicalContent(editor) {
const selection = lexical.$getSelection();
if (selection !== null) {
const namespace = editor._config.namespace;
const state = $cloneSelectedContent(editor, selection);
return JSON.stringify({
namespace,
state
});
}
return null;
}
function $insertDataTransferForPlainText(dataTransfer, selection) {

@@ -211,27 +45,3 @@ const text = dataTransfer.getData('text/plain');

function $insertDataTransferForRichText(dataTransfer, selection, editor) {
const lexicalNodesString = dataTransfer.getData('application/x-lexical-editor');
const isSelectionInsideOfGrid = lexical.$isGridSelection(selection) || utils.$findMatchingParent(selection.anchor.getNode(), n => lexical.$isGridCellNode(n)) !== null && utils.$findMatchingParent(selection.focus.getNode(), n => lexical.$isGridCellNode(n)) !== null;
if (lexicalNodesString) {
const namespace = editor._config.namespace;
try {
const lexicalClipboardData = JSON.parse(lexicalNodesString);
if (lexicalClipboardData.namespace === namespace) {
const nodeRange = lexicalClipboardData.state;
const nodes = $generateNodes(nodeRange);
if (isSelectionInsideOfGrid && nodes.length === 1 && lexical.$isGridNode(nodes[0])) {
$mergeGridNodesStrategy(nodes, selection, false, editor);
return;
}
$basicInsertStrategy(nodes, selection, true);
return;
}
} catch (e) {// Malformed, missing nodes..
}
}
const textHtmlMimeType = 'text/html';

@@ -243,3 +53,3 @@ const htmlString = dataTransfer.getData(textHtmlMimeType);

const dom = parser.parseFromString(htmlString, textHtmlMimeType);
const nodes = $generateNodesFromDOM(dom, editor);
const nodes = html.$generateNodesFromDOM(editor, dom);

@@ -269,3 +79,3 @@ if (isSelectionInsideOfGrid && nodes.length === 1 && lexical.$isGridNode(nodes[0])) {

if (!lexical.$isElementNode(node) || node.isInline()) {
if (lexical.$isDecoratorNode(node) && !node.isTopLevel() || lexical.$isElementNode(node) && node.isInline() || lexical.$isTextNode(node) || lexical.$isLineBreakNode(node)) {
if (currentBlock === null) {

@@ -405,173 +215,8 @@ currentBlock = lexical.$createParagraphNode();

lexical.$setSelection(newGridSelection);
editor.dispatchCommand(lexical.SELECTION_CHANGE_COMMAND);
editor.dispatchCommand(lexical.SELECTION_CHANGE_COMMAND, undefined);
}
}
function $generateNodes(nodeRange) {
const {
range,
nodeMap
} = nodeRange;
const parsedNodeMap = new Map(nodeMap);
const nodes = [];
for (let i = 0; i < range.length; i++) {
const key = range[i];
const parsedNode = parsedNodeMap.get(key);
if (parsedNode !== undefined) {
const node = lexical.$createNodeFromParse(parsedNode, parsedNodeMap);
nodes.push(node);
}
}
return nodes;
}
function getConversionFunction(domNode, editor) {
const {
nodeName
} = domNode;
const cachedConversions = editor._htmlConversions.get(nodeName.toLowerCase());
let currentConversion = null;
if (cachedConversions !== undefined) {
cachedConversions.forEach(cachedConversion => {
const domConversion = cachedConversion(domNode);
if (domConversion !== null) {
if (currentConversion === null || currentConversion.priority < domConversion.priority) {
currentConversion = domConversion;
}
}
});
}
return currentConversion !== null ? currentConversion.conversion : null;
}
function $createNodesFromDOM(node, editor, forChildMap = new Map(), parentLexicalNode) {
let lexicalNodes = [];
if (IGNORE_TAGS.has(node.nodeName)) {
return lexicalNodes;
}
let currentLexicalNode = null;
const transformFunction = getConversionFunction(node, editor);
const transformOutput = transformFunction ? transformFunction(node) : null;
let postTransform = null;
if (transformOutput !== null) {
postTransform = transformOutput.after;
currentLexicalNode = transformOutput.node;
if (currentLexicalNode !== null) {
for (const [, forChildFunction] of forChildMap) {
currentLexicalNode = forChildFunction(currentLexicalNode, parentLexicalNode);
if (!currentLexicalNode) {
break;
}
}
if (currentLexicalNode) {
lexicalNodes.push(currentLexicalNode);
}
}
if (transformOutput.forChild != null) {
forChildMap.set(node.nodeName, transformOutput.forChild);
}
} // If the DOM node doesn't have a transformer, we don't know what
// to do with it but we still need to process any childNodes.
const children = node.childNodes;
let childLexicalNodes = [];
for (let i = 0; i < children.length; i++) {
childLexicalNodes.push(...$createNodesFromDOM(children[i], editor, forChildMap, currentLexicalNode));
}
if (postTransform != null) {
childLexicalNodes = postTransform(childLexicalNodes);
}
if (currentLexicalNode == null) {
// If it hasn't been converted to a LexicalNode, we hoist its children
// up to the same level as it.
lexicalNodes = lexicalNodes.concat(childLexicalNodes);
} else {
if (lexical.$isElementNode(currentLexicalNode)) {
// If the current node is a ElementNode after conversion,
// we can append all the children to it.
currentLexicalNode.append(...childLexicalNodes);
}
}
return lexicalNodes;
}
function $generateNodesFromDOM(dom, editor) {
let lexicalNodes = [];
const elements = dom.body ? Array.from(dom.body.childNodes) : [];
const elementsLength = elements.length;
for (let i = 0; i < elementsLength; i++) {
const element = elements[i];
if (!IGNORE_TAGS.has(element.nodeName)) {
const lexicalNode = $createNodesFromDOM(element, editor);
if (lexicalNode !== null) {
lexicalNodes = lexicalNodes.concat(lexicalNode);
}
}
}
return lexicalNodes;
}
function $splitClonedTextNode(selection, clone) {
if (clone.isSelected() && !clone.isSegmented() && !clone.isToken() && (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection))) {
const anchorNode = selection.anchor.getNode();
const focusNode = selection.focus.getNode();
const isAnchor = clone.is(anchorNode);
const isFocus = clone.is(focusNode);
if (isAnchor || isFocus) {
const isBackward = selection.isBackward();
const [anchorOffset, focusOffset] = selection.getCharacterOffsets();
const isSame = anchorNode.is(focusNode);
const isFirst = clone.is(isBackward ? focusNode : anchorNode);
const isLast = clone.is(isBackward ? anchorNode : focusNode);
let startOffset = 0;
let endOffset = undefined;
if (isSame) {
startOffset = anchorOffset > focusOffset ? focusOffset : anchorOffset;
endOffset = anchorOffset > focusOffset ? anchorOffset : focusOffset;
} else if (isFirst) {
const offset = isBackward ? focusOffset : anchorOffset;
startOffset = offset;
endOffset = undefined;
} else if (isLast) {
const offset = isBackward ? anchorOffset : focusOffset;
startOffset = 0;
endOffset = offset;
}
clone.__text = clone.__text.slice(startOffset, endOffset);
return clone;
}
}
return clone;
}
exports.$getHtmlContent = $getHtmlContent;
exports.$getLexicalContent = $getLexicalContent;
exports.$insertDataTransferForPlainText = $insertDataTransferForPlainText;
exports.$insertDataTransferForRichText = $insertDataTransferForRichText;

22

LexicalClipboard.prod.js

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

*/
var h=require("@lexical/selection"),u=require("@lexical/utils"),v=require("lexical");function z(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}const A=new Set(["STYLE"]);
function B(a,c,d,e){let b=d.isSelected();const f=v.$isElementNode(d)&&d.excludeFromCopy("html");let g=h.$cloneWithProperties(d);g=v.$isTextNode(g)?C(c,g):g;const l=v.$isElementNode(g)?g.getChildren():[],{element:k,after:q}=g.exportDOM(a);if(!k)return!1;const r=new DocumentFragment;for(let p=0;p<l.length;p++){const n=l[p],m=B(a,c,n,r);!b&&v.$isElementNode(d)&&m&&d.extractWithChild(n,c,"html")&&(b=!0)}b&&!f?(k.append(r),e.append(k),q&&(a=q.call(g,k))&&k.replaceWith(a)):e.append(r);return b}
function D(a,c,d,e,b,f=!0){let g=d.isSelected();const l=v.$isElementNode(d)&&d.excludeFromCopy("clone");let k=h.$cloneWithProperties(d);k=v.$isTextNode(k)?C(c,k):k;var q=v.$isElementNode(k)?k.getChildren():[];const r=[];let p=f;g&&!l&&(e.set(k.getKey(),k),f&&(p=!1));for(let n=0;n<q.length;n++){const m=q[n],w=D(a,c,m,e,b,p);for(let t=0;t<w.length;t++)r.push(w[t]);!g&&v.$isElementNode(d)&&r.includes(m.getKey())&&d.extractWithChild(m,c,"clone")&&(g=!0)}if(v.$isElementNode(k)&&l&&g){let n,m;a=k;b=k.getParent();
for(q=v.$getRoot();null!=b&&!b.is(q);){if(e.has(b.getKey())||b.extractWithChild(d,c,"clone")){n=h.$cloneWithProperties(b);m=a.getIndexWithinParent();e.set(n.getKey(),n);break}a=b;b=b.getParent()}v.$isElementNode(n)&&null!=m&&n.__children.splice(m,1,...k.__children)}return g&&!l&&(e.has(k.getKey())||e.set(k.getKey(),k),f)?[k.getKey()]:p?r:[]}function E(a,c){a=a.getData("text/plain");null!=a&&c.insertRawText(a)}
function F(a,c,d){if(!d){d=[];let e=null;for(let b=0;b<a.length;b++){const f=a[b];!v.$isElementNode(f)||f.isInline()?(null===e&&(e=v.$createParagraphNode(),d.push(e)),null!==e&&e.append(f)):(d.push(f),e=null)}a=d}v.$isRangeSelection(c)?c.insertNodes(a):v.$isGridSelection(c)&&(c=c.anchor.getNode(),v.$isGridCellNode(c)||z(15),c.append(...a))}
function G(a,c,d,e){1===a.length&&v.$isGridNode(a[0])||z(16);var b=a[0];a=b.getChildren();d=b.getFirstChildOrThrow().getChildrenSize();var f=b.getChildrenSize(),g=u.$findMatchingParent(c.anchor.getNode(),m=>v.$isGridCellNode(m));c=(b=g&&u.$findMatchingParent(g,m=>v.$isGridRowNode(m)))&&u.$findMatchingParent(b,m=>v.$isGridNode(m));v.$isGridCellNode(g)&&v.$isGridRowNode(b)&&v.$isGridNode(c)||z(17);var l=b.getIndexWithinParent(),k=Math.min(c.getChildrenSize()-1,l+f-1);f=g.getIndexWithinParent();g=Math.min(b.getChildrenSize()-
1,f+d-1);d=Math.min(f,g);b=Math.min(l,k);f=Math.max(f,g);l=Math.max(l,k);k=c.getChildren();g=0;let q,r;for(let m=b;m<=l;m++){var p=k[m];v.$isGridRowNode(p)||z(18);var n=a[g];v.$isGridRowNode(n)||z(18);p=p.getChildren();n=n.getChildren();let w=0;for(let t=d;t<=f;t++){const x=p[t];v.$isGridCellNode(x)||z(19);const H=n[w];v.$isGridCellNode(H)||z(19);m===b&&t===d?q=x.getKey():m===l&&t===f&&(r=x.getKey());const J=x.getChildren();H.getChildren().forEach(y=>{v.$isTextNode(y)&&v.$createParagraphNode().append(y);
x.append(y)});J.forEach(y=>y.remove());w++}g++}q&&r&&(a=v.$createGridSelection(),a.set(c.getKey(),q,r),v.$setSelection(a),e.dispatchCommand(v.SELECTION_CHANGE_COMMAND))}function I(a){const {range:c,nodeMap:d}=a;a=new Map(d);const e=[];for(let f=0;f<c.length;f++){var b=a.get(c[f]);void 0!==b&&(b=v.$createNodeFromParse(b,a),e.push(b))}return e}
function K(a,c){const {nodeName:d}=a;c=c._htmlConversions.get(d.toLowerCase());let e=null;void 0!==c&&c.forEach(b=>{b=b(a);null!==b&&(null===e||e.priority<b.priority)&&(e=b)});return null!==e?e.conversion:null}
function L(a,c,d=new Map,e){let b=[];if(A.has(a.nodeName))return b;let f=null;var g=K(a,c);const l=g?g(a):null;g=null;if(null!==l){g=l.after;f=l.node;if(null!==f){for(var [,k]of d)if(f=k(f,e),!f)break;f&&b.push(f)}null!=l.forChild&&d.set(a.nodeName,l.forChild)}a=a.childNodes;e=[];for(k=0;k<a.length;k++)e.push(...L(a[k],c,d,f));null!=g&&(e=g(e));null==f?b=b.concat(e):v.$isElementNode(f)&&f.append(...e);return b}
function M(a,c){let d=[];a=a.body?Array.from(a.body.childNodes):[];const e=a.length;for(let f=0;f<e;f++){var b=a[f];A.has(b.nodeName)||(b=L(b,c),null!==b&&(d=d.concat(b)))}return d}
function C(a,c){if(c.isSelected()&&!c.isSegmented()&&!c.isToken()&&(v.$isRangeSelection(a)||v.$isGridSelection(a))){var d=a.anchor.getNode(),e=a.focus.getNode(),b=c.is(d),f=c.is(e);if(b||f){b=a.isBackward();const [g,l]=a.getCharacterOffsets();a=d.is(e);f=c.is(b?e:d);e=c.is(b?d:e);d=0;let k=void 0;a?(d=g>l?l:g,k=g>l?g:l):f?(d=b?l:g,k=void 0):e&&(b=b?g:l,d=0,k=b);c.__text=c.__text.slice(d,k)}}return c}
exports.$getHtmlContent=function(a){const c=v.$getSelection();if(null==c)throw Error("Expected valid LexicalSelection");if(v.$isRangeSelection(c)&&c.isCollapsed()||0===c.getNodes().length)return null;const d=document.createElement("div"),e=v.$getRoot().getChildren();for(let b=0;b<e.length;b++)B(a,c,e[b],d);return d.innerHTML};
exports.$getLexicalContent=function(a){const c=v.$getSelection();if(null!==c){const e=a._config.namespace;var d=v.$getRoot();const b=new Map,f=[];d=d.getChildren();for(let g=0;g<d.length;g++){const l=D(a,c,d[g],b,f,!0);for(let k=0;k<l.length;k++)f.push(l[k])}a={nodeMap:Array.from(b),range:f};return JSON.stringify({namespace:e,state:a})}return null};exports.$insertDataTransferForPlainText=E;
exports.$insertDataTransferForRichText=function(a,c,d){var e=a.getData("application/x-lexical-editor");const b=v.$isGridSelection(c)||null!==u.$findMatchingParent(c.anchor.getNode(),f=>v.$isGridCellNode(f))&&null!==u.$findMatchingParent(c.focus.getNode(),f=>v.$isGridCellNode(f));if(e){const f=d._config.namespace;try{const g=JSON.parse(e);if(g.namespace===f){const l=I(g.state);if(b&&1===l.length&&v.$isGridNode(l[0])){G(l,c,!1,d);return}F(l,c,!0);return}}catch(g){}}(e=a.getData("text/html"))?(a=(new DOMParser).parseFromString(e,
"text/html"),a=M(a,d),b&&1===a.length&&v.$isGridNode(a[0])?G(a,c,!1,d):F(a,c,!1)):E(a,c)};
'use strict';var b=require("@lexical/html"),l=require("@lexical/utils"),n=require("lexical");function y(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}function z(a,c){a=a.getData("text/plain");null!=a&&c.insertRawText(a)}
function C(a,c,f){if(!f){f=[];let h=null;for(let e=0;e<a.length;e++){let d=a[e];n.$isDecoratorNode(d)&&!d.isTopLevel()||n.$isElementNode(d)&&d.isInline()||n.$isTextNode(d)||n.$isLineBreakNode(d)?(null===h&&(h=n.$createParagraphNode(),f.push(h)),null!==h&&h.append(d)):(f.push(d),h=null)}a=f}n.$isRangeSelection(c)?c.insertNodes(a):n.$isGridSelection(c)&&(c=c.anchor.getNode(),n.$isGridCellNode(c)||y(41),c.append(...a))}
function D(a,c,f,h){1===a.length&&n.$isGridNode(a[0])||y(42);var e=a[0];a=e.getChildren();f=e.getFirstChildOrThrow().getChildrenSize();var d=e.getChildrenSize(),k=l.$findMatchingParent(c.anchor.getNode(),g=>n.$isGridCellNode(g));c=(e=k&&l.$findMatchingParent(k,g=>n.$isGridRowNode(g)))&&l.$findMatchingParent(e,g=>n.$isGridNode(g));n.$isGridCellNode(k)&&n.$isGridRowNode(e)&&n.$isGridNode(c)||y(43);var m=e.getIndexWithinParent(),t=Math.min(c.getChildrenSize()-1,m+d-1);d=k.getIndexWithinParent();k=Math.min(e.getChildrenSize()-
1,d+f-1);f=Math.min(d,k);e=Math.min(m,t);d=Math.max(d,k);m=Math.max(m,t);t=c.getChildren();k=0;let w,x;for(let g=e;g<=m;g++){var u=t[g];n.$isGridRowNode(u)||y(24);var v=a[k];n.$isGridRowNode(v)||y(24);u=u.getChildren();v=v.getChildren();let A=0;for(let p=f;p<=d;p++){let q=u[p];n.$isGridCellNode(q)||y(25);let B=v[A];n.$isGridCellNode(B)||y(25);g===e&&p===f?w=q.getKey():g===m&&p===d&&(x=q.getKey());let E=q.getChildren();B.getChildren().forEach(r=>{n.$isTextNode(r)&&n.$createParagraphNode().append(r);
q.append(r)});E.forEach(r=>r.remove());A++}k++}w&&x&&(a=n.$createGridSelection(),a.set(c.getKey(),w,x),n.$setSelection(a),h.dispatchCommand(n.SELECTION_CHANGE_COMMAND,void 0))}exports.$getHtmlContent=function(a){let c=n.$getSelection();if(null==c)throw Error("Expected valid LexicalSelection");return n.$isRangeSelection(c)&&c.isCollapsed()||0===c.getNodes().length?null:b.$generateHtmlFromNodes(a,c)};exports.$insertDataTransferForPlainText=z;
exports.$insertDataTransferForRichText=function(a,c,f){let h=n.$isGridSelection(c)||null!==l.$findMatchingParent(c.anchor.getNode(),d=>n.$isGridCellNode(d))&&null!==l.$findMatchingParent(c.focus.getNode(),d=>n.$isGridCellNode(d)),e=a.getData("text/html");e?(a=(new DOMParser).parseFromString(e,"text/html"),a=b.$generateNodesFromDOM(f,a),h&&1===a.length&&n.$isGridNode(a[0])?D(a,c,!1,f):C(a,c,!1)):z(a,c)}

@@ -12,10 +12,11 @@ {

"license": "MIT",
"version": "0.2.9",
"version": "0.3.0",
"main": "LexicalClipboard.js",
"peerDependencies": {
"lexical": "0.2.9"
"lexical": "0.3.0"
},
"dependencies": {
"@lexical/utils": "0.2.9",
"@lexical/selection": "0.2.9"
"@lexical/utils": "0.3.0",
"@lexical/selection": "0.3.0",
"@lexical/html": "0.3.0"
},

@@ -22,0 +23,0 @@ "repository": {

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