@lexical/clipboard 0.12.4 → 0.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -164,152 +164,24 @@ function $insertDataTransferForRichText(dataTransfer, selection, editor) {
164
164
  * @param selection The selection to insert the nodes into.
165
165
  */
166
166
  function $insertGeneratedNodes(editor, nodes, selection) {
167
- const isSelectionInsideOfGrid = lexical.DEPRECATED_$isGridSelection(selection) || utils.$findMatchingParent(selection.anchor.getNode(), n => lexical.DEPRECATED_$isGridCellNode(n)) !== null && utils.$findMatchingParent(selection.focus.getNode(), n => lexical.DEPRECATED_$isGridCellNode(n)) !== null;
168
- if (isSelectionInsideOfGrid && nodes.length === 1 && lexical.DEPRECATED_$isGridNode(nodes[0])) {
169
- $mergeGridNodesStrategy(nodes, selection, false, editor);
170
- return;
167
+ if (!editor.dispatchCommand(lexical.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, {
168
+ nodes,
169
+ selection
170
+ })) {
171
+ selection.insertNodes(nodes);
171
172
  }
172
- $basicInsertStrategy(nodes, selection);
173
173
  return;
174
174
  }
175
- function $basicInsertStrategy(nodes, selection) {
176
- // Wrap text and inline nodes in paragraph nodes so we have all blocks at the top-level
177
- const topLevelBlocks = [];
178
- let currentBlock = null;
179
- for (let i = 0; i < nodes.length; i++) {
180
- const node = nodes[i];
181
- const isLineBreakNode = lexical.$isLineBreakNode(node);
182
- if (isLineBreakNode || lexical.$isDecoratorNode(node) && node.isInline() || lexical.$isElementNode(node) && node.isInline() || lexical.$isTextNode(node) || node.isParentRequired()) {
183
- if (currentBlock === null) {
184
- currentBlock = node.createParentElementNode();
185
- topLevelBlocks.push(currentBlock);
186
- // In the case of LineBreakNode, we just need to
187
- // add an empty ParagraphNode to the topLevelBlocks.
188
- if (isLineBreakNode) {
189
- continue;
190
- }
191
- }
192
- if (currentBlock !== null) {
193
- currentBlock.append(node);
194
- }
195
- } else {
196
- topLevelBlocks.push(node);
197
- currentBlock = null;
198
- }
199
- }
200
- if (lexical.$isRangeSelection(selection)) {
201
- selection.insertNodes(topLevelBlocks);
202
- } else if (lexical.DEPRECATED_$isGridSelection(selection)) {
203
- // If there's an active grid selection and a non grid is pasted, add to the anchor.
204
- const anchorCell = selection.anchor.getNode();
205
- if (!lexical.DEPRECATED_$isGridCellNode(anchorCell)) {
206
- {
207
- throw Error(`Expected Grid Cell in Grid Selection`);
208
- }
209
- }
210
- anchorCell.append(...topLevelBlocks);
211
- }
212
- }
213
- function $mergeGridNodesStrategy(nodes, selection, isFromLexical, editor) {
214
- if (nodes.length !== 1 || !lexical.DEPRECATED_$isGridNode(nodes[0])) {
215
- {
216
- throw Error(`$mergeGridNodesStrategy: Expected Grid insertion.`);
217
- }
218
- }
219
- const newGrid = nodes[0];
220
- const newGridRows = newGrid.getChildren();
221
- const newColumnCount = newGrid.getFirstChildOrThrow().getChildrenSize();
222
- const newRowCount = newGrid.getChildrenSize();
223
- const gridCellNode = utils.$findMatchingParent(selection.anchor.getNode(), n => lexical.DEPRECATED_$isGridCellNode(n));
224
- const gridRowNode = gridCellNode && utils.$findMatchingParent(gridCellNode, n => lexical.DEPRECATED_$isGridRowNode(n));
225
- const gridNode = gridRowNode && utils.$findMatchingParent(gridRowNode, n => lexical.DEPRECATED_$isGridNode(n));
226
- if (!lexical.DEPRECATED_$isGridCellNode(gridCellNode) || !lexical.DEPRECATED_$isGridRowNode(gridRowNode) || !lexical.DEPRECATED_$isGridNode(gridNode)) {
227
- {
228
- throw Error(`$mergeGridNodesStrategy: Expected selection to be inside of a Grid.`);
229
- }
230
- }
231
- const startY = gridRowNode.getIndexWithinParent();
232
- const stopY = Math.min(gridNode.getChildrenSize() - 1, startY + newRowCount - 1);
233
- const startX = gridCellNode.getIndexWithinParent();
234
- const stopX = Math.min(gridRowNode.getChildrenSize() - 1, startX + newColumnCount - 1);
235
- const fromX = Math.min(startX, stopX);
236
- const fromY = Math.min(startY, stopY);
237
- const toX = Math.max(startX, stopX);
238
- const toY = Math.max(startY, stopY);
239
- const gridRowNodes = gridNode.getChildren();
240
- let newRowIdx = 0;
241
- let newAnchorCellKey;
242
- let newFocusCellKey;
243
- for (let r = fromY; r <= toY; r++) {
244
- const currentGridRowNode = gridRowNodes[r];
245
- if (!lexical.DEPRECATED_$isGridRowNode(currentGridRowNode)) {
246
- {
247
- throw Error(`getNodes: expected to find GridRowNode`);
248
- }
249
- }
250
- const newGridRowNode = newGridRows[newRowIdx];
251
- if (!lexical.DEPRECATED_$isGridRowNode(newGridRowNode)) {
252
- {
253
- throw Error(`getNodes: expected to find GridRowNode`);
254
- }
255
- }
256
- const gridCellNodes = currentGridRowNode.getChildren();
257
- const newGridCellNodes = newGridRowNode.getChildren();
258
- let newColumnIdx = 0;
259
- for (let c = fromX; c <= toX; c++) {
260
- const currentGridCellNode = gridCellNodes[c];
261
- if (!lexical.DEPRECATED_$isGridCellNode(currentGridCellNode)) {
262
- {
263
- throw Error(`getNodes: expected to find GridCellNode`);
264
- }
265
- }
266
- const newGridCellNode = newGridCellNodes[newColumnIdx];
267
- if (!lexical.DEPRECATED_$isGridCellNode(newGridCellNode)) {
268
- {
269
- throw Error(`getNodes: expected to find GridCellNode`);
270
- }
271
- }
272
- if (r === fromY && c === fromX) {
273
- newAnchorCellKey = currentGridCellNode.getKey();
274
- } else if (r === toY && c === toX) {
275
- newFocusCellKey = currentGridCellNode.getKey();
276
- }
277
- const originalChildren = currentGridCellNode.getChildren();
278
- newGridCellNode.getChildren().forEach(child => {
279
- if (lexical.$isTextNode(child)) {
280
- const paragraphNode = lexical.$createParagraphNode();
281
- paragraphNode.append(child);
282
- currentGridCellNode.append(child);
283
- } else {
284
- currentGridCellNode.append(child);
285
- }
286
- });
287
- originalChildren.forEach(n => n.remove());
288
- newColumnIdx++;
289
- }
290
- newRowIdx++;
291
- }
292
- if (newAnchorCellKey && newFocusCellKey) {
293
- const newGridSelection = lexical.DEPRECATED_$createGridSelection();
294
- newGridSelection.set(gridNode.getKey(), newAnchorCellKey, newFocusCellKey);
295
- lexical.$setSelection(newGridSelection);
296
- editor.dispatchCommand(lexical.SELECTION_CHANGE_COMMAND, undefined);
297
- }
298
- }
299
175
  function exportNodeToJSON(node) {
300
176
  const serializedNode = node.exportJSON();
301
177
  const nodeClass = node.constructor;
302
-
303
- // @ts-expect-error TODO Replace Class utility type with InstanceType
304
178
  if (serializedNode.type !== nodeClass.getType()) {
305
179
  {
306
180
  throw Error(`LexicalNode: Node ${nodeClass.name} does not implement .exportJSON().`);
307
181
  }
308
182
  }
309
-
310
- // @ts-expect-error TODO Replace Class utility type with InstanceType
311
- const serializedChildren = serializedNode.children;
312
183
  if (lexical.$isElementNode(node)) {
184
+ const serializedChildren = serializedNode.children;
313
185
  if (!Array.isArray(serializedChildren)) {
314
186
  {
315
187
  throw Error(`LexicalNode: Node ${nodeClass.name} is an element but .exportJSON() does not have a children array.`);
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  import type {
11
- GridSelection,
11
+ BaseSelection,
12
12
  LexicalEditor,
13
- NodeSelection,
13
+ INTERNAL_PointSelection,
14
14
  RangeSelection,
15
15
  LexicalNode,
16
16
  } from 'lexical';
@@ -21,7 +21,7 @@ import type {
21
21
 
22
22
  declare export function $insertDataTransferForRichText(
23
23
  dataTransfer: DataTransfer,
24
- selection: RangeSelection | GridSelection,
24
+ selection: INTERNAL_PointSelection,
25
25
  editor: LexicalEditor,
26
26
  ): void;
27
27
 
@@ -33,7 +33,7 @@ declare export function $getLexicalContent(
33
33
  declare export function $insertGeneratedNodes(
34
34
  editor: LexicalEditor,
35
35
  nodes: Array<LexicalNode>,
36
- selection: RangeSelection | GridSelection,
36
+ selection: INTERNAL_PointSelection,
37
37
  ): void;
38
38
  /*
39
39
  * Plain Text
@@ -58,7 +58,7 @@ declare export function $generateJSONFromSelectedNodes<
58
58
  SerializedNode: BaseSerializedNode,
59
59
  >(
60
60
  editor: LexicalEditor,
61
- selection: RangeSelection | NodeSelection | GridSelection | null,
61
+ selection: BaseSelection | null,
62
62
  ): {
63
63
  namespace: string,
64
64
  nodes: Array<SerializedNode>,
@@ -4,18 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var d=require("@lexical/html"),p=require("@lexical/selection"),r=require("@lexical/utils"),u=require("lexical");function z(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.");}
8
- let A="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function B(a){let b=u.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return u.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?"":d.$generateHtmlFromNodes(a,b)}
9
- function C(a){let b=u.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return u.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?null:JSON.stringify(D(a,b))}function E(a,b,c){(u.DEPRECATED_$isGridSelection(c)||null!==r.$findMatchingParent(c.anchor.getNode(),f=>u.DEPRECATED_$isGridCellNode(f))&&null!==r.$findMatchingParent(c.focus.getNode(),f=>u.DEPRECATED_$isGridCellNode(f)))&&1===b.length&&u.DEPRECATED_$isGridNode(b[0])?F(b,c,!1,a):I(b,c)}
10
- function I(a,b){let c=[],f=null;for(let e=0;e<a.length;e++){let g=a[e],h=u.$isLineBreakNode(g);if(h||u.$isDecoratorNode(g)&&g.isInline()||u.$isElementNode(g)&&g.isInline()||u.$isTextNode(g)||g.isParentRequired()){if(null===f&&(f=g.createParentElementNode(),c.push(f),h))continue;null!==f&&f.append(g)}else c.push(g),f=null}u.$isRangeSelection(b)?b.insertNodes(c):u.DEPRECATED_$isGridSelection(b)&&(a=b.anchor.getNode(),u.DEPRECATED_$isGridCellNode(a)||z(41),a.append(...c))}
11
- function F(a,b,c,f){1===a.length&&u.DEPRECATED_$isGridNode(a[0])||z(42);var e=a[0];a=e.getChildren();c=e.getFirstChildOrThrow().getChildrenSize();var g=e.getChildrenSize(),h=r.$findMatchingParent(b.anchor.getNode(),l=>u.DEPRECATED_$isGridCellNode(l));b=(e=h&&r.$findMatchingParent(h,l=>u.DEPRECATED_$isGridRowNode(l)))&&r.$findMatchingParent(e,l=>u.DEPRECATED_$isGridNode(l));u.DEPRECATED_$isGridCellNode(h)&&u.DEPRECATED_$isGridRowNode(e)&&u.DEPRECATED_$isGridNode(b)||z(43);var k=e.getIndexWithinParent(),
12
- m=Math.min(b.getChildrenSize()-1,k+g-1);g=h.getIndexWithinParent();h=Math.min(e.getChildrenSize()-1,g+c-1);c=Math.min(g,h);e=Math.min(k,m);g=Math.max(g,h);k=Math.max(k,m);m=b.getChildren();h=0;let n,q;for(let l=e;l<=k;l++){var t=m[l];u.DEPRECATED_$isGridRowNode(t)||z(24);var y=a[h];u.DEPRECATED_$isGridRowNode(y)||z(24);t=t.getChildren();y=y.getChildren();let G=0;for(let v=c;v<=g;v++){let w=t[v];u.DEPRECATED_$isGridCellNode(w)||z(25);let H=y[G];u.DEPRECATED_$isGridCellNode(H)||z(25);l===e&&v===c?n=
13
- w.getKey():l===k&&v===g&&(q=w.getKey());let N=w.getChildren();H.getChildren().forEach(x=>{u.$isTextNode(x)&&u.$createParagraphNode().append(x);w.append(x)});N.forEach(x=>x.remove());G++}h++}n&&q&&(a=u.DEPRECATED_$createGridSelection(),a.set(b.getKey(),n,q),u.$setSelection(a),f.dispatchCommand(u.SELECTION_CHANGE_COMMAND,void 0))}
14
- function J(a,b,c,f=[]){let e=null!=b?c.isSelected(b):!0,g=u.$isElementNode(c)&&c.excludeFromCopy("html");var h=c;if(null!==b){var k=p.$cloneWithProperties(c);h=k=u.$isTextNode(k)&&null!=b?p.$sliceSelectedTextNodeContent(b,k):k}let m=u.$isElementNode(h)?h.getChildren():[];var n=h;k=n.exportJSON();var q=n.constructor;k.type!==q.getType()&&z(58,q.name);let t=k.children;u.$isElementNode(n)&&(Array.isArray(t)||z(59,q.name));u.$isTextNode(h)&&(h=h.__text,0<h.length?k.text=h:e=!1);for(h=0;h<m.length;h++)n=
15
- m[h],q=J(a,b,n,k.children),!e&&u.$isElementNode(c)&&q&&c.extractWithChild(n,b,"clone")&&(e=!0);if(e&&!g)f.push(k);else if(Array.isArray(k.children))for(a=0;a<k.children.length;a++)f.push(k.children[a]);return e}function D(a,b){let c=[],f=u.$getRoot().getChildren();for(let e=0;e<f.length;e++)J(a,b,f[e],c);return{namespace:a._config.namespace,nodes:c}}function K(a){let b=[];for(let c=0;c<a.length;c++){let f=u.$parseSerializedNode(a[c]);u.$isTextNode(f)&&p.$addNodeStyle(f);b.push(f)}return b}let L=null;
16
- function M(a,b){var c=A?(a._window||window).getSelection():null;if(!c)return!1;var f=c.anchorNode;c=c.focusNode;if(null!==f&&null!==c&&!u.isSelectionWithinEditor(a,f,c))return!1;b.preventDefault();b=b.clipboardData;f=u.$getSelection();if(null===b||null===f)return!1;c=B(a);a=C(a);let e="";null!==f&&(e=f.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",e);return!0}exports.$generateJSONFromSelectedNodes=D;
17
- exports.$generateNodesFromSerializedNodes=K;exports.$getHtmlContent=B;exports.$getLexicalContent=C;exports.$insertDataTransferForPlainText=function(a,b){a=a.getData("text/plain")||a.getData("text/uri-list");null!=a&&b.insertRawText(a)};
18
- exports.$insertDataTransferForRichText=function(a,b,c){var f=a.getData("application/x-lexical-editor");if(f)try{let g=JSON.parse(f);if(g.namespace===c._config.namespace&&Array.isArray(g.nodes)){let h=K(g.nodes);return E(c,h,b)}}catch(g){}if(f=a.getData("text/html"))try{var e=(new DOMParser).parseFromString(f,"text/html");let g=d.$generateNodesFromDOM(c,e);return E(c,g,b)}catch(g){}a=a.getData("text/plain")||a.getData("text/uri-list");if(null!=a)if(u.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),
19
- ""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)e=a[c],"\n"===e||"\r\n"===e?b.insertParagraph():"\t"===e?b.insertNodes([u.$createTabNode()]):b.insertText(e);else b.insertRawText(a)};exports.$insertGeneratedNodes=E;
20
- exports.copyToClipboard=async function(a,b){if(null!==L)return!1;if(null!==b)return new Promise(h=>{a.update(()=>{h(M(a,b))})});var c=a.getRootElement();let f=null==a._window?window.document:a._window.document,e=A?(a._window||window).getSelection():null;if(null===c||null===e)return!1;let g=f.createElement("span");g.style.cssText="position: fixed; top: -1000px;";g.append(f.createTextNode("#"));c.append(g);c=new Range;c.setStart(g,0);c.setEnd(g,1);e.removeAllRanges();e.addRange(c);return new Promise(h=>
21
- {let k=a.registerCommand(u.COPY_COMMAND,m=>{r.objectKlassEquals(m,ClipboardEvent)&&(k(),null!==L&&(window.clearTimeout(L),L=null),h(M(a,m)));return!0},u.COMMAND_PRIORITY_CRITICAL);L=window.setTimeout(()=>{k();L=null;h(!1)},50);f.execCommand("copy");g.remove()})}
7
+ 'use strict';var f=require("@lexical/html"),m=require("@lexical/selection"),q=require("@lexical/utils"),r=require("lexical");function t(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.");}
8
+ let u="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function v(a){let b=r.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return r.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?"":f.$generateHtmlFromNodes(a,b)}
9
+ function w(a){let b=r.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return r.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?null:JSON.stringify(x(a,b))}function y(a,b,c){a.dispatchCommand(r.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,{nodes:b,selection:c})||c.insertNodes(b)}
10
+ function z(a,b,c,d=[]){let e=null!=b?c.isSelected(b):!0,h=r.$isElementNode(c)&&c.excludeFromCopy("html");var g=c;if(null!==b){var k=m.$cloneWithProperties(c);g=k=r.$isTextNode(k)&&null!=b?m.$sliceSelectedTextNodeContent(b,k):k}let n=r.$isElementNode(g)?g.getChildren():[];var l=g;k=l.exportJSON();var p=l.constructor;k.type!==p.getType()&&t(58,p.name);r.$isElementNode(l)&&(Array.isArray(k.children)||t(59,p.name));r.$isTextNode(g)&&(g=g.__text,0<g.length?k.text=g:e=!1);for(g=0;g<n.length;g++)l=n[g],
11
+ p=z(a,b,l,k.children),!e&&r.$isElementNode(c)&&p&&c.extractWithChild(l,b,"clone")&&(e=!0);if(e&&!h)d.push(k);else if(Array.isArray(k.children))for(a=0;a<k.children.length;a++)d.push(k.children[a]);return e}function x(a,b){let c=[],d=r.$getRoot().getChildren();for(let e=0;e<d.length;e++)z(a,b,d[e],c);return{namespace:a._config.namespace,nodes:c}}function A(a){let b=[];for(let c=0;c<a.length;c++){let d=r.$parseSerializedNode(a[c]);r.$isTextNode(d)&&m.$addNodeStyle(d);b.push(d)}return b}let B=null;
12
+ function C(a,b){var c=u?(a._window||window).getSelection():null;if(!c)return!1;var d=c.anchorNode;c=c.focusNode;if(null!==d&&null!==c&&!r.isSelectionWithinEditor(a,d,c))return!1;b.preventDefault();b=b.clipboardData;d=r.$getSelection();if(null===b||null===d)return!1;c=v(a);a=w(a);let e="";null!==d&&(e=d.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",e);return!0}exports.$generateJSONFromSelectedNodes=x;
13
+ exports.$generateNodesFromSerializedNodes=A;exports.$getHtmlContent=v;exports.$getLexicalContent=w;exports.$insertDataTransferForPlainText=function(a,b){a=a.getData("text/plain")||a.getData("text/uri-list");null!=a&&b.insertRawText(a)};
14
+ exports.$insertDataTransferForRichText=function(a,b,c){var d=a.getData("application/x-lexical-editor");if(d)try{let h=JSON.parse(d);if(h.namespace===c._config.namespace&&Array.isArray(h.nodes)){let g=A(h.nodes);return y(c,g,b)}}catch(h){}if(d=a.getData("text/html"))try{var e=(new DOMParser).parseFromString(d,"text/html");let h=f.$generateNodesFromDOM(c,e);return y(c,h,b)}catch(h){}a=a.getData("text/plain")||a.getData("text/uri-list");if(null!=a)if(r.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),
15
+ ""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)e=a[c],"\n"===e||"\r\n"===e?b.insertParagraph():"\t"===e?b.insertNodes([r.$createTabNode()]):b.insertText(e);else b.insertRawText(a)};exports.$insertGeneratedNodes=y;
16
+ exports.copyToClipboard=async function(a,b){if(null!==B)return!1;if(null!==b)return new Promise(g=>{a.update(()=>{g(C(a,b))})});var c=a.getRootElement();let d=null==a._window?window.document:a._window.document,e=u?(a._window||window).getSelection():null;if(null===c||null===e)return!1;let h=d.createElement("span");h.style.cssText="position: fixed; top: -1000px;";h.append(d.createTextNode("#"));c.append(h);c=new Range;c.setStart(h,0);c.setEnd(h,1);e.removeAllRanges();e.addRange(c);return new Promise(g=>
17
+ {let k=a.registerCommand(r.COPY_COMMAND,n=>{q.objectKlassEquals(n,ClipboardEvent)&&(k(),null!==B&&(window.clearTimeout(B),B=null),g(C(a,n)));return!0},r.COMMAND_PRIORITY_CRITICAL);B=window.setTimeout(()=>{k();B=null;g(!1)},50);d.execCommand("copy");h.remove()})}
package/clipboard.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { GridSelection, LexicalEditor, LexicalNode, NodeSelection, RangeSelection } from 'lexical';
8
+ import { BaseSelection, LexicalEditor, LexicalNode } from 'lexical';
9
9
  /**
10
10
  * Returns the *currently selected* Lexical content as an HTML string, relying on the
11
11
  * logic defined in the exportDOM methods on the LexicalNode classes. Note that
@@ -34,7 +34,7 @@ export declare function $getLexicalContent(editor: LexicalEditor): null | string
34
34
  * @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
35
35
  * @param selection the selection to use as the insertion point for the content in the DataTransfer object
36
36
  */
37
- export declare function $insertDataTransferForPlainText(dataTransfer: DataTransfer, selection: RangeSelection | GridSelection): void;
37
+ export declare function $insertDataTransferForPlainText(dataTransfer: DataTransfer, selection: BaseSelection): void;
38
38
  /**
39
39
  * Attempts to insert content of the mime-types application/x-lexical-editor, text/html,
40
40
  * text/plain, or text/uri-list (in descending order of priority) from the provided DataTransfer
@@ -44,7 +44,7 @@ export declare function $insertDataTransferForPlainText(dataTransfer: DataTransf
44
44
  * @param selection the selection to use as the insertion point for the content in the DataTransfer object
45
45
  * @param editor the LexicalEditor the content is being inserted into.
46
46
  */
47
- export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: RangeSelection | GridSelection, editor: LexicalEditor): void;
47
+ export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor): void;
48
48
  /**
49
49
  * Inserts Lexical nodes into the editor using different strategies depending on
50
50
  * some simple selection-based heuristics. If you're looking for a generic way to
@@ -55,7 +55,7 @@ export declare function $insertDataTransferForRichText(dataTransfer: DataTransfe
55
55
  * @param nodes The nodes to insert.
56
56
  * @param selection The selection to insert the nodes into.
57
57
  */
58
- export declare function $insertGeneratedNodes(editor: LexicalEditor, nodes: Array<LexicalNode>, selection: RangeSelection | GridSelection): void;
58
+ export declare function $insertGeneratedNodes(editor: LexicalEditor, nodes: Array<LexicalNode>, selection: BaseSelection): void;
59
59
  export interface BaseSerializedNode {
60
60
  children?: Array<BaseSerializedNode>;
61
61
  type: string;
@@ -68,7 +68,7 @@ export interface BaseSerializedNode {
68
68
  * @param selection Selection to get the JSON content from.
69
69
  * @returns an object with the editor namespace and a list of serializable nodes as JavaScript objects.
70
70
  */
71
- export declare function $generateJSONFromSelectedNodes<SerializedNode extends BaseSerializedNode>(editor: LexicalEditor, selection: RangeSelection | NodeSelection | GridSelection | null): {
71
+ export declare function $generateJSONFromSelectedNodes<SerializedNode extends BaseSerializedNode>(editor: LexicalEditor, selection: BaseSelection | null): {
72
72
  namespace: string;
73
73
  nodes: Array<SerializedNode>;
74
74
  };
package/package.json CHANGED
@@ -9,16 +9,16 @@
9
9
  "paste"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.12.4",
12
+ "version": "0.12.6",
13
13
  "main": "LexicalClipboard.js",
14
14
  "peerDependencies": {
15
- "lexical": "0.12.4"
15
+ "lexical": "0.12.6"
16
16
  },
17
17
  "dependencies": {
18
- "@lexical/utils": "0.12.4",
19
- "@lexical/list": "0.12.4",
20
- "@lexical/selection": "0.12.4",
21
- "@lexical/html": "0.12.4"
18
+ "@lexical/utils": "0.12.6",
19
+ "@lexical/list": "0.12.6",
20
+ "@lexical/selection": "0.12.6",
21
+ "@lexical/html": "0.12.6"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",