@lexical/clipboard 0.3.2 → 0.3.5
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.
- package/LexicalClipboard.dev.js +178 -38
- package/LexicalClipboard.js.flow +5 -3
- package/LexicalClipboard.prod.js +11 -6
- package/clipboard.d.ts +23 -0
- package/index.d.ts +9 -0
- package/package.json +5 -5
- package/LexicalClipboard.d.ts +0 -35
package/LexicalClipboard.dev.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var html = require('@lexical/html');
|
|
10
|
+
var list = require('@lexical/list');
|
|
11
|
+
var selection = require('@lexical/selection');
|
|
10
12
|
var utils = require('@lexical/utils');
|
|
11
13
|
var lexical = require('lexical');
|
|
12
14
|
|
|
@@ -31,6 +33,20 @@ function $getHtmlContent(editor) {
|
|
|
31
33
|
|
|
32
34
|
return html.$generateHtmlFromNodes(editor, selection);
|
|
33
35
|
}
|
|
36
|
+
function $getLexicalContent(editor) {
|
|
37
|
+
const selection = lexical.$getSelection();
|
|
38
|
+
|
|
39
|
+
if (selection == null) {
|
|
40
|
+
throw new Error('Expected valid LexicalSelection');
|
|
41
|
+
} // If we haven't selected anything
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if (lexical.$isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return JSON.stringify($generateJSONFromSelectedNodes(editor, selection));
|
|
49
|
+
}
|
|
34
50
|
function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
35
51
|
const text = dataTransfer.getData('text/plain');
|
|
36
52
|
|
|
@@ -39,60 +55,88 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
57
|
function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const htmlString = dataTransfer.getData(textHtmlMimeType);
|
|
58
|
+
const htmlString = dataTransfer.getData('text/html');
|
|
59
|
+
const lexicalString = dataTransfer.getData('application/x-lexical-editor');
|
|
45
60
|
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const nodes = html.$generateNodesFromDOM(editor, dom);
|
|
61
|
+
if (lexicalString) {
|
|
62
|
+
try {
|
|
63
|
+
const payload = JSON.parse(lexicalString);
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
if (payload.namespace === editor._config.namespace && Array.isArray(payload.nodes)) {
|
|
66
|
+
const nodes = $generateNodesFromSerializedNodes(payload.nodes);
|
|
67
|
+
return $insertGeneratedNodes(editor, nodes, selection);
|
|
68
|
+
} // eslint-disable-next-line no-empty
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
} catch {}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (htmlString) {
|
|
74
|
+
try {
|
|
75
|
+
const parser = new DOMParser();
|
|
76
|
+
const dom = parser.parseFromString(htmlString, 'text/html');
|
|
77
|
+
return $insertGeneratedNodes(editor, html.$generateNodesFromDOM(editor, dom), selection); // eslint-disable-next-line no-empty
|
|
78
|
+
} catch {}
|
|
58
79
|
}
|
|
59
80
|
|
|
60
81
|
$insertDataTransferForPlainText(dataTransfer, selection);
|
|
61
82
|
}
|
|
62
83
|
|
|
63
|
-
function $
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!isFromLexical) {
|
|
67
|
-
// Wrap text and inline nodes in paragraph nodes so we have all blocks at the top-level
|
|
68
|
-
const topLevelBlocks = [];
|
|
69
|
-
let currentBlock = null;
|
|
84
|
+
function $insertGeneratedNodes(editor, nodes, selection) {
|
|
85
|
+
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;
|
|
70
86
|
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
if (isSelectionInsideOfGrid && nodes.length === 1 && lexical.$isGridNode(nodes[0])) {
|
|
88
|
+
$mergeGridNodesStrategy(nodes, selection, false, editor);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
73
91
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
topLevelBlocks.push(currentBlock);
|
|
78
|
-
}
|
|
92
|
+
$basicInsertStrategy(nodes, selection);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
79
95
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
function $basicInsertStrategy(nodes, selection) {
|
|
97
|
+
// Wrap text and inline nodes in paragraph nodes so we have all blocks at the top-level
|
|
98
|
+
const topLevelBlocks = [];
|
|
99
|
+
let currentBlock = null;
|
|
100
|
+
let list$1 = null;
|
|
101
|
+
|
|
102
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
103
|
+
const node = nodes[i];
|
|
104
|
+
/**
|
|
105
|
+
* There's no good way to add this to importDOM or importJSON directly,
|
|
106
|
+
* so this is here in order to safely correct faulty clipboard data
|
|
107
|
+
* that we can't control and avoid crashing the app.
|
|
108
|
+
* https://github.com/facebook/lexical/issues/2405
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
if (list.$isListItemNode(node)) {
|
|
112
|
+
if (list$1 == null) {
|
|
113
|
+
list$1 = list.$createListNode('bullet');
|
|
114
|
+
topLevelBlocks.push(list$1);
|
|
86
115
|
}
|
|
116
|
+
|
|
117
|
+
list$1.append(node);
|
|
118
|
+
continue;
|
|
119
|
+
} else if (list$1 != null) {
|
|
120
|
+
list$1 = null;
|
|
87
121
|
}
|
|
88
122
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
123
|
+
if (lexical.$isDecoratorNode(node) && !node.isTopLevel() || lexical.$isElementNode(node) && node.isInline() || lexical.$isTextNode(node) || lexical.$isLineBreakNode(node)) {
|
|
124
|
+
if (currentBlock === null) {
|
|
125
|
+
currentBlock = lexical.$createParagraphNode();
|
|
126
|
+
topLevelBlocks.push(currentBlock);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (currentBlock !== null) {
|
|
130
|
+
currentBlock.append(node);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
topLevelBlocks.push(node);
|
|
134
|
+
currentBlock = null;
|
|
135
|
+
}
|
|
92
136
|
}
|
|
93
137
|
|
|
94
138
|
if (lexical.$isRangeSelection(selection)) {
|
|
95
|
-
selection.insertNodes(
|
|
139
|
+
selection.insertNodes(topLevelBlocks);
|
|
96
140
|
} else if (lexical.$isGridSelection(selection)) {
|
|
97
141
|
// If there's an active grid selection and a non grid is pasted, add to the anchor.
|
|
98
142
|
const anchorCell = selection.anchor.getNode();
|
|
@@ -103,7 +147,7 @@ function $basicInsertStrategy(nodes, selection, isFromLexical) {
|
|
|
103
147
|
}
|
|
104
148
|
}
|
|
105
149
|
|
|
106
|
-
anchorCell.append(...
|
|
150
|
+
anchorCell.append(...topLevelBlocks);
|
|
107
151
|
}
|
|
108
152
|
}
|
|
109
153
|
|
|
@@ -210,6 +254,102 @@ function $mergeGridNodesStrategy(nodes, selection, isFromLexical, editor) {
|
|
|
210
254
|
}
|
|
211
255
|
}
|
|
212
256
|
|
|
257
|
+
function exportNodeToJSON(node) {
|
|
258
|
+
const serializedNode = node.exportJSON();
|
|
259
|
+
const nodeClass = node.constructor; // @ts-expect-error TODO Replace Class utility type with InstanceType
|
|
260
|
+
|
|
261
|
+
if (serializedNode.type !== nodeClass.getType()) {
|
|
262
|
+
{
|
|
263
|
+
throw Error(`LexicalNode: Node ${nodeClass.name} does not implement .exportJSON().`);
|
|
264
|
+
}
|
|
265
|
+
} // @ts-expect-error TODO Replace Class utility type with InstanceType
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
const serializedChildren = serializedNode.children;
|
|
269
|
+
|
|
270
|
+
if (lexical.$isElementNode(node)) {
|
|
271
|
+
if (!Array.isArray(serializedChildren)) {
|
|
272
|
+
{
|
|
273
|
+
throw Error(`LexicalNode: Node ${nodeClass.name} is an element but .exportJSON() does not have a children array.`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return serializedNode;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function $appendNodesToJSON(editor, selection$1, currentNode, targetArray) {
|
|
282
|
+
let shouldInclude = selection$1 != null ? currentNode.isSelected() : true;
|
|
283
|
+
const shouldExclude = lexical.$isElementNode(currentNode) && currentNode.excludeFromCopy('html');
|
|
284
|
+
let clone = selection.$cloneWithProperties(currentNode);
|
|
285
|
+
clone = lexical.$isTextNode(clone) && selection$1 != null ? selection.$sliceSelectedTextNodeContent(selection$1, clone) : clone;
|
|
286
|
+
const children = lexical.$isElementNode(clone) ? clone.getChildren() : [];
|
|
287
|
+
const serializedNode = exportNodeToJSON(clone); // TODO: TextNode calls getTextContent() (NOT node.__text) within it's exportJSON method
|
|
288
|
+
// which uses getLatest() to get the text from the original node with the same key.
|
|
289
|
+
// This is a deeper issue with the word "clone" here, it's still a reference to the
|
|
290
|
+
// same node as far as the LexicalEditor is concerned since it shares a key.
|
|
291
|
+
// We need a way to create a clone of a Node in memory with it's own key, but
|
|
292
|
+
// until then this hack will work for the selected text extract use case.
|
|
293
|
+
|
|
294
|
+
if (lexical.$isTextNode(clone)) {
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
serializedNode.text = clone.__text;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
for (let i = 0; i < children.length; i++) {
|
|
300
|
+
const childNode = children[i];
|
|
301
|
+
const shouldIncludeChild = $appendNodesToJSON(editor, selection$1, childNode, serializedNode.children);
|
|
302
|
+
|
|
303
|
+
if (!shouldInclude && lexical.$isElementNode(currentNode) && shouldIncludeChild && currentNode.extractWithChild(childNode, selection$1, 'clone')) {
|
|
304
|
+
shouldInclude = true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (shouldInclude && !shouldExclude) {
|
|
309
|
+
targetArray.push(serializedNode);
|
|
310
|
+
} else if (Array.isArray(serializedNode.children)) {
|
|
311
|
+
for (let i = 0; i < serializedNode.children.length; i++) {
|
|
312
|
+
const serializedChildNode = serializedNode.children[i];
|
|
313
|
+
targetArray.push(serializedChildNode);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return shouldInclude;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function $generateJSONFromSelectedNodes(editor, selection) {
|
|
321
|
+
const nodes = [];
|
|
322
|
+
const root = lexical.$getRoot();
|
|
323
|
+
const topLevelChildren = root.getChildren();
|
|
324
|
+
|
|
325
|
+
for (let i = 0; i < topLevelChildren.length; i++) {
|
|
326
|
+
const topLevelNode = topLevelChildren[i];
|
|
327
|
+
$appendNodesToJSON(editor, selection, topLevelNode, nodes);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
namespace: editor._config.namespace,
|
|
332
|
+
nodes
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function $generateNodesFromSerializedNodes(serializedNodes) {
|
|
336
|
+
const nodes = [];
|
|
337
|
+
|
|
338
|
+
for (let i = 0; i < serializedNodes.length; i++) {
|
|
339
|
+
const serializedNode = serializedNodes[i];
|
|
340
|
+
const node = lexical.$parseSerializedNode(serializedNode);
|
|
341
|
+
|
|
342
|
+
if (lexical.$isTextNode(node)) {
|
|
343
|
+
selection.$addNodeStyle(node);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
nodes.push(node);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return nodes;
|
|
350
|
+
}
|
|
351
|
+
|
|
213
352
|
exports.$getHtmlContent = $getHtmlContent;
|
|
353
|
+
exports.$getLexicalContent = $getLexicalContent;
|
|
214
354
|
exports.$insertDataTransferForPlainText = $insertDataTransferForPlainText;
|
|
215
355
|
exports.$insertDataTransferForRichText = $insertDataTransferForRichText;
|
package/LexicalClipboard.js.flow
CHANGED
|
@@ -20,12 +20,14 @@ import type {
|
|
|
20
20
|
|
|
21
21
|
declare export function $insertDataTransferForRichText(
|
|
22
22
|
dataTransfer: DataTransfer,
|
|
23
|
-
selection: RangeSelection | GridSelection
|
|
23
|
+
selection: RangeSelection | GridSelection,
|
|
24
24
|
editor: LexicalEditor,
|
|
25
25
|
): void;
|
|
26
26
|
|
|
27
|
-
declare export function $getHtmlContent(editor: LexicalEditor): string;
|
|
28
|
-
|
|
27
|
+
declare export function $getHtmlContent(editor: LexicalEditor): string | null;
|
|
28
|
+
declare export function $getLexicalContent(
|
|
29
|
+
editor: LexicalEditor,
|
|
30
|
+
): string | null;
|
|
29
31
|
/*
|
|
30
32
|
* Plain Text
|
|
31
33
|
*/
|
package/LexicalClipboard.prod.js
CHANGED
|
@@ -4,9 +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 b=require("@lexical/html"),
|
|
8
|
-
function C(
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
'use strict';var b=require("@lexical/html"),p=require("@lexical/list"),r=require("@lexical/selection"),y=require("@lexical/utils"),z=require("lexical");function A(d){throw Error(`Minified Lexical error #${d}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}function B(d,c){d=d.getData("text/plain");null!=d&&c.insertRawText(d)}
|
|
8
|
+
function C(d,c,e){(z.$isGridSelection(e)||null!==y.$findMatchingParent(e.anchor.getNode(),h=>z.$isGridCellNode(h))&&null!==y.$findMatchingParent(e.focus.getNode(),h=>z.$isGridCellNode(h)))&&1===c.length&&z.$isGridNode(c[0])?F(c,e,!1,d):G(c,e)}
|
|
9
|
+
function G(d,c){let e=[],h=null,f=null;for(let g=0;g<d.length;g++){let a=d[g];p.$isListItemNode(a)?(null==f&&(f=p.$createListNode("bullet"),e.push(f)),f.append(a)):(null!=f&&(f=null),z.$isDecoratorNode(a)&&!a.isTopLevel()||z.$isElementNode(a)&&a.isInline()||z.$isTextNode(a)||z.$isLineBreakNode(a)?(null===h&&(h=z.$createParagraphNode(),e.push(h)),null!==h&&h.append(a)):(e.push(a),h=null))}z.$isRangeSelection(c)?c.insertNodes(e):z.$isGridSelection(c)&&(d=c.anchor.getNode(),z.$isGridCellNode(d)||A(41),
|
|
10
|
+
d.append(...e))}
|
|
11
|
+
function F(d,c,e,h){1===d.length&&z.$isGridNode(d[0])||A(42);var f=d[0];d=f.getChildren();e=f.getFirstChildOrThrow().getChildrenSize();var g=f.getChildrenSize(),a=y.$findMatchingParent(c.anchor.getNode(),m=>z.$isGridCellNode(m));c=(f=a&&y.$findMatchingParent(a,m=>z.$isGridRowNode(m)))&&y.$findMatchingParent(f,m=>z.$isGridNode(m));z.$isGridCellNode(a)&&z.$isGridRowNode(f)&&z.$isGridNode(c)||A(43);var k=f.getIndexWithinParent(),n=Math.min(c.getChildrenSize()-1,k+g-1);g=a.getIndexWithinParent();a=Math.min(f.getChildrenSize()-
|
|
12
|
+
1,g+e-1);e=Math.min(g,a);f=Math.min(k,n);g=Math.max(g,a);k=Math.max(k,n);n=c.getChildren();a=0;let l,q;for(let m=f;m<=k;m++){var w=n[m];z.$isGridRowNode(w)||A(24);var x=d[a];z.$isGridRowNode(x)||A(24);w=w.getChildren();x=x.getChildren();let D=0;for(let t=e;t<=g;t++){let u=w[t];z.$isGridCellNode(u)||A(25);let E=x[D];z.$isGridCellNode(E)||A(25);m===f&&t===e?l=u.getKey():m===k&&t===g&&(q=u.getKey());let I=u.getChildren();E.getChildren().forEach(v=>{z.$isTextNode(v)&&z.$createParagraphNode().append(v);
|
|
13
|
+
u.append(v)});I.forEach(v=>v.remove());D++}a++}l&&q&&(d=z.$createGridSelection(),d.set(c.getKey(),l,q),z.$setSelection(d),h.dispatchCommand(z.SELECTION_CHANGE_COMMAND,void 0))}
|
|
14
|
+
function H(d,c,e,h){let f=null!=c?e.isSelected():!0,g=z.$isElementNode(e)&&e.excludeFromCopy("html");var a=r.$cloneWithProperties(e);a=z.$isTextNode(a)&&null!=c?r.$sliceSelectedTextNodeContent(c,a):a;let k=z.$isElementNode(a)?a.getChildren():[];var n=a;let l=n.exportJSON();l.type!==n.constructor.getType()&&A(58);var q=l.children;z.$isElementNode(n)&&(Array.isArray(q)||A(59));z.$isTextNode(a)&&(l.text=a.__text);for(a=0;a<k.length;a++)n=k[a],q=H(d,c,n,l.children),!f&&z.$isElementNode(e)&&q&&e.extractWithChild(n,
|
|
15
|
+
c,"clone")&&(f=!0);if(f&&!g)h.push(l);else if(Array.isArray(l.children))for(d=0;d<l.children.length;d++)h.push(l.children[d]);return f}exports.$getHtmlContent=function(d){let c=z.$getSelection();if(null==c)throw Error("Expected valid LexicalSelection");return z.$isRangeSelection(c)&&c.isCollapsed()||0===c.getNodes().length?null:b.$generateHtmlFromNodes(d,c)};
|
|
16
|
+
exports.$getLexicalContent=function(d){let c=z.$getSelection();if(null==c)throw Error("Expected valid LexicalSelection");if(z.$isRangeSelection(c)&&c.isCollapsed()||0===c.getNodes().length)return null;var e=JSON,h=e.stringify;let f=[],g=z.$getRoot().getChildren();for(let a=0;a<g.length;a++)H(d,c,g[a],f);return h.call(e,{namespace:d._config.namespace,nodes:f})};exports.$insertDataTransferForPlainText=B;
|
|
17
|
+
exports.$insertDataTransferForRichText=function(d,c,e){let h=d.getData("text/html");var f=d.getData("application/x-lexical-editor");if(f)try{var g=JSON.parse(f);if(g.namespace===e._config.namespace&&Array.isArray(g.nodes)){var a=g.nodes;f=[];for(g=0;g<a.length;g++){let k=z.$parseSerializedNode(a[g]);z.$isTextNode(k)&&r.$addNodeStyle(k);f.push(k)}return C(e,f,c)}}catch{}if(h)try{let k=(new DOMParser).parseFromString(h,"text/html");return C(e,b.$generateNodesFromDOM(e,k),c)}catch{}B(d,c)}
|
package/clipboard.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { GridSelection, LexicalEditor, LexicalNode, NodeSelection, RangeSelection } from 'lexical';
|
|
9
|
+
export declare function $getHtmlContent(editor: LexicalEditor): string | null;
|
|
10
|
+
export declare function $getLexicalContent(editor: LexicalEditor): string | null;
|
|
11
|
+
export declare function $insertDataTransferForPlainText(dataTransfer: DataTransfer, selection: RangeSelection | GridSelection): void;
|
|
12
|
+
export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: RangeSelection | GridSelection, editor: LexicalEditor): void;
|
|
13
|
+
interface BaseSerializedNode {
|
|
14
|
+
children?: Array<BaseSerializedNode>;
|
|
15
|
+
type: string;
|
|
16
|
+
version: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function $generateJSONFromSelectedNodes<SerializedNode>(editor: LexicalEditor, selection: RangeSelection | NodeSelection | GridSelection | null): {
|
|
19
|
+
namespace: string;
|
|
20
|
+
nodes: Array<SerializedNode>;
|
|
21
|
+
};
|
|
22
|
+
export declare function $generateNodesFromSerializedNodes(serializedNodes: Array<BaseSerializedNode>): Array<LexicalNode>;
|
|
23
|
+
export {};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { $getHtmlContent, $getLexicalContent, $insertDataTransferForPlainText, $insertDataTransferForRichText } from './clipboard';
|
|
9
|
+
export { $getHtmlContent, $getLexicalContent, $insertDataTransferForPlainText, $insertDataTransferForRichText, };
|
package/package.json
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"paste"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "0.3.
|
|
12
|
+
"version": "0.3.5",
|
|
13
13
|
"main": "LexicalClipboard.js",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"lexical": "0.3.
|
|
15
|
+
"lexical": "0.3.5"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lexical/utils": "0.3.
|
|
19
|
-
"@lexical/selection": "0.3.
|
|
20
|
-
"@lexical/html": "0.3.
|
|
18
|
+
"@lexical/utils": "0.3.5",
|
|
19
|
+
"@lexical/selection": "0.3.5",
|
|
20
|
+
"@lexical/html": "0.3.5"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
package/LexicalClipboard.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
GridSelection,
|
|
11
|
-
LexicalEditor,
|
|
12
|
-
NodeSelection,
|
|
13
|
-
RangeSelection,
|
|
14
|
-
} from 'lexical';
|
|
15
|
-
|
|
16
|
-
/*
|
|
17
|
-
* Rich Text
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export function $insertDataTransferForRichText(
|
|
21
|
-
dataTransfer: DataTransfer,
|
|
22
|
-
selection: RangeSelection | GridSelection | NodeSelection,
|
|
23
|
-
editor: LexicalEditor,
|
|
24
|
-
): void;
|
|
25
|
-
|
|
26
|
-
export function $getHtmlContent(editor: LexicalEditor): string;
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
* Plain Text
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export function $insertDataTransferForPlainText(
|
|
33
|
-
dataTransfer: DataTransfer,
|
|
34
|
-
selection: RangeSelection,
|
|
35
|
-
): void;
|