@lexical/rich-text 0.10.0 → 0.11.0
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.dev.js +60 -26
- package/LexicalRichText.prod.js +27 -26
- package/index.d.ts +3 -1
- package/package.json +5 -5
package/LexicalRichText.dev.js
CHANGED
|
@@ -113,6 +113,30 @@ class QuoteNode extends lexical.ElementNode {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
exportDOM(editor) {
|
|
117
|
+
const {
|
|
118
|
+
element
|
|
119
|
+
} = super.exportDOM(editor);
|
|
120
|
+
|
|
121
|
+
if (element && this.isEmpty()) {
|
|
122
|
+
element.append(document.createElement('br'));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (element) {
|
|
126
|
+
const formatType = this.getFormatType();
|
|
127
|
+
element.style.textAlign = formatType;
|
|
128
|
+
const direction = this.getDirection();
|
|
129
|
+
|
|
130
|
+
if (direction) {
|
|
131
|
+
element.dir = direction;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
element
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
116
140
|
static importJSON(serializedNode) {
|
|
117
141
|
const node = $createQuoteNode();
|
|
118
142
|
node.setFormat(serializedNode.format);
|
|
@@ -250,6 +274,30 @@ class HeadingNode extends lexical.ElementNode {
|
|
|
250
274
|
};
|
|
251
275
|
}
|
|
252
276
|
|
|
277
|
+
exportDOM(editor) {
|
|
278
|
+
const {
|
|
279
|
+
element
|
|
280
|
+
} = super.exportDOM(editor);
|
|
281
|
+
|
|
282
|
+
if (element && this.isEmpty()) {
|
|
283
|
+
element.append(document.createElement('br'));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (element) {
|
|
287
|
+
const formatType = this.getFormatType();
|
|
288
|
+
element.style.textAlign = formatType;
|
|
289
|
+
const direction = this.getDirection();
|
|
290
|
+
|
|
291
|
+
if (direction) {
|
|
292
|
+
element.dir = direction;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return {
|
|
297
|
+
element
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
253
301
|
static importJSON(serializedNode) {
|
|
254
302
|
const node = $createHeadingNode(serializedNode.tag);
|
|
255
303
|
node.setFormat(serializedNode.format);
|
|
@@ -374,11 +422,11 @@ function eventFiles(event) {
|
|
|
374
422
|
return [hasFiles, Array.from(dataTransfer.files), hasContent];
|
|
375
423
|
}
|
|
376
424
|
|
|
377
|
-
function handleIndentAndOutdent(
|
|
425
|
+
function handleIndentAndOutdent(indentOrOutdent) {
|
|
378
426
|
const selection = lexical.$getSelection();
|
|
379
427
|
|
|
380
428
|
if (!lexical.$isRangeSelection(selection)) {
|
|
381
|
-
return;
|
|
429
|
+
return false;
|
|
382
430
|
}
|
|
383
431
|
|
|
384
432
|
const alreadyHandled = new Set();
|
|
@@ -395,14 +443,13 @@ function handleIndentAndOutdent(insertTab, indentOrOutdent) {
|
|
|
395
443
|
const parentBlock = utils.$getNearestBlockElementAncestorOrThrow(node);
|
|
396
444
|
const parentKey = parentBlock.getKey();
|
|
397
445
|
|
|
398
|
-
if (parentBlock.
|
|
399
|
-
insertTab(node);
|
|
400
|
-
alreadyHandled.add(key);
|
|
401
|
-
} else if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {
|
|
446
|
+
if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {
|
|
402
447
|
alreadyHandled.add(parentKey);
|
|
403
448
|
indentOrOutdent(parentBlock);
|
|
404
449
|
}
|
|
405
450
|
}
|
|
451
|
+
|
|
452
|
+
return alreadyHandled.size > 0;
|
|
406
453
|
}
|
|
407
454
|
|
|
408
455
|
function $isTargetWithinDecorator(target) {
|
|
@@ -531,35 +578,22 @@ function registerRichText(editor) {
|
|
|
531
578
|
|
|
532
579
|
selection.insertParagraph();
|
|
533
580
|
return true;
|
|
581
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_TAB_COMMAND, () => {
|
|
582
|
+
lexical.$insertNodes([lexical.$createTabNode()]);
|
|
583
|
+
return true;
|
|
534
584
|
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, () => {
|
|
535
|
-
handleIndentAndOutdent(
|
|
536
|
-
editor.dispatchCommand(lexical.CONTROLLED_TEXT_INSERTION_COMMAND, '\t');
|
|
537
|
-
}, block => {
|
|
585
|
+
return handleIndentAndOutdent(block => {
|
|
538
586
|
const indent = block.getIndent();
|
|
539
|
-
|
|
540
|
-
if (indent !== 10) {
|
|
541
|
-
block.setIndent(indent + 1);
|
|
542
|
-
}
|
|
587
|
+
block.setIndent(indent + 1);
|
|
543
588
|
});
|
|
544
|
-
return true;
|
|
545
589
|
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.OUTDENT_CONTENT_COMMAND, () => {
|
|
546
|
-
handleIndentAndOutdent(
|
|
547
|
-
if (lexical.$isTextNode(node)) {
|
|
548
|
-
const textContent = node.getTextContent();
|
|
549
|
-
const character = textContent[textContent.length - 1];
|
|
550
|
-
|
|
551
|
-
if (character === '\t') {
|
|
552
|
-
editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, true);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}, block => {
|
|
590
|
+
return handleIndentAndOutdent(block => {
|
|
556
591
|
const indent = block.getIndent();
|
|
557
592
|
|
|
558
|
-
if (indent
|
|
593
|
+
if (indent > 0) {
|
|
559
594
|
block.setIndent(indent - 1);
|
|
560
595
|
}
|
|
561
596
|
});
|
|
562
|
-
return true;
|
|
563
597
|
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ARROW_UP_COMMAND, event => {
|
|
564
598
|
const selection = lexical.$getSelection();
|
|
565
599
|
|
package/LexicalRichText.prod.js
CHANGED
|
@@ -4,29 +4,30 @@
|
|
|
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
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
class
|
|
11
|
-
b){
|
|
12
|
-
class
|
|
13
|
-
priority:0}),h6:()=>({conversion:
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
exports
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
()
|
|
24
|
-
|
|
25
|
-
0)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const f=
|
|
7
|
+
'use strict';var c=require("@lexical/clipboard"),g=require("@lexical/selection"),h=require("@lexical/utils"),k=require("lexical");function l(a,b){return"undefined"!==typeof document.caretRangeFromPoint?(a=document.caretRangeFromPoint(a,b),null===a?null:{node:a.startContainer,offset:a.startOffset}):"undefined"!==document.caretPositionFromPoint?(a=document.caretPositionFromPoint(a,b),null===a?null:{node:a.offsetNode,offset:a.offset}):null}
|
|
8
|
+
let n="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,p=n&&"documentMode"in document?document.documentMode:null;n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
9
|
+
let q=n&&"InputEvent"in window&&!p?"getTargetRanges"in new window.InputEvent("input"):!1,r=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),t=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),v=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!u,w=k.createCommand("DRAG_DROP_PASTE_FILE");
|
|
10
|
+
class x extends k.ElementNode{static getType(){return"quote"}static clone(a){return new x(a.__key)}constructor(a){super(a)}createDOM(a){let b=document.createElement("blockquote");h.addClassNamesToElement(b,a.theme.quote);return b}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:y,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=
|
|
11
|
+
b}return{element:a}}static importJSON(a){let b=z();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(a,b){a=k.$createParagraphNode();let d=this.getDirection();a.setDirection(d);this.insertAfter(a,b);return a}collapseAtStart(){let a=k.$createParagraphNode();this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}}function z(){return k.$applyNodeReplacement(new x)}
|
|
12
|
+
class B extends k.ElementNode{static getType(){return"heading"}static clone(a){return new B(a.__tag,a.__key)}constructor(a,b){super(b);this.__tag=a}getTag(){return this.__tag}createDOM(a){let b=this.__tag,d=document.createElement(b);a=a.theme.heading;void 0!==a&&h.addClassNamesToElement(d,a[b]);return d}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:C,priority:0}),h2:()=>({conversion:C,priority:0}),h3:()=>({conversion:C,priority:0}),h4:()=>({conversion:C,priority:0}),h5:()=>({conversion:C,
|
|
13
|
+
priority:0}),h6:()=>({conversion:C,priority:0}),p:a=>{a=a.firstChild;return null!==a&&D(a)?{conversion:()=>({node:null}),priority:3}:null},span:a=>D(a)?{conversion:()=>({node:E("h1")}),priority:3}:null}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b}return{element:a}}static importJSON(a){let b=E(a.tag);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);
|
|
14
|
+
return b}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(a,b=!0){a=a?a.anchor.offset:0;a=0<a&&a<this.getTextContentSize()?E(this.getTag()):k.$createParagraphNode();let d=this.getDirection();a.setDirection(d);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.isEmpty()?k.$createParagraphNode():E(this.getTag());this.getChildren().forEach(b=>a.append(b));this.replace(a);return!0}extractWithChild(){return!0}}
|
|
15
|
+
function D(a){return"span"===a.nodeName.toLowerCase()?"26pt"===a.style.fontSize:!1}function C(a){a=a.nodeName.toLowerCase();let b=null;if("h1"===a||"h2"===a||"h3"===a||"h4"===a||"h5"===a||"h6"===a)b=E(a);return{node:b}}function y(){return{node:z()}}function E(a){return k.$applyNodeReplacement(new B(a))}
|
|
16
|
+
function F(a,b){a.preventDefault();b.update(()=>{let d=k.$getSelection(),e=a instanceof InputEvent||a instanceof KeyboardEvent?null:a.clipboardData;null!=e&&(k.$isRangeSelection(d)||k.DEPRECATED_$isGridSelection(d))&&c.$insertDataTransferForRichText(e,d,b)},{tag:"paste"})}async function G(a,b){await c.copyToClipboard(b,a instanceof ClipboardEvent?a:null);b.update(()=>{let d=k.$getSelection();k.$isRangeSelection(d)?d.removeText():k.$isNodeSelection(d)&&d.getNodes().forEach(e=>e.remove())})}
|
|
17
|
+
function H(a){let b=null;a instanceof DragEvent?b=a.dataTransfer:a instanceof ClipboardEvent&&(b=a.clipboardData);if(null===b)return[!1,[],!1];var d=b.types;a=d.includes("Files");d=d.includes("text/html")||d.includes("text/plain");return[a,Array.from(b.files),d]}
|
|
18
|
+
function I(a){var b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;let d=new Set;b=b.getNodes();for(let m=0;m<b.length;m++){var e=b[m],f=e.getKey();d.has(f)||(e=h.$getNearestBlockElementAncestorOrThrow(e),f=e.getKey(),e.canIndent()&&!d.has(f)&&(d.add(f),a(e)))}return 0<d.size}function J(a){a=k.$getNearestNodeFromDOMNode(a);return k.$isDecoratorNode(a)}exports.$createHeadingNode=E;exports.$createQuoteNode=z;exports.$isHeadingNode=function(a){return a instanceof B};
|
|
19
|
+
exports.$isQuoteNode=function(a){return a instanceof x};exports.DRAG_DROP_PASTE=w;exports.HeadingNode=B;exports.QuoteNode=x;exports.eventFiles=H;
|
|
20
|
+
exports.registerRichText=function(a){return h.mergeRegister(a.registerCommand(k.CLICK_COMMAND,()=>{const b=k.$getSelection();return k.$isNodeSelection(b)?(b.clear(),!0):!1},0),a.registerCommand(k.DELETE_CHARACTER_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteCharacter(b);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.DELETE_WORD_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteWord(b);return!0},k.COMMAND_PRIORITY_EDITOR),
|
|
21
|
+
a.registerCommand(k.DELETE_LINE_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteLine(b);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.CONTROLLED_TEXT_INSERTION_COMMAND,b=>{const d=k.$getSelection();if("string"===typeof b)k.$isRangeSelection(d)?d.insertText(b):k.DEPRECATED_$isGridSelection(d);else{if(!k.$isRangeSelection(d)&&!k.DEPRECATED_$isGridSelection(d))return!1;const e=b.dataTransfer;null!=e?c.$insertDataTransferForRichText(e,d,a):k.$isRangeSelection(d)&&
|
|
22
|
+
(b=b.data)&&d.insertText(b)}return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.REMOVE_TEXT_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;b.removeText();return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.FORMAT_TEXT_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.formatText(b);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.FORMAT_ELEMENT_COMMAND,b=>{var d=k.$getSelection();if(!k.$isRangeSelection(d)&&!k.$isNodeSelection(d))return!1;
|
|
23
|
+
d=d.getNodes();for(const e of d)h.$getNearestBlockElementAncestorOrThrow(e).setFormat(b);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.INSERT_LINE_BREAK_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.insertLineBreak(b);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.INSERT_PARAGRAPH_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;b.insertParagraph();return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.INSERT_TAB_COMMAND,
|
|
24
|
+
()=>{k.$insertNodes([k.$createTabNode()]);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.INDENT_CONTENT_COMMAND,()=>I(b=>{const d=b.getIndent();b.setIndent(d+1)}),k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.OUTDENT_CONTENT_COMMAND,()=>I(b=>{const d=b.getIndent();0<d&&b.setIndent(d-1)}),k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ARROW_UP_COMMAND,b=>{var d=k.$getSelection();if(k.$isNodeSelection(d)&&!J(b.target)){if(b=d.getNodes(),0<b.length)return b[0].selectPrevious(),!0}else if(k.$isRangeSelection(d)){d=
|
|
25
|
+
k.$getAdjacentNode(d.focus,!0);if(k.$isDecoratorNode(d)&&!d.isIsolated()&&!d.isInline())return d.selectPrevious(),b.preventDefault(),!0;if(k.$isElementNode(d)&&!d.isInline()&&!d.canBeEmpty())return d.select(),b.preventDefault(),!0}return!1},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ARROW_DOWN_COMMAND,b=>{var d=k.$getSelection();if(k.$isNodeSelection(d)){if(b=d.getNodes(),0<b.length)return b[0].selectNext(0,0),!0}else if(k.$isRangeSelection(d)){let e=d.focus;if("root"===e.key&&e.offset===
|
|
26
|
+
k.$getRoot().getChildrenSize())return b.preventDefault(),!0;d=k.$getAdjacentNode(d.focus,!1);if(k.$isDecoratorNode(d)&&!d.isIsolated()&&!d.isInline())return d.selectNext(),b.preventDefault(),!0}return!1},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ARROW_LEFT_COMMAND,b=>{const d=k.$getSelection();if(k.$isNodeSelection(d)){var e=d.getNodes();if(0<e.length)return b.preventDefault(),e[0].selectPrevious(),!0}return k.$isRangeSelection(d)?g.$shouldOverrideDefaultCharacterSelection(d,!0)?(e=b.shiftKey,
|
|
27
|
+
b.preventDefault(),g.$moveCharacter(d,e,!0),!0):!1:!1},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ARROW_RIGHT_COMMAND,b=>{const d=k.$getSelection();if(k.$isNodeSelection(d)&&!J(b.target)){var e=d.getNodes();if(0<e.length)return b.preventDefault(),e[0].selectNext(0,0),!0}if(!k.$isRangeSelection(d))return!1;e=b.shiftKey;return g.$shouldOverrideDefaultCharacterSelection(d,!1)?(b.preventDefault(),g.$moveCharacter(d,e,!1),!0):!1},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_BACKSPACE_COMMAND,
|
|
28
|
+
b=>{if(J(b.target))return!1;const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;b.preventDefault();({anchor:b}=d);const e=b.getNode();return d.isCollapsed()&&0===b.offset&&!k.$isRootNode(e)&&0<h.$getNearestBlockElementAncestorOrThrow(e).getIndent()?a.dispatchCommand(k.OUTDENT_CONTENT_COMMAND,void 0):a.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!0)},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_DELETE_COMMAND,b=>{if(J(b.target))return!1;const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;
|
|
29
|
+
b.preventDefault();return a.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!1)},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ENTER_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;if(null!==b){if((t||r||v)&&q)return!1;b.preventDefault();if(b.shiftKey)return a.dispatchCommand(k.INSERT_LINE_BREAK_COMMAND,!1)}return a.dispatchCommand(k.INSERT_PARAGRAPH_COMMAND,void 0)},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.KEY_ESCAPE_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;
|
|
30
|
+
a.blur();return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.DROP_COMMAND,b=>{const [,d]=H(b);if(0<d.length){var e=l(b.clientX,b.clientY);if(null!==e){const {offset:m,node:K}=e;var f=k.$getNearestNodeFromDOMNode(K);if(null!==f){e=k.$createRangeSelection();if(k.$isTextNode(f))e.anchor.set(f.getKey(),m,"text"),e.focus.set(f.getKey(),m,"text");else{const A=f.getParentOrThrow().getKey();f=f.getIndexWithinParent()+1;e.anchor.set(A,f,"element");e.focus.set(A,f,"element")}e=k.$normalizeSelection__EXPERIMENTAL(e);
|
|
31
|
+
k.$setSelection(e)}a.dispatchCommand(w,d)}b.preventDefault();return!0}b=k.$getSelection();return k.$isRangeSelection(b)?!0:!1},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.DRAGSTART_COMMAND,b=>{[b]=H(b);const d=k.$getSelection();return b&&!k.$isRangeSelection(d)?!1:!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.DRAGOVER_COMMAND,b=>{var [d]=H(b);const e=k.$getSelection();if(d&&!k.$isRangeSelection(e))return!1;d=l(b.clientX,b.clientY);null!==d&&(d=k.$getNearestNodeFromDOMNode(d.node),k.$isDecoratorNode(d)&&
|
|
32
|
+
b.preventDefault());return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.COPY_COMMAND,b=>{c.copyToClipboard(a,b instanceof ClipboardEvent?b:null);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.CUT_COMMAND,b=>{G(b,a);return!0},k.COMMAND_PRIORITY_EDITOR),a.registerCommand(k.PASTE_COMMAND,b=>{const [,d,e]=H(b);if(0<d.length&&!e)return a.dispatchCommand(w,d),!0;if(k.isSelectionCapturedInDecoratorInput(b.target))return!1;const f=k.$getSelection();return k.$isRangeSelection(f)||k.DEPRECATED_$isGridSelection(f)?
|
|
33
|
+
(F(b,a),!0):!1},k.COMMAND_PRIORITY_EDITOR))}
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
import type { DOMConversionMap, EditorConfig, LexicalCommand, LexicalEditor, LexicalNode, NodeKey, ParagraphNode, PasteCommandType, RangeSelection, SerializedElementNode, Spread } from 'lexical';
|
|
9
|
+
import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalCommand, LexicalEditor, LexicalNode, NodeKey, ParagraphNode, PasteCommandType, RangeSelection, SerializedElementNode, Spread } from 'lexical';
|
|
10
10
|
import { ElementNode } from 'lexical';
|
|
11
11
|
export declare type SerializedHeadingNode = Spread<{
|
|
12
12
|
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
@@ -21,6 +21,7 @@ export declare class QuoteNode extends ElementNode {
|
|
|
21
21
|
createDOM(config: EditorConfig): HTMLElement;
|
|
22
22
|
updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
|
|
23
23
|
static importDOM(): DOMConversionMap | null;
|
|
24
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
24
25
|
static importJSON(serializedNode: SerializedQuoteNode): QuoteNode;
|
|
25
26
|
exportJSON(): SerializedElementNode;
|
|
26
27
|
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode;
|
|
@@ -40,6 +41,7 @@ export declare class HeadingNode extends ElementNode {
|
|
|
40
41
|
createDOM(config: EditorConfig): HTMLElement;
|
|
41
42
|
updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
|
|
42
43
|
static importDOM(): DOMConversionMap | null;
|
|
44
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
43
45
|
static importJSON(serializedNode: SerializedHeadingNode): HeadingNode;
|
|
44
46
|
exportJSON(): SerializedHeadingNode;
|
|
45
47
|
insertNewAfter(selection?: RangeSelection, restoreSelection?: boolean): ParagraphNode | HeadingNode;
|
package/package.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"rich-text"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.11.0",
|
|
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.11.0",
|
|
14
|
+
"@lexical/selection": "0.11.0",
|
|
15
|
+
"@lexical/clipboard": "0.11.0",
|
|
16
|
+
"@lexical/utils": "0.11.0"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|