@lexical/rich-text 0.6.3 → 0.6.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/LexicalRichText.dev.js +53 -27
- package/LexicalRichText.prod.js +25 -24
- package/index.d.ts +2 -2
- package/package.json +5 -5
package/LexicalRichText.dev.js
CHANGED
|
@@ -20,10 +20,28 @@ var lexical = require('lexical');
|
|
|
20
20
|
*/
|
|
21
21
|
function caretFromPoint(x, y) {
|
|
22
22
|
if (typeof document.caretRangeFromPoint !== 'undefined') {
|
|
23
|
-
|
|
23
|
+
const range = document.caretRangeFromPoint(x, y);
|
|
24
|
+
|
|
25
|
+
if (range === null) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
node: range.startContainer,
|
|
31
|
+
offset: range.startOffset
|
|
32
|
+
}; // @ts-ignore
|
|
24
33
|
} else if (document.caretPositionFromPoint !== 'undefined') {
|
|
25
34
|
// @ts-ignore FF - no types
|
|
26
|
-
|
|
35
|
+
const range = document.caretPositionFromPoint(x, y);
|
|
36
|
+
|
|
37
|
+
if (range === null) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
node: range.offsetNode,
|
|
43
|
+
offset: range.offset
|
|
44
|
+
};
|
|
27
45
|
} else {
|
|
28
46
|
// Gracefully handle IE
|
|
29
47
|
return null;
|
|
@@ -53,8 +71,8 @@ const CAN_USE_BEFORE_INPUT = CAN_USE_DOM && 'InputEvent' in window && !documentM
|
|
|
53
71
|
const IS_SAFARI = CAN_USE_DOM && /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
|
54
72
|
const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; // Keep these in case we need to use them in the future.
|
|
55
73
|
// export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
|
|
56
|
-
|
|
57
|
-
// export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
|
|
74
|
+
|
|
75
|
+
CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent); // export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
|
|
58
76
|
|
|
59
77
|
/** @module @lexical/rich-text */
|
|
60
78
|
const DRAG_DROP_PASTE = lexical.createCommand('DRAG_DROP_PASTE_FILE');
|
|
@@ -247,8 +265,9 @@ class HeadingNode extends lexical.ElementNode {
|
|
|
247
265
|
} // Mutation
|
|
248
266
|
|
|
249
267
|
|
|
250
|
-
insertNewAfter() {
|
|
251
|
-
const
|
|
268
|
+
insertNewAfter(selection) {
|
|
269
|
+
const anchorOffet = selection ? selection.anchor.offset : 0;
|
|
270
|
+
const newElement = anchorOffet > 0 && anchorOffet < this.getTextContentSize() ? $createHeadingNode(this.getTag()) : lexical.$createParagraphNode();
|
|
252
271
|
const direction = this.getDirection();
|
|
253
272
|
newElement.setDirection(direction);
|
|
254
273
|
this.insertAfter(newElement);
|
|
@@ -256,10 +275,10 @@ class HeadingNode extends lexical.ElementNode {
|
|
|
256
275
|
}
|
|
257
276
|
|
|
258
277
|
collapseAtStart() {
|
|
259
|
-
const
|
|
278
|
+
const newElement = !this.isEmpty() ? $createHeadingNode(this.getTag()) : lexical.$createParagraphNode();
|
|
260
279
|
const children = this.getChildren();
|
|
261
|
-
children.forEach(child =>
|
|
262
|
-
this.replace(
|
|
280
|
+
children.forEach(child => newElement.append(child));
|
|
281
|
+
this.replace(newElement);
|
|
263
282
|
return true;
|
|
264
283
|
}
|
|
265
284
|
|
|
@@ -713,27 +732,22 @@ function registerRichText(editor) {
|
|
|
713
732
|
|
|
714
733
|
if (eventRange !== null) {
|
|
715
734
|
const {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
startContainer,
|
|
719
|
-
endContainer
|
|
735
|
+
offset: domOffset,
|
|
736
|
+
node: domNode
|
|
720
737
|
} = eventRange;
|
|
721
|
-
const
|
|
722
|
-
const endNode = lexical.$getNearestNodeFromDOMNode(endContainer);
|
|
738
|
+
const node = lexical.$getNearestNodeFromDOMNode(domNode);
|
|
723
739
|
|
|
724
|
-
if (
|
|
740
|
+
if (node !== null) {
|
|
725
741
|
const selection = lexical.$createRangeSelection();
|
|
726
742
|
|
|
727
|
-
if (lexical.$isTextNode(
|
|
728
|
-
selection.anchor.set(
|
|
729
|
-
|
|
730
|
-
selection.anchor.set(startNode.getParentOrThrow().getKey(), startNode.getIndexWithinParent() + 1, 'element');
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
if (lexical.$isTextNode(endNode)) {
|
|
734
|
-
selection.focus.set(endNode.getKey(), endOffset, 'text');
|
|
743
|
+
if (lexical.$isTextNode(node)) {
|
|
744
|
+
selection.anchor.set(node.getKey(), domOffset, 'text');
|
|
745
|
+
selection.focus.set(node.getKey(), domOffset, 'text');
|
|
735
746
|
} else {
|
|
736
|
-
|
|
747
|
+
const parentKey = node.getParentOrThrow().getKey();
|
|
748
|
+
const offset = node.getIndexWithinParent() + 1;
|
|
749
|
+
selection.anchor.set(parentKey, offset, 'element');
|
|
750
|
+
selection.focus.set(parentKey, offset, 'element');
|
|
737
751
|
}
|
|
738
752
|
|
|
739
753
|
const normalizedSelection = lexical.$normalizeSelection__EXPERIMENTAL(selection);
|
|
@@ -762,7 +776,6 @@ function registerRichText(editor) {
|
|
|
762
776
|
return false;
|
|
763
777
|
}
|
|
764
778
|
|
|
765
|
-
event.preventDefault();
|
|
766
779
|
return true;
|
|
767
780
|
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DRAGOVER_COMMAND, event => {
|
|
768
781
|
const [isFileTransfer] = eventFiles(event);
|
|
@@ -772,7 +785,20 @@ function registerRichText(editor) {
|
|
|
772
785
|
return false;
|
|
773
786
|
}
|
|
774
787
|
|
|
775
|
-
event.
|
|
788
|
+
const x = event.clientX;
|
|
789
|
+
const y = event.clientY;
|
|
790
|
+
const eventRange = caretFromPoint(x, y);
|
|
791
|
+
|
|
792
|
+
if (eventRange !== null) {
|
|
793
|
+
const node = lexical.$getNearestNodeFromDOMNode(eventRange.node);
|
|
794
|
+
|
|
795
|
+
if (lexical.$isDecoratorNode(node)) {
|
|
796
|
+
// Show browser caret as the user is dragging the media across the screen. Won't work
|
|
797
|
+
// for DecoratorNode nor it's relevant.
|
|
798
|
+
event.preventDefault();
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
776
802
|
return true;
|
|
777
803
|
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.COPY_COMMAND, event => {
|
|
778
804
|
clipboard.copyToClipboard__EXPERIMENTAL(editor, event instanceof ClipboardEvent ? event : null);
|
package/LexicalRichText.prod.js
CHANGED
|
@@ -4,27 +4,28 @@
|
|
|
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 r=
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
exports
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
()
|
|
23
|
-
|
|
24
|
-
!0)?(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
e=
|
|
30
|
-
|
|
7
|
+
'use strict';var c=require("@lexical/clipboard"),g=require("@lexical/selection"),k=require("@lexical/utils"),l=require("lexical");function m(b,a){return"undefined"!==typeof document.caretRangeFromPoint?(b=document.caretRangeFromPoint(b,a),null===b?null:{node:b.startContainer,offset:b.startOffset}):"undefined"!==document.caretPositionFromPoint?(b=document.caretPositionFromPoint(b,a),null===b?null:{node:b.offsetNode,offset:b.offset}):null}
|
|
8
|
+
let p="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,q=p&&"documentMode"in document?document.documentMode:null;p&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);p&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);let r=p&&"InputEvent"in window&&!q?"getTargetRanges"in new window.InputEvent("input"):!1,t=p&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),u=p&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;
|
|
9
|
+
p&&/^(?=.*Chrome).*/i.test(navigator.userAgent);let w=l.createCommand("DRAG_DROP_PASTE_FILE");
|
|
10
|
+
class x extends l.ElementNode{static getType(){return"quote"}static clone(b){return new x(b.__key)}constructor(b){super(b)}createDOM(b){let a=document.createElement("blockquote");k.addClassNamesToElement(a,b.theme.quote);return a}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:y,priority:0})}}static importJSON(b){let a=z();a.setFormat(b.format);a.setIndent(b.indent);a.setDirection(b.direction);return a}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(){let b=
|
|
11
|
+
l.$createParagraphNode(),a=this.getDirection();b.setDirection(a);this.insertAfter(b);return b}collapseAtStart(){let b=l.$createParagraphNode();this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}}function z(){return l.$applyNodeReplacement(new x)}
|
|
12
|
+
class A extends l.ElementNode{static getType(){return"heading"}static clone(b){return new A(b.__tag,b.__key)}constructor(b,a){super(a);this.__tag=b}getTag(){return this.__tag}createDOM(b){let a=this.__tag,d=document.createElement(a);b=b.theme.heading;void 0!==b&&k.addClassNamesToElement(d,b[a]);return d}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:B,priority:0}),h2:()=>({conversion:B,priority:0}),h3:()=>({conversion:B,priority:0}),h4:()=>({conversion:B,priority:0}),h5:()=>({conversion:B,
|
|
13
|
+
priority:0}),h6:()=>({conversion:B,priority:0}),p:b=>{b=b.firstChild;return null!==b&&D(b)?{conversion:()=>({node:null}),priority:3}:null},span:b=>D(b)?{conversion:()=>({node:E("h1")}),priority:3}:null}}static importJSON(b){let a=E(b.tag);a.setFormat(b.format);a.setIndent(b.indent);a.setDirection(b.direction);return a}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(b){b=b?b.anchor.offset:0;b=0<b&&b<this.getTextContentSize()?E(this.getTag()):l.$createParagraphNode();
|
|
14
|
+
let a=this.getDirection();b.setDirection(a);this.insertAfter(b);return b}collapseAtStart(){let b=this.isEmpty()?l.$createParagraphNode():E(this.getTag());this.getChildren().forEach(a=>b.append(a));this.replace(b);return!0}extractWithChild(){return!0}}function D(b){return"span"===b.nodeName.toLowerCase()?"26pt"===b.style.fontSize:!1}function B(b){b=b.nodeName.toLowerCase();let a=null;if("h1"===b||"h2"===b||"h3"===b||"h4"===b||"h5"===b||"h6"===b)a=E(b);return{node:a}}function y(){return{node:z()}}
|
|
15
|
+
function E(b){return l.$applyNodeReplacement(new A(b))}function F(b,a){b.preventDefault();a.update(()=>{let d=l.$getSelection(),e=b instanceof InputEvent||b instanceof KeyboardEvent?null:b.clipboardData;null!=e&&(l.$isRangeSelection(d)||l.DEPRECATED_$isGridSelection(d))&&c.$insertDataTransferForRichText(e,d,a)},{tag:"paste"})}
|
|
16
|
+
async function G(b,a){await c.copyToClipboard__EXPERIMENTAL(a,b instanceof ClipboardEvent?b:null);a.update(()=>{let d=l.$getSelection();l.$isRangeSelection(d)?d.removeText():l.$isNodeSelection(d)&&d.getNodes().forEach(e=>e.remove())})}function H(b){let a=null;b instanceof DragEvent?a=b.dataTransfer:b instanceof ClipboardEvent&&(a=b.clipboardData);if(null===a)return[!1,[],!1];var d=a.types;b=d.includes("Files");d=d.includes("text/html")||d.includes("text/plain");return[b,Array.from(a.files),d]}
|
|
17
|
+
function I(b,a){var d=l.$getSelection();if(l.$isRangeSelection(d)){var e=new Set;d=d.getNodes();for(let f=0;f<d.length;f++){let n=d[f],v=n.getKey();if(e.has(v))continue;let h=k.$getNearestBlockElementAncestorOrThrow(n),C=h.getKey();h.canInsertTab()?(b(n),e.add(v)):h.canIndent()&&!e.has(C)&&(e.add(C),a(h))}}}function J(b){b=l.$getNearestNodeFromDOMNode(b);return l.$isDecoratorNode(b)}exports.$createHeadingNode=E;exports.$createQuoteNode=z;exports.$isHeadingNode=function(b){return b instanceof A};
|
|
18
|
+
exports.$isQuoteNode=function(b){return b instanceof x};exports.DRAG_DROP_PASTE=w;exports.HeadingNode=A;exports.QuoteNode=x;exports.eventFiles=H;
|
|
19
|
+
exports.registerRichText=function(b){return k.mergeRegister(b.registerCommand(l.CLICK_COMMAND,()=>{const a=l.$getSelection();return l.$isNodeSelection(a)?(a.clear(),!0):!1},0),b.registerCommand(l.DELETE_CHARACTER_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteCharacter(a);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DELETE_WORD_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteWord(a);return!0},l.COMMAND_PRIORITY_EDITOR),
|
|
20
|
+
b.registerCommand(l.DELETE_LINE_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.deleteLine(a);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.CONTROLLED_TEXT_INSERTION_COMMAND,a=>{const d=l.$getSelection();if("string"===typeof a)l.$isRangeSelection(d)?d.insertText(a):l.DEPRECATED_$isGridSelection(d);else{if(!l.$isRangeSelection(d)&&!l.DEPRECATED_$isGridSelection(d))return!1;const e=a.dataTransfer;null!=e?c.$insertDataTransferForRichText(e,d,b):l.$isRangeSelection(d)&&
|
|
21
|
+
(a=a.data)&&d.insertText(a)}return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.REMOVE_TEXT_COMMAND,()=>{const a=l.$getSelection();if(!l.$isRangeSelection(a))return!1;a.removeText();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.FORMAT_TEXT_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.formatText(a);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.FORMAT_ELEMENT_COMMAND,a=>{var d=l.$getSelection();if(!l.$isRangeSelection(d)&&!l.$isNodeSelection(d))return!1;
|
|
22
|
+
d=d.getNodes();for(const e of d)k.$getNearestBlockElementAncestorOrThrow(e).setFormat(a);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.INSERT_LINE_BREAK_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;d.insertLineBreak(a);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.INSERT_PARAGRAPH_COMMAND,()=>{const a=l.$getSelection();if(!l.$isRangeSelection(a))return!1;a.insertParagraph();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.INDENT_CONTENT_COMMAND,
|
|
23
|
+
()=>{I(()=>{b.dispatchCommand(l.CONTROLLED_TEXT_INSERTION_COMMAND,"\t")},a=>{const d=a.getIndent();10!==d&&a.setIndent(d+1)});return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.OUTDENT_CONTENT_COMMAND,()=>{I(a=>{l.$isTextNode(a)&&(a=a.getTextContent(),"\t"===a[a.length-1]&&b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0))},a=>{const d=a.getIndent();0!==d&&a.setIndent(d-1)});return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ARROW_UP_COMMAND,a=>{const d=l.$getSelection();return l.$isNodeSelection(d)&&
|
|
24
|
+
!J(a.target)&&(a=d.getNodes(),0<a.length)?(a[0].selectPrevious(),!0):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ARROW_DOWN_COMMAND,()=>{var a=l.$getSelection();return l.$isNodeSelection(a)&&(a=a.getNodes(),0<a.length)?(a[0].selectNext(0,0),!0):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ARROW_LEFT_COMMAND,a=>{const d=l.$getSelection();if(l.$isNodeSelection(d)){var e=d.getNodes();if(0<e.length)return a.preventDefault(),e[0].selectPrevious(),!0}return l.$isRangeSelection(d)?g.$shouldOverrideDefaultCharacterSelection(d,
|
|
25
|
+
!0)?(e=a.shiftKey,a.preventDefault(),g.$moveCharacter(d,e,!0),!0):!1:!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ARROW_RIGHT_COMMAND,a=>{const d=l.$getSelection();if(l.$isNodeSelection(d)&&!J(a.target)){var e=d.getNodes();if(0<e.length)return a.preventDefault(),e[0].selectNext(0,0),!0}if(!l.$isRangeSelection(d))return!1;e=a.shiftKey;return g.$shouldOverrideDefaultCharacterSelection(d,!1)?(a.preventDefault(),g.$moveCharacter(d,e,!1),!0):!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_BACKSPACE_COMMAND,
|
|
26
|
+
a=>{if(J(a.target))return!1;const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;a.preventDefault();({anchor:a}=d);const e=a.getNode();return d.isCollapsed()&&0===a.offset&&!l.$isRootNode(e)&&0<k.$getNearestBlockElementAncestorOrThrow(e).getIndent()?b.dispatchCommand(l.OUTDENT_CONTENT_COMMAND,void 0):b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_DELETE_COMMAND,a=>{if(J(a.target))return!1;const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;
|
|
27
|
+
a.preventDefault();return b.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!1)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ENTER_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;if(null!==a){if((u||t)&&r)return!1;a.preventDefault();if(a.shiftKey)return b.dispatchCommand(l.INSERT_LINE_BREAK_COMMAND,!1)}return b.dispatchCommand(l.INSERT_PARAGRAPH_COMMAND,void 0)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_TAB_COMMAND,a=>{const d=l.$getSelection();if(!l.$isRangeSelection(d))return!1;
|
|
28
|
+
a.preventDefault();return b.dispatchCommand(a.shiftKey?l.OUTDENT_CONTENT_COMMAND:l.INDENT_CONTENT_COMMAND,void 0)},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.KEY_ESCAPE_COMMAND,()=>{const a=l.$getSelection();if(!l.$isRangeSelection(a))return!1;b.blur();return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DROP_COMMAND,a=>{const [,d]=H(a);if(0<d.length){var e=m(a.clientX,a.clientY);if(null!==e){const {offset:n,node:v}=e;var f=l.$getNearestNodeFromDOMNode(v);if(null!==f){e=l.$createRangeSelection();
|
|
29
|
+
if(l.$isTextNode(f))e.anchor.set(f.getKey(),n,"text"),e.focus.set(f.getKey(),n,"text");else{const h=f.getParentOrThrow().getKey();f=f.getIndexWithinParent()+1;e.anchor.set(h,f,"element");e.focus.set(h,f,"element")}e=l.$normalizeSelection__EXPERIMENTAL(e);l.$setSelection(e)}b.dispatchCommand(w,d)}a.preventDefault();return!0}a=l.$getSelection();return l.$isRangeSelection(a)?!0:!1},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DRAGSTART_COMMAND,a=>{[a]=H(a);const d=l.$getSelection();return a&&!l.$isRangeSelection(d)?
|
|
30
|
+
!1:!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.DRAGOVER_COMMAND,a=>{var [d]=H(a);const e=l.$getSelection();if(d&&!l.$isRangeSelection(e))return!1;d=m(a.clientX,a.clientY);null!==d&&(d=l.$getNearestNodeFromDOMNode(d.node),l.$isDecoratorNode(d)&&a.preventDefault());return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.COPY_COMMAND,a=>{c.copyToClipboard__EXPERIMENTAL(b,a instanceof ClipboardEvent?a:null);return!0},l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.CUT_COMMAND,a=>{G(a,b);return!0},
|
|
31
|
+
l.COMMAND_PRIORITY_EDITOR),b.registerCommand(l.PASTE_COMMAND,a=>{const [,d,e]=H(a);if(0<d.length&&!e)return b.dispatchCommand(w,d),!0;const f=l.$getSelection();return l.$isRangeSelection(f)||l.DEPRECATED_$isGridSelection(f)?(F(a,b),!0):!1},l.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, SerializedElementNode, Spread } from 'lexical';
|
|
9
|
+
import type { DOMConversionMap, 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';
|
|
@@ -47,7 +47,7 @@ export declare class HeadingNode extends ElementNode {
|
|
|
47
47
|
static importDOM(): DOMConversionMap | null;
|
|
48
48
|
static importJSON(serializedNode: SerializedHeadingNode): HeadingNode;
|
|
49
49
|
exportJSON(): SerializedHeadingNode;
|
|
50
|
-
insertNewAfter(): ParagraphNode;
|
|
50
|
+
insertNewAfter(selection?: RangeSelection): ParagraphNode | HeadingNode;
|
|
51
51
|
collapseAtStart(): true;
|
|
52
52
|
extractWithChild(): boolean;
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"rich-text"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.6.
|
|
10
|
+
"version": "0.6.5",
|
|
11
11
|
"main": "LexicalRichText.js",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"lexical": "0.6.
|
|
14
|
-
"@lexical/selection": "0.6.
|
|
15
|
-
"@lexical/clipboard": "0.6.
|
|
16
|
-
"@lexical/utils": "0.6.
|
|
13
|
+
"lexical": "0.6.5",
|
|
14
|
+
"@lexical/selection": "0.6.5",
|
|
15
|
+
"@lexical/clipboard": "0.6.5",
|
|
16
|
+
"@lexical/utils": "0.6.5"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|