@lexical/rich-text 0.1.17
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/LICENSE +21 -0
- package/LexicalRichText.d.ts +47 -0
- package/LexicalRichText.dev.js +592 -0
- package/LexicalRichText.js +9 -0
- package/LexicalRichText.js.flow +56 -0
- package/LexicalRichText.prod.js +22 -0
- package/README.md +3 -0
- package/package.json +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,47 @@
|
|
|
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 {
|
|
9
|
+
DOMConversionMap,
|
|
10
|
+
EditorConfig,
|
|
11
|
+
EditorState,
|
|
12
|
+
LexicalNode,
|
|
13
|
+
NodeKey,
|
|
14
|
+
ParagraphNode,
|
|
15
|
+
} from 'lexical';
|
|
16
|
+
export type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
17
|
+
|
|
18
|
+
export declare class QuoteNode extends ElementNode {
|
|
19
|
+
static getType(): string;
|
|
20
|
+
static clone(node: QuoteNode): QuoteNode;
|
|
21
|
+
constructor(key?: NodeKey): void;
|
|
22
|
+
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
23
|
+
updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
|
|
24
|
+
insertNewAfter(): ParagraphNode;
|
|
25
|
+
collapseAtStart(): true;
|
|
26
|
+
}
|
|
27
|
+
export function $createQuoteNode(): QuoteNode;
|
|
28
|
+
export function $isQuoteNode(node: ?LexicalNode): boolean;
|
|
29
|
+
export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
|
|
30
|
+
export declare class HeadingNode extends ElementNode {
|
|
31
|
+
__tag: HeadingTagType;
|
|
32
|
+
static getType(): string;
|
|
33
|
+
static clone(node: HeadingNode): HeadingNode;
|
|
34
|
+
constructor(tag: HeadingTagType, key?: NodeKey): void;
|
|
35
|
+
getTag(): HeadingTagType;
|
|
36
|
+
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
37
|
+
updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
|
|
38
|
+
static convertDOM(): DOMConversionMap | null;
|
|
39
|
+
insertNewAfter(): ParagraphNode;
|
|
40
|
+
collapseAtStart(): true;
|
|
41
|
+
}
|
|
42
|
+
export function $createHeadingNode(headingTag: HeadingTagType): HeadingNode;
|
|
43
|
+
export function $isHeadingNode(node: ?LexicalNode): boolean;
|
|
44
|
+
export function registerRichText(
|
|
45
|
+
editor: LexicalEditor,
|
|
46
|
+
initialEditorState?: InitialEditorStateType,
|
|
47
|
+
): () => void;
|
|
@@ -0,0 +1,592 @@
|
|
|
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
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var clipboard = require('@lexical/clipboard');
|
|
10
|
+
var selection = require('@lexical/selection');
|
|
11
|
+
var utils = require('@lexical/utils');
|
|
12
|
+
var lexical = require('lexical');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
// Convoluted logic to make this work with Flow. Order matters.
|
|
23
|
+
const options = {
|
|
24
|
+
tag: 'history-merge'
|
|
25
|
+
};
|
|
26
|
+
const setEditorOptions = options;
|
|
27
|
+
const updateOptions = options;
|
|
28
|
+
class QuoteNode extends lexical.ElementNode {
|
|
29
|
+
static getType() {
|
|
30
|
+
return 'quote';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static clone(node) {
|
|
34
|
+
return new QuoteNode(node.__key);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
constructor(key) {
|
|
38
|
+
super(key);
|
|
39
|
+
} // View
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
createDOM(config) {
|
|
43
|
+
const element = document.createElement('blockquote');
|
|
44
|
+
utils.addClassNamesToElement(element, config.theme.quote);
|
|
45
|
+
return element;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
updateDOM(prevNode, dom) {
|
|
49
|
+
return false;
|
|
50
|
+
} // Mutation
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
insertNewAfter() {
|
|
54
|
+
const newBlock = lexical.$createParagraphNode();
|
|
55
|
+
const direction = this.getDirection();
|
|
56
|
+
newBlock.setDirection(direction);
|
|
57
|
+
this.insertAfter(newBlock);
|
|
58
|
+
return newBlock;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
collapseAtStart() {
|
|
62
|
+
const paragraph = lexical.$createParagraphNode();
|
|
63
|
+
const children = this.getChildren();
|
|
64
|
+
children.forEach(child => paragraph.append(child));
|
|
65
|
+
this.replace(paragraph);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
function $createQuoteNode() {
|
|
71
|
+
return new QuoteNode();
|
|
72
|
+
}
|
|
73
|
+
function $isQuoteNode(node) {
|
|
74
|
+
return node instanceof QuoteNode;
|
|
75
|
+
}
|
|
76
|
+
class HeadingNode extends lexical.ElementNode {
|
|
77
|
+
static getType() {
|
|
78
|
+
return 'heading';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static clone(node) {
|
|
82
|
+
return new HeadingNode(node.__tag, node.__key);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
constructor(tag, key) {
|
|
86
|
+
super(key);
|
|
87
|
+
this.__tag = tag;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getTag() {
|
|
91
|
+
return this.__tag;
|
|
92
|
+
} // View
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
createDOM(config) {
|
|
96
|
+
const tag = this.__tag;
|
|
97
|
+
const element = document.createElement(tag);
|
|
98
|
+
const theme = config.theme;
|
|
99
|
+
const classNames = theme.heading;
|
|
100
|
+
|
|
101
|
+
if (classNames !== undefined) {
|
|
102
|
+
// $FlowFixMe: intentional cast
|
|
103
|
+
const className = classNames[tag];
|
|
104
|
+
utils.addClassNamesToElement(element, className);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return element;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
updateDOM(prevNode, dom) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static convertDOM() {
|
|
115
|
+
return {
|
|
116
|
+
h1: node => ({
|
|
117
|
+
conversion: convertHeadingElement,
|
|
118
|
+
priority: 0
|
|
119
|
+
}),
|
|
120
|
+
h2: node => ({
|
|
121
|
+
conversion: convertHeadingElement,
|
|
122
|
+
priority: 0
|
|
123
|
+
}),
|
|
124
|
+
h3: node => ({
|
|
125
|
+
conversion: convertHeadingElement,
|
|
126
|
+
priority: 0
|
|
127
|
+
}),
|
|
128
|
+
h4: node => ({
|
|
129
|
+
conversion: convertHeadingElement,
|
|
130
|
+
priority: 0
|
|
131
|
+
}),
|
|
132
|
+
h5: node => ({
|
|
133
|
+
conversion: convertHeadingElement,
|
|
134
|
+
priority: 0
|
|
135
|
+
})
|
|
136
|
+
};
|
|
137
|
+
} // Mutation
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
insertNewAfter() {
|
|
141
|
+
const newElement = lexical.$createParagraphNode();
|
|
142
|
+
const direction = this.getDirection();
|
|
143
|
+
newElement.setDirection(direction);
|
|
144
|
+
this.insertAfter(newElement);
|
|
145
|
+
return newElement;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
collapseAtStart() {
|
|
149
|
+
const paragraph = lexical.$createParagraphNode();
|
|
150
|
+
const children = this.getChildren();
|
|
151
|
+
children.forEach(child => paragraph.append(child));
|
|
152
|
+
this.replace(paragraph);
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function convertHeadingElement(domNode) {
|
|
159
|
+
const nodeName = domNode.nodeName.toLowerCase();
|
|
160
|
+
let node = null;
|
|
161
|
+
|
|
162
|
+
if (nodeName === 'h1' || nodeName === 'h2' || nodeName === 'h3' || nodeName === 'h4' || nodeName === 'h5') {
|
|
163
|
+
node = $createHeadingNode(nodeName);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
node
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function $createHeadingNode(headingTag) {
|
|
172
|
+
return new HeadingNode(headingTag);
|
|
173
|
+
}
|
|
174
|
+
function $isHeadingNode(node) {
|
|
175
|
+
return node instanceof HeadingNode;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function initializeEditor(editor, initialEditorState) {
|
|
179
|
+
if (initialEditorState === null) {
|
|
180
|
+
return;
|
|
181
|
+
} else if (initialEditorState === undefined) {
|
|
182
|
+
editor.update(() => {
|
|
183
|
+
const root = lexical.$getRoot();
|
|
184
|
+
const firstChild = root.getFirstChild();
|
|
185
|
+
|
|
186
|
+
if (firstChild === null) {
|
|
187
|
+
const paragraph = lexical.$createParagraphNode();
|
|
188
|
+
root.append(paragraph);
|
|
189
|
+
const activeElement = document.activeElement;
|
|
190
|
+
|
|
191
|
+
if (lexical.$getSelection() !== null || activeElement !== null && activeElement === editor.getRootElement()) {
|
|
192
|
+
paragraph.select();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}, updateOptions);
|
|
196
|
+
} else if (initialEditorState !== null) {
|
|
197
|
+
switch (typeof initialEditorState) {
|
|
198
|
+
case 'string':
|
|
199
|
+
{
|
|
200
|
+
const parsedEditorState = editor.parseEditorState(initialEditorState);
|
|
201
|
+
editor.setEditorState(parsedEditorState, setEditorOptions);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
case 'object':
|
|
206
|
+
{
|
|
207
|
+
editor.setEditorState(initialEditorState, setEditorOptions);
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
case 'function':
|
|
212
|
+
{
|
|
213
|
+
editor.update(initialEditorState, updateOptions);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function onPasteForRichText(event, editor) {
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
editor.update(() => {
|
|
223
|
+
const selection = lexical.$getSelection();
|
|
224
|
+
const clipboardData = event.clipboardData;
|
|
225
|
+
|
|
226
|
+
if (clipboardData != null && lexical.$isRangeSelection(selection)) {
|
|
227
|
+
clipboard.$insertDataTransferForRichText(clipboardData, selection, editor);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function onCopyForRichText(event, editor) {
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
editor.update(() => {
|
|
235
|
+
const clipboardData = event.clipboardData;
|
|
236
|
+
const selection = lexical.$getSelection();
|
|
237
|
+
|
|
238
|
+
if (selection !== null) {
|
|
239
|
+
if (clipboardData != null) {
|
|
240
|
+
const htmlString = clipboard.getHtmlContent(editor);
|
|
241
|
+
const lexicalString = clipboard.$getLexicalContent(editor);
|
|
242
|
+
|
|
243
|
+
if (htmlString !== null) {
|
|
244
|
+
clipboardData.setData('text/html', htmlString);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (lexicalString !== null) {
|
|
248
|
+
clipboardData.setData('application/x-lexical-editor', lexicalString);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
clipboardData.setData('text/plain', selection.getTextContent());
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function onCutForRichText(event, editor) {
|
|
258
|
+
onCopyForRichText(event, editor);
|
|
259
|
+
editor.update(() => {
|
|
260
|
+
const selection = lexical.$getSelection();
|
|
261
|
+
|
|
262
|
+
if (lexical.$isRangeSelection(selection)) {
|
|
263
|
+
selection.removeText();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function registerRichText(editor, initialEditorState) {
|
|
269
|
+
const removeListener = utils.mergeRegister(editor.registerCommand(lexical.CLICK_COMMAND, payload => {
|
|
270
|
+
const selection = lexical.$getSelection();
|
|
271
|
+
|
|
272
|
+
if (lexical.$isNodeSelection(selection)) {
|
|
273
|
+
selection.clear();
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return false;
|
|
278
|
+
}, 0), editor.registerCommand(lexical.DELETE_CHARACTER_COMMAND, payload => {
|
|
279
|
+
const selection = lexical.$getSelection();
|
|
280
|
+
|
|
281
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const isBackward = payload;
|
|
286
|
+
selection.deleteCharacter(isBackward);
|
|
287
|
+
return true;
|
|
288
|
+
}, 0), editor.registerCommand(lexical.DELETE_WORD_COMMAND, payload => {
|
|
289
|
+
const selection = lexical.$getSelection();
|
|
290
|
+
|
|
291
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const isBackward = payload;
|
|
296
|
+
selection.deleteWord(isBackward);
|
|
297
|
+
return true;
|
|
298
|
+
}, 0), editor.registerCommand(lexical.DELETE_LINE_COMMAND, payload => {
|
|
299
|
+
const selection = lexical.$getSelection();
|
|
300
|
+
|
|
301
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const isBackward = payload;
|
|
306
|
+
selection.deleteLine(isBackward);
|
|
307
|
+
return true;
|
|
308
|
+
}, 0), editor.registerCommand(lexical.INSERT_TEXT_COMMAND, payload => {
|
|
309
|
+
const selection = lexical.$getSelection();
|
|
310
|
+
|
|
311
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const eventOrText = payload;
|
|
316
|
+
|
|
317
|
+
if (typeof eventOrText === 'string') {
|
|
318
|
+
selection.insertText(eventOrText);
|
|
319
|
+
} else {
|
|
320
|
+
const dataTransfer = eventOrText.dataTransfer;
|
|
321
|
+
|
|
322
|
+
if (dataTransfer != null) {
|
|
323
|
+
clipboard.$insertDataTransferForRichText(dataTransfer, selection, editor);
|
|
324
|
+
} else {
|
|
325
|
+
const data = eventOrText.data;
|
|
326
|
+
|
|
327
|
+
if (data) {
|
|
328
|
+
selection.insertText(data);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return true;
|
|
336
|
+
}, 0), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, payload => {
|
|
337
|
+
const selection = lexical.$getSelection();
|
|
338
|
+
|
|
339
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
selection.removeText();
|
|
344
|
+
return true;
|
|
345
|
+
}, 0), editor.registerCommand(lexical.FORMAT_TEXT_COMMAND, payload => {
|
|
346
|
+
const selection = lexical.$getSelection();
|
|
347
|
+
|
|
348
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const format = payload;
|
|
353
|
+
selection.formatText(format);
|
|
354
|
+
return true;
|
|
355
|
+
}, 0), editor.registerCommand(lexical.FORMAT_ELEMENT_COMMAND, format => {
|
|
356
|
+
const selection = lexical.$getSelection();
|
|
357
|
+
|
|
358
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const node = selection.anchor.getNode();
|
|
363
|
+
const element = lexical.$isElementNode(node) ? node : node.getParentOrThrow();
|
|
364
|
+
element.setFormat(format);
|
|
365
|
+
return true;
|
|
366
|
+
}, 0), editor.registerCommand(lexical.INSERT_LINE_BREAK_COMMAND, payload => {
|
|
367
|
+
const selection = lexical.$getSelection();
|
|
368
|
+
|
|
369
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const selectStart = payload;
|
|
374
|
+
selection.insertLineBreak(selectStart);
|
|
375
|
+
return true;
|
|
376
|
+
}, 0), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, payload => {
|
|
377
|
+
const selection = lexical.$getSelection();
|
|
378
|
+
|
|
379
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
selection.insertParagraph();
|
|
384
|
+
return true;
|
|
385
|
+
}, 0), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, payload => {
|
|
386
|
+
const selection = lexical.$getSelection();
|
|
387
|
+
|
|
388
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
389
|
+
return false;
|
|
390
|
+
} // Handle code blocks
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
const anchor = selection.anchor;
|
|
394
|
+
const parentBlock = anchor.type === 'element' ? anchor.getNode() : anchor.getNode().getParentOrThrow();
|
|
395
|
+
|
|
396
|
+
if (parentBlock.canInsertTab()) {
|
|
397
|
+
editor.dispatchCommand(lexical.INSERT_TEXT_COMMAND, '\t');
|
|
398
|
+
} else {
|
|
399
|
+
if (parentBlock.getIndent() !== 10) {
|
|
400
|
+
parentBlock.setIndent(parentBlock.getIndent() + 1);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return true;
|
|
405
|
+
}, 0), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, payload => {
|
|
406
|
+
const selection = lexical.$getSelection();
|
|
407
|
+
|
|
408
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
409
|
+
return false;
|
|
410
|
+
} // Handle code blocks
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
const anchor = selection.anchor;
|
|
414
|
+
const anchorNode = anchor.getNode();
|
|
415
|
+
const parentBlock = anchor.type === 'element' ? anchor.getNode() : anchor.getNode().getParentOrThrow();
|
|
416
|
+
|
|
417
|
+
if (parentBlock.canInsertTab()) {
|
|
418
|
+
const textContent = anchorNode.getTextContent();
|
|
419
|
+
const character = textContent[anchor.offset - 1];
|
|
420
|
+
|
|
421
|
+
if (character === '\t') {
|
|
422
|
+
editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, true);
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
if (parentBlock.getIndent() !== 0) {
|
|
426
|
+
parentBlock.setIndent(parentBlock.getIndent() - 1);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return true;
|
|
431
|
+
}, 0), editor.registerCommand(lexical.KEY_ARROW_LEFT_COMMAND, payload => {
|
|
432
|
+
const selection$1 = lexical.$getSelection();
|
|
433
|
+
|
|
434
|
+
if (!lexical.$isRangeSelection(selection$1)) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const event = payload;
|
|
439
|
+
const isHoldingShift = event.shiftKey;
|
|
440
|
+
|
|
441
|
+
if (selection.$shouldOverrideDefaultCharacterSelection(selection$1, true)) {
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
selection.$moveCharacter(selection$1, isHoldingShift, true);
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return false;
|
|
448
|
+
}, 0), editor.registerCommand(lexical.KEY_ARROW_RIGHT_COMMAND, payload => {
|
|
449
|
+
const selection$1 = lexical.$getSelection();
|
|
450
|
+
|
|
451
|
+
if (!lexical.$isRangeSelection(selection$1)) {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const event = payload;
|
|
456
|
+
const isHoldingShift = event.shiftKey;
|
|
457
|
+
|
|
458
|
+
if (selection.$shouldOverrideDefaultCharacterSelection(selection$1, false)) {
|
|
459
|
+
event.preventDefault();
|
|
460
|
+
selection.$moveCharacter(selection$1, isHoldingShift, false);
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return false;
|
|
465
|
+
}, 0), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, payload => {
|
|
466
|
+
const selection = lexical.$getSelection();
|
|
467
|
+
|
|
468
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const event = payload;
|
|
473
|
+
event.preventDefault();
|
|
474
|
+
const {
|
|
475
|
+
anchor
|
|
476
|
+
} = selection;
|
|
477
|
+
|
|
478
|
+
if (selection.isCollapsed() && anchor.offset === 0) {
|
|
479
|
+
const element = anchor.type === 'element' ? anchor.getNode() : anchor.getNode().getParentOrThrow();
|
|
480
|
+
|
|
481
|
+
if (element.getIndent() > 0) {
|
|
482
|
+
return editor.dispatchCommand(lexical.OUTDENT_CONTENT_COMMAND);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, true);
|
|
487
|
+
}, 0), editor.registerCommand(lexical.KEY_DELETE_COMMAND, payload => {
|
|
488
|
+
const selection = lexical.$getSelection();
|
|
489
|
+
|
|
490
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const event = payload;
|
|
495
|
+
event.preventDefault();
|
|
496
|
+
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, false);
|
|
497
|
+
}, 0), editor.registerCommand(lexical.KEY_ENTER_COMMAND, payload => {
|
|
498
|
+
const selection = lexical.$getSelection();
|
|
499
|
+
|
|
500
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
const event = payload;
|
|
505
|
+
event.preventDefault();
|
|
506
|
+
|
|
507
|
+
if (event.shiftKey) {
|
|
508
|
+
return editor.dispatchCommand(lexical.INSERT_LINE_BREAK_COMMAND);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return editor.dispatchCommand(lexical.INSERT_PARAGRAPH_COMMAND);
|
|
512
|
+
}, 0), editor.registerCommand(lexical.KEY_TAB_COMMAND, payload => {
|
|
513
|
+
const selection = lexical.$getSelection();
|
|
514
|
+
|
|
515
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const event = payload;
|
|
520
|
+
event.preventDefault();
|
|
521
|
+
return editor.dispatchCommand(event.shiftKey ? lexical.OUTDENT_CONTENT_COMMAND : lexical.INDENT_CONTENT_COMMAND);
|
|
522
|
+
}, 0), editor.registerCommand(lexical.KEY_ESCAPE_COMMAND, payload => {
|
|
523
|
+
const selection = lexical.$getSelection();
|
|
524
|
+
|
|
525
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
editor.blur();
|
|
530
|
+
return true;
|
|
531
|
+
}, 0), editor.registerCommand(lexical.DROP_COMMAND, event => {
|
|
532
|
+
const selection = lexical.$getSelection();
|
|
533
|
+
|
|
534
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
535
|
+
return false;
|
|
536
|
+
} // TODO: Make drag and drop work at some point.
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
event.preventDefault();
|
|
540
|
+
return true;
|
|
541
|
+
}, 0), editor.registerCommand(lexical.DRAGSTART_COMMAND, payload => {
|
|
542
|
+
const selection = lexical.$getSelection();
|
|
543
|
+
|
|
544
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
545
|
+
return false;
|
|
546
|
+
} // TODO: Make drag and drop work at some point.
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
const event = payload;
|
|
550
|
+
event.preventDefault();
|
|
551
|
+
return true;
|
|
552
|
+
}, 0), editor.registerCommand(lexical.COPY_COMMAND, payload => {
|
|
553
|
+
const selection = lexical.$getSelection();
|
|
554
|
+
|
|
555
|
+
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
556
|
+
const event = payload;
|
|
557
|
+
onCopyForRichText(event, editor);
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return false;
|
|
562
|
+
}, 0), editor.registerCommand(lexical.CUT_COMMAND, payload => {
|
|
563
|
+
const selection = lexical.$getSelection();
|
|
564
|
+
|
|
565
|
+
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
566
|
+
const event = payload;
|
|
567
|
+
onCutForRichText(event, editor);
|
|
568
|
+
return true;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return false;
|
|
572
|
+
}, 0), editor.registerCommand(lexical.PASTE_COMMAND, event => {
|
|
573
|
+
const selection = lexical.$getSelection();
|
|
574
|
+
|
|
575
|
+
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
576
|
+
onPasteForRichText(event, editor);
|
|
577
|
+
return true;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return false;
|
|
581
|
+
}, 0));
|
|
582
|
+
initializeEditor(editor, initialEditorState);
|
|
583
|
+
return removeListener;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
exports.$createHeadingNode = $createHeadingNode;
|
|
587
|
+
exports.$createQuoteNode = $createQuoteNode;
|
|
588
|
+
exports.$isHeadingNode = $isHeadingNode;
|
|
589
|
+
exports.$isQuoteNode = $isQuoteNode;
|
|
590
|
+
exports.HeadingNode = HeadingNode;
|
|
591
|
+
exports.QuoteNode = QuoteNode;
|
|
592
|
+
exports.registerRichText = registerRichText;
|
|
@@ -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
|
+
'use strict'
|
|
8
|
+
const LexicalRichText = process.env.NODE_ENV === 'development' ? require('./LexicalRichText.dev.js') : require('./LexicalRichText.prod.js')
|
|
9
|
+
module.exports = LexicalRichText;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
import type {
|
|
10
|
+
DOMConversionMap,
|
|
11
|
+
EditorConfig,
|
|
12
|
+
EditorState,
|
|
13
|
+
LexicalNode,
|
|
14
|
+
NodeKey,
|
|
15
|
+
ParagraphNode,
|
|
16
|
+
LexicalEditor,
|
|
17
|
+
} from 'lexical';
|
|
18
|
+
import {ElementNode} from 'lexical';
|
|
19
|
+
export type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
20
|
+
|
|
21
|
+
declare export class QuoteNode extends ElementNode {
|
|
22
|
+
static getType(): string;
|
|
23
|
+
static clone(node: QuoteNode): QuoteNode;
|
|
24
|
+
constructor(key?: NodeKey): void;
|
|
25
|
+
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
26
|
+
updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
|
|
27
|
+
insertNewAfter(): ParagraphNode;
|
|
28
|
+
collapseAtStart(): true;
|
|
29
|
+
}
|
|
30
|
+
declare export function $createQuoteNode(): QuoteNode;
|
|
31
|
+
declare export function $isQuoteNode(
|
|
32
|
+
node: ?LexicalNode,
|
|
33
|
+
): boolean %checks(node instanceof QuoteNode);
|
|
34
|
+
export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
|
|
35
|
+
declare export class HeadingNode extends ElementNode {
|
|
36
|
+
__tag: HeadingTagType;
|
|
37
|
+
static getType(): string;
|
|
38
|
+
static clone(node: HeadingNode): HeadingNode;
|
|
39
|
+
constructor(tag: HeadingTagType, key?: NodeKey): void;
|
|
40
|
+
getTag(): HeadingTagType;
|
|
41
|
+
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
42
|
+
updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
|
|
43
|
+
static convertDOM(): DOMConversionMap | null;
|
|
44
|
+
insertNewAfter(): ParagraphNode;
|
|
45
|
+
collapseAtStart(): true;
|
|
46
|
+
}
|
|
47
|
+
declare export function $createHeadingNode(
|
|
48
|
+
headingTag: HeadingTagType,
|
|
49
|
+
): HeadingNode;
|
|
50
|
+
declare export function $isHeadingNode(
|
|
51
|
+
node: ?LexicalNode,
|
|
52
|
+
): boolean %checks(node instanceof HeadingNode);
|
|
53
|
+
declare export function registerRichText(
|
|
54
|
+
editor: LexicalEditor,
|
|
55
|
+
initialEditorState?: InitialEditorStateType,
|
|
56
|
+
): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
var a=require("@lexical/clipboard"),h=require("@lexical/selection"),k=require("@lexical/utils"),l=require("lexical");const m={tag:"history-merge"};
|
|
8
|
+
class n extends l.ElementNode{static getType(){return"quote"}static clone(b){return new n(b.__key)}constructor(b){super(b)}createDOM(b){const e=document.createElement("blockquote");k.addClassNamesToElement(e,b.theme.quote);return e}updateDOM(){return!1}insertNewAfter(){const b=l.$createParagraphNode(),e=this.getDirection();b.setDirection(e);this.insertAfter(b);return b}collapseAtStart(){const b=l.$createParagraphNode();this.getChildren().forEach(e=>b.append(e));this.replace(b);return!0}}
|
|
9
|
+
class p extends l.ElementNode{static getType(){return"heading"}static clone(b){return new p(b.__tag,b.__key)}constructor(b,e){super(e);this.__tag=b}getTag(){return this.__tag}createDOM(b){const e=this.__tag,f=document.createElement(e);b=b.theme.heading;void 0!==b&&k.addClassNamesToElement(f,b[e]);return f}updateDOM(){return!1}static convertDOM(){return{h1:()=>({conversion:q,priority:0}),h2:()=>({conversion:q,priority:0}),h3:()=>({conversion:q,priority:0}),h4:()=>({conversion:q,priority:0}),h5:()=>
|
|
10
|
+
({conversion:q,priority:0})}}insertNewAfter(){const b=l.$createParagraphNode(),e=this.getDirection();b.setDirection(e);this.insertAfter(b);return b}collapseAtStart(){const b=l.$createParagraphNode();this.getChildren().forEach(e=>b.append(e));this.replace(b);return!0}}function q(b){b=b.nodeName.toLowerCase();let e=null;if("h1"===b||"h2"===b||"h3"===b||"h4"===b||"h5"===b)e=r(b);return{node:e}}function r(b){return new p(b)}
|
|
11
|
+
function t(b,e){if(null!==e)if(void 0===e)b.update(()=>{var f=l.$getRoot();if(null===f.getFirstChild()){const c=l.$createParagraphNode();f.append(c);f=document.activeElement;(null!==l.$getSelection()||null!==f&&f===b.getRootElement())&&c.select()}},m);else if(null!==e)switch(typeof e){case "string":e=b.parseEditorState(e);b.setEditorState(e,m);break;case "object":b.setEditorState(e,m);break;case "function":b.update(e,m)}}
|
|
12
|
+
function u(b,e){b.preventDefault();e.update(()=>{const f=l.$getSelection(),c=b.clipboardData;null!=c&&l.$isRangeSelection(f)&&a.$insertDataTransferForRichText(c,f,e)})}function v(b,e){b.preventDefault();e.update(()=>{const f=b.clipboardData,c=l.$getSelection();if(null!==c&&null!=f){const d=a.getHtmlContent(e),g=a.$getLexicalContent(e);null!==d&&f.setData("text/html",d);null!==g&&f.setData("application/x-lexical-editor",g);f.setData("text/plain",c.getTextContent())}})}
|
|
13
|
+
function w(b,e){v(b,e);e.update(()=>{const f=l.$getSelection();l.$isRangeSelection(f)&&f.removeText()})}exports.$createHeadingNode=r;exports.$createQuoteNode=function(){return new n};exports.$isHeadingNode=function(b){return b instanceof p};exports.$isQuoteNode=function(b){return b instanceof n};exports.HeadingNode=p;exports.QuoteNode=n;
|
|
14
|
+
exports.registerRichText=function(b,e){const f=k.mergeRegister(b.registerCommand(l.CLICK_COMMAND,()=>{const c=l.$getSelection();return l.$isNodeSelection(c)?(c.clear(),!0):!1},0),b.registerCommand(l.DELETE_CHARACTER_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteCharacter(c);return!0},0),b.registerCommand(l.DELETE_WORD_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteWord(c);return!0},0),b.registerCommand(l.DELETE_LINE_COMMAND,c=>
|
|
15
|
+
{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteLine(c);return!0},0),b.registerCommand(l.INSERT_TEXT_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;if("string"===typeof c)d.insertText(c);else{const g=c.dataTransfer;null!=g?a.$insertDataTransferForRichText(g,d,b):(c=c.data)&&d.insertText(c)}return!0},0),b.registerCommand(l.REMOVE_TEXT_COMMAND,()=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.removeText();return!0},0),b.registerCommand(l.FORMAT_TEXT_COMMAND,
|
|
16
|
+
c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.formatText(c);return!0},0),b.registerCommand(l.FORMAT_ELEMENT_COMMAND,c=>{var d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d=d.anchor.getNode();(l.$isElementNode(d)?d:d.getParentOrThrow()).setFormat(c);return!0},0),b.registerCommand(l.INSERT_LINE_BREAK_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.insertLineBreak(c);return!0},0),b.registerCommand(l.INSERT_PARAGRAPH_COMMAND,()=>{const c=l.$getSelection();
|
|
17
|
+
if(!l.$isRangeSelection(c))return!1;c.insertParagraph();return!0},0),b.registerCommand(l.INDENT_CONTENT_COMMAND,()=>{var c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c=c.anchor;c="element"===c.type?c.getNode():c.getNode().getParentOrThrow();c.canInsertTab()?b.dispatchCommand(l.INSERT_TEXT_COMMAND,"\t"):10!==c.getIndent()&&c.setIndent(c.getIndent()+1);return!0},0),b.registerCommand(l.OUTDENT_CONTENT_COMMAND,()=>{var c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c=c.anchor;const d=
|
|
18
|
+
c.getNode(),g="element"===c.type?c.getNode():c.getNode().getParentOrThrow();g.canInsertTab()?"\t"===d.getTextContent()[c.offset-1]&&b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0):0!==g.getIndent()&&g.setIndent(g.getIndent()-1);return!0},0),b.registerCommand(l.KEY_ARROW_LEFT_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;const g=c.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(d,!0)?(c.preventDefault(),h.$moveCharacter(d,g,!0),!0):!1},0),b.registerCommand(l.KEY_ARROW_RIGHT_COMMAND,
|
|
19
|
+
c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;const g=c.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(d,!1)?(c.preventDefault(),h.$moveCharacter(d,g,!1),!0):!1},0),b.registerCommand(l.KEY_BACKSPACE_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();({anchor:c}=d);return d.isCollapsed()&&0===c.offset&&0<("element"===c.type?c.getNode():c.getNode().getParentOrThrow()).getIndent()?b.dispatchCommand(l.OUTDENT_CONTENT_COMMAND):b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,
|
|
20
|
+
!0)},0),b.registerCommand(l.KEY_DELETE_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!1)},0),b.registerCommand(l.KEY_ENTER_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return c.shiftKey?b.dispatchCommand(l.INSERT_LINE_BREAK_COMMAND):b.dispatchCommand(l.INSERT_PARAGRAPH_COMMAND)},0),b.registerCommand(l.KEY_TAB_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;
|
|
21
|
+
c.preventDefault();return b.dispatchCommand(c.shiftKey?l.OUTDENT_CONTENT_COMMAND:l.INDENT_CONTENT_COMMAND)},0),b.registerCommand(l.KEY_ESCAPE_COMMAND,()=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.blur();return!0},0),b.registerCommand(l.DROP_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return!0},0),b.registerCommand(l.DRAGSTART_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return!0},
|
|
22
|
+
0),b.registerCommand(l.COPY_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(v(c,b),!0):!1},0),b.registerCommand(l.CUT_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(w(c,b),!0):!1},0),b.registerCommand(l.PASTE_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(u(c,b),!0):!1},0));t(b,e);return f};
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lexical/rich-text",
|
|
3
|
+
"description": "This package contains rich text helpers for Lexical.",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"lexical",
|
|
6
|
+
"editor",
|
|
7
|
+
"rich-text"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"version": "0.1.17",
|
|
11
|
+
"main": "LexicalRichText.js",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"lexical": "0.1.17",
|
|
14
|
+
"@lexical/selection": "0.1.17",
|
|
15
|
+
"@lexical/clipboard": "0.1.17",
|
|
16
|
+
"@lexical/utils": "0.1.17"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/facebook/lexical",
|
|
21
|
+
"directory": "packages/lexical-rich-text"
|
|
22
|
+
}
|
|
23
|
+
}
|