@lexical/rich-text 0.1.21 → 0.2.2
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/LexicalRichText.d.ts +5 -2
- package/LexicalRichText.dev.js +36 -31
- package/LexicalRichText.prod.js +11 -9
- package/package.json +5 -5
package/LexicalRichText.d.ts
CHANGED
|
@@ -12,13 +12,16 @@ import type {
|
|
|
12
12
|
LexicalNode,
|
|
13
13
|
NodeKey,
|
|
14
14
|
ParagraphNode,
|
|
15
|
+
HeadingNode,
|
|
15
16
|
} from 'lexical';
|
|
17
|
+
import {ElementNode} from 'lexical';
|
|
18
|
+
|
|
16
19
|
export type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
17
20
|
|
|
18
21
|
export declare class QuoteNode extends ElementNode {
|
|
19
22
|
static getType(): string;
|
|
20
23
|
static clone(node: QuoteNode): QuoteNode;
|
|
21
|
-
constructor(key?: NodeKey)
|
|
24
|
+
constructor(key?: NodeKey);
|
|
22
25
|
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
23
26
|
updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
|
|
24
27
|
insertNewAfter(): ParagraphNode;
|
|
@@ -31,7 +34,7 @@ export declare class HeadingNode extends ElementNode {
|
|
|
31
34
|
__tag: HeadingTagType;
|
|
32
35
|
static getType(): string;
|
|
33
36
|
static clone(node: HeadingNode): HeadingNode;
|
|
34
|
-
constructor(tag: HeadingTagType, key?: NodeKey)
|
|
37
|
+
constructor(tag: HeadingTagType, key?: NodeKey);
|
|
35
38
|
getTag(): HeadingTagType;
|
|
36
39
|
createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
|
|
37
40
|
updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
|
package/LexicalRichText.dev.js
CHANGED
|
@@ -285,7 +285,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
285
285
|
const isBackward = payload;
|
|
286
286
|
selection.deleteCharacter(isBackward);
|
|
287
287
|
return true;
|
|
288
|
-
},
|
|
288
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DELETE_WORD_COMMAND, payload => {
|
|
289
289
|
const selection = lexical.$getSelection();
|
|
290
290
|
|
|
291
291
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -295,7 +295,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
295
295
|
const isBackward = payload;
|
|
296
296
|
selection.deleteWord(isBackward);
|
|
297
297
|
return true;
|
|
298
|
-
},
|
|
298
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DELETE_LINE_COMMAND, payload => {
|
|
299
299
|
const selection = lexical.$getSelection();
|
|
300
300
|
|
|
301
301
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -305,7 +305,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
305
305
|
const isBackward = payload;
|
|
306
306
|
selection.deleteLine(isBackward);
|
|
307
307
|
return true;
|
|
308
|
-
},
|
|
308
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_TEXT_COMMAND, payload => {
|
|
309
309
|
const selection = lexical.$getSelection();
|
|
310
310
|
|
|
311
311
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -333,7 +333,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
return true;
|
|
336
|
-
},
|
|
336
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, payload => {
|
|
337
337
|
const selection = lexical.$getSelection();
|
|
338
338
|
|
|
339
339
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -342,7 +342,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
342
342
|
|
|
343
343
|
selection.removeText();
|
|
344
344
|
return true;
|
|
345
|
-
},
|
|
345
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.FORMAT_TEXT_COMMAND, payload => {
|
|
346
346
|
const selection = lexical.$getSelection();
|
|
347
347
|
|
|
348
348
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -352,18 +352,22 @@ function registerRichText(editor, initialEditorState) {
|
|
|
352
352
|
const format = payload;
|
|
353
353
|
selection.formatText(format);
|
|
354
354
|
return true;
|
|
355
|
-
},
|
|
355
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.FORMAT_ELEMENT_COMMAND, format => {
|
|
356
356
|
const selection = lexical.$getSelection();
|
|
357
357
|
|
|
358
|
-
if (!lexical.$isRangeSelection(selection)) {
|
|
358
|
+
if (!lexical.$isRangeSelection(selection) && !lexical.$isNodeSelection(selection)) {
|
|
359
359
|
return false;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
const nodes = selection.getNodes();
|
|
363
|
+
|
|
364
|
+
for (const node of nodes) {
|
|
365
|
+
const element = utils.$getNearestBlockElementAncestorOrThrow(node);
|
|
366
|
+
element.setFormat(format);
|
|
367
|
+
}
|
|
368
|
+
|
|
365
369
|
return true;
|
|
366
|
-
},
|
|
370
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_LINE_BREAK_COMMAND, payload => {
|
|
367
371
|
const selection = lexical.$getSelection();
|
|
368
372
|
|
|
369
373
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -373,7 +377,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
373
377
|
const selectStart = payload;
|
|
374
378
|
selection.insertLineBreak(selectStart);
|
|
375
379
|
return true;
|
|
376
|
-
},
|
|
380
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, payload => {
|
|
377
381
|
const selection = lexical.$getSelection();
|
|
378
382
|
|
|
379
383
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -382,7 +386,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
382
386
|
|
|
383
387
|
selection.insertParagraph();
|
|
384
388
|
return true;
|
|
385
|
-
},
|
|
389
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, payload => {
|
|
386
390
|
const selection = lexical.$getSelection();
|
|
387
391
|
|
|
388
392
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -402,7 +406,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
402
406
|
}
|
|
403
407
|
|
|
404
408
|
return true;
|
|
405
|
-
},
|
|
409
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, payload => {
|
|
406
410
|
const selection = lexical.$getSelection();
|
|
407
411
|
|
|
408
412
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -428,7 +432,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
428
432
|
}
|
|
429
433
|
|
|
430
434
|
return true;
|
|
431
|
-
},
|
|
435
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ARROW_LEFT_COMMAND, payload => {
|
|
432
436
|
const selection$1 = lexical.$getSelection();
|
|
433
437
|
|
|
434
438
|
if (!lexical.$isRangeSelection(selection$1)) {
|
|
@@ -445,7 +449,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
445
449
|
}
|
|
446
450
|
|
|
447
451
|
return false;
|
|
448
|
-
},
|
|
452
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ARROW_RIGHT_COMMAND, payload => {
|
|
449
453
|
const selection$1 = lexical.$getSelection();
|
|
450
454
|
|
|
451
455
|
if (!lexical.$isRangeSelection(selection$1)) {
|
|
@@ -462,7 +466,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
462
466
|
}
|
|
463
467
|
|
|
464
468
|
return false;
|
|
465
|
-
},
|
|
469
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, payload => {
|
|
466
470
|
const selection = lexical.$getSelection();
|
|
467
471
|
|
|
468
472
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -484,7 +488,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
484
488
|
}
|
|
485
489
|
|
|
486
490
|
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, true);
|
|
487
|
-
},
|
|
491
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_DELETE_COMMAND, payload => {
|
|
488
492
|
const selection = lexical.$getSelection();
|
|
489
493
|
|
|
490
494
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -494,22 +498,23 @@ function registerRichText(editor, initialEditorState) {
|
|
|
494
498
|
const event = payload;
|
|
495
499
|
event.preventDefault();
|
|
496
500
|
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, false);
|
|
497
|
-
},
|
|
501
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ENTER_COMMAND, event => {
|
|
498
502
|
const selection = lexical.$getSelection();
|
|
499
503
|
|
|
500
504
|
if (!lexical.$isRangeSelection(selection)) {
|
|
501
505
|
return false;
|
|
502
506
|
}
|
|
503
507
|
|
|
504
|
-
|
|
505
|
-
|
|
508
|
+
if (event !== null) {
|
|
509
|
+
event.preventDefault();
|
|
506
510
|
|
|
507
|
-
|
|
508
|
-
|
|
511
|
+
if (event.shiftKey) {
|
|
512
|
+
return editor.dispatchCommand(lexical.INSERT_LINE_BREAK_COMMAND);
|
|
513
|
+
}
|
|
509
514
|
}
|
|
510
515
|
|
|
511
516
|
return editor.dispatchCommand(lexical.INSERT_PARAGRAPH_COMMAND);
|
|
512
|
-
},
|
|
517
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_TAB_COMMAND, payload => {
|
|
513
518
|
const selection = lexical.$getSelection();
|
|
514
519
|
|
|
515
520
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -519,7 +524,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
519
524
|
const event = payload;
|
|
520
525
|
event.preventDefault();
|
|
521
526
|
return editor.dispatchCommand(event.shiftKey ? lexical.OUTDENT_CONTENT_COMMAND : lexical.INDENT_CONTENT_COMMAND);
|
|
522
|
-
},
|
|
527
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ESCAPE_COMMAND, payload => {
|
|
523
528
|
const selection = lexical.$getSelection();
|
|
524
529
|
|
|
525
530
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -528,7 +533,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
528
533
|
|
|
529
534
|
editor.blur();
|
|
530
535
|
return true;
|
|
531
|
-
},
|
|
536
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DROP_COMMAND, event => {
|
|
532
537
|
const selection = lexical.$getSelection();
|
|
533
538
|
|
|
534
539
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -538,7 +543,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
538
543
|
|
|
539
544
|
event.preventDefault();
|
|
540
545
|
return true;
|
|
541
|
-
},
|
|
546
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DRAGSTART_COMMAND, payload => {
|
|
542
547
|
const selection = lexical.$getSelection();
|
|
543
548
|
|
|
544
549
|
if (!lexical.$isRangeSelection(selection)) {
|
|
@@ -549,7 +554,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
549
554
|
const event = payload;
|
|
550
555
|
event.preventDefault();
|
|
551
556
|
return true;
|
|
552
|
-
},
|
|
557
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.COPY_COMMAND, payload => {
|
|
553
558
|
const selection = lexical.$getSelection();
|
|
554
559
|
|
|
555
560
|
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
@@ -559,7 +564,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
559
564
|
}
|
|
560
565
|
|
|
561
566
|
return false;
|
|
562
|
-
},
|
|
567
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.CUT_COMMAND, payload => {
|
|
563
568
|
const selection = lexical.$getSelection();
|
|
564
569
|
|
|
565
570
|
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
@@ -569,7 +574,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
569
574
|
}
|
|
570
575
|
|
|
571
576
|
return false;
|
|
572
|
-
},
|
|
577
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.PASTE_COMMAND, event => {
|
|
573
578
|
const selection = lexical.$getSelection();
|
|
574
579
|
|
|
575
580
|
if (lexical.$isRangeSelection(selection) || lexical.$isGridSelection(selection)) {
|
|
@@ -578,7 +583,7 @@ function registerRichText(editor, initialEditorState) {
|
|
|
578
583
|
}
|
|
579
584
|
|
|
580
585
|
return false;
|
|
581
|
-
},
|
|
586
|
+
}, lexical.COMMAND_PRIORITY_EDITOR));
|
|
582
587
|
initializeEditor(editor, initialEditorState);
|
|
583
588
|
return removeListener;
|
|
584
589
|
}
|
package/LexicalRichText.prod.js
CHANGED
|
@@ -11,12 +11,14 @@ class p extends l.ElementNode{static getType(){return"heading"}static clone(b){r
|
|
|
11
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
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
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},
|
|
15
|
-
{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteLine(c);return!0},
|
|
16
|
-
|
|
17
|
-
if(!l.$isRangeSelection(
|
|
18
|
-
|
|
19
|
-
c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;const g=c.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(d,!
|
|
20
|
-
|
|
21
|
-
c.preventDefault();return b.dispatchCommand(
|
|
22
|
-
|
|
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},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DELETE_WORD_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteWord(c);return!0},l.COMMAND_PRIORITY_EDITOR),
|
|
15
|
+
b.registerCommand(l.DELETE_LINE_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteLine(c);return!0},l.COMMAND_PRIORITY_EDITOR),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},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.REMOVE_TEXT_COMMAND,()=>{const c=l.$getSelection();
|
|
16
|
+
if(!l.$isRangeSelection(c))return!1;c.removeText();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.FORMAT_TEXT_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.formatText(c);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.FORMAT_ELEMENT_COMMAND,c=>{var d=l.$getSelection();if(!l.$isRangeSelection(d)&&!l.$isNodeSelection(d))return!1;d=d.getNodes();for(const g of d)k.$getNearestBlockElementAncestorOrThrow(g).setFormat(c);return!0},l.COMMAND_PRIORITY_EDITOR),
|
|
17
|
+
b.registerCommand(l.INSERT_LINE_BREAK_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.insertLineBreak(c);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.INSERT_PARAGRAPH_COMMAND,()=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.insertParagraph();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.INDENT_CONTENT_COMMAND,()=>{var c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c=k.$getNearestBlockElementAncestorOrThrow(c.anchor.getNode());
|
|
18
|
+
c.canInsertTab()?b.dispatchCommand(l.INSERT_TEXT_COMMAND,"\t"):10!==c.getIndent()&&c.setIndent(c.getIndent()+1);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.OUTDENT_CONTENT_COMMAND,()=>{var c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c=c.anchor;const d=c.getNode(),g=k.$getNearestBlockElementAncestorOrThrow(c.getNode());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},
|
|
19
|
+
l.COMMAND_PRIORITY_EDITOR),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},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ARROW_RIGHT_COMMAND,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,
|
|
20
|
+
g,!1),!0):!1},l.COMMAND_PRIORITY_EDITOR),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<k.$getNearestBlockElementAncestorOrThrow(c.getNode()).getIndent()?b.dispatchCommand(l.OUTDENT_CONTENT_COMMAND):b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_DELETE_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;
|
|
21
|
+
c.preventDefault();return b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!1)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ENTER_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)?null!==c&&(c.preventDefault(),c.shiftKey)?b.dispatchCommand(l.INSERT_LINE_BREAK_COMMAND):b.dispatchCommand(l.INSERT_PARAGRAPH_COMMAND):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_TAB_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return b.dispatchCommand(c.shiftKey?
|
|
22
|
+
l.OUTDENT_CONTENT_COMMAND:l.INDENT_CONTENT_COMMAND)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ESCAPE_COMMAND,()=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.blur();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DROP_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DRAGSTART_COMMAND,c=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;c.preventDefault();
|
|
23
|
+
return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.COPY_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(v(c,b),!0):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.CUT_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(w(c,b),!0):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.PASTE_COMMAND,c=>{const d=l.$getSelection();return l.$isRangeSelection(d)||l.$isGridSelection(d)?(u(c,b),!0):!1},l.COMMAND_PRIORITY_EDITOR));
|
|
24
|
+
t(b,e);return f};
|
package/package.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"rich-text"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.2.2",
|
|
11
11
|
"main": "LexicalRichText.js",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"lexical": "0.
|
|
14
|
-
"@lexical/selection": "0.
|
|
15
|
-
"@lexical/clipboard": "0.
|
|
16
|
-
"@lexical/utils": "0.
|
|
13
|
+
"lexical": "0.2.2",
|
|
14
|
+
"@lexical/selection": "0.2.2",
|
|
15
|
+
"@lexical/clipboard": "0.2.2",
|
|
16
|
+
"@lexical/utils": "0.2.2"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|