@lexical/rich-text
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -322,6 +322,2 @@ /** | ||
async function onCutForRichText(event, editor) { | ||
if (editor.getEditorState().read(() => lexical.$getSelection()) == null) { | ||
return; | ||
} | ||
await clipboard.copyToClipboard__EXPERIMENTAL(editor, event instanceof ClipboardEvent ? event : null); | ||
@@ -379,8 +375,10 @@ editor.update(() => { | ||
alreadyHandled.add(key); | ||
const parentBlock = utils.$getNearestBlockElementAncestorOrThrow(node); | ||
const parentKey = parentBlock.getKey(); | ||
if (parentBlock.canInsertTab()) { | ||
insertTab(node); | ||
} else if (parentBlock.canIndent()) { | ||
alreadyHandled.add(key); | ||
} else if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) { | ||
alreadyHandled.add(parentKey); | ||
indentOrOutdent(parentBlock); | ||
@@ -387,0 +385,0 @@ } |
@@ -7,14 +7,13 @@ /** | ||
*/ | ||
'use strict';var a=require("@lexical/clipboard"),g=require("@lexical/selection"),h=require("@lexical/utils"),k=require("lexical");let l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,q=l&&"documentMode"in document?document.documentMode:null;l&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);l&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); | ||
let r=l&&"InputEvent"in window&&!q?"getTargetRanges"in new window.InputEvent("input"):!1,t=l&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),u=l&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,v=k.createCommand("DRAG_DROP_PASTE_FILE"); | ||
class w extends k.ElementNode{static getType(){return"quote"}static clone(c){return new w(c.__key)}constructor(c){super(c)}createDOM(c){let b=document.createElement("blockquote");h.addClassNamesToElement(b,c.theme.quote);return b}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:x,priority:0})}}static importJSON(c){let b=y();b.setFormat(c.format);b.setIndent(c.indent);b.setDirection(c.direction);return b}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(){let c= | ||
k.$createParagraphNode(),b=this.getDirection();c.setDirection(b);this.insertAfter(c);return c}collapseAtStart(){let c=k.$createParagraphNode();this.getChildren().forEach(b=>c.append(b));this.replace(c);return!0}}function y(){return k.$applyNodeReplacement(new w)} | ||
class z extends k.ElementNode{static getType(){return"heading"}static clone(c){return new z(c.__tag,c.__key)}constructor(c,b){super(b);this.__tag=c}getTag(){return this.__tag}createDOM(c){let b=this.__tag,d=document.createElement(b);c=c.theme.heading;void 0!==c&&h.addClassNamesToElement(d,c[b]);return d}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:A,priority:0}),h2:()=>({conversion:A,priority:0}),h3:()=>({conversion:A,priority:0}),h4:()=>({conversion:A,priority:0}),h5:()=>({conversion:A, | ||
priority:0}),h6:()=>({conversion:A,priority:0}),p:c=>{c=c.firstChild;return null!==c&&B(c)?{conversion:()=>({node:null}),priority:3}:null},span:c=>B(c)?{conversion:()=>({node:C("h1")}),priority:3}:null}}static importJSON(c){let b=C(c.tag);b.setFormat(c.format);b.setIndent(c.indent);b.setDirection(c.direction);return b}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(){let c=k.$createParagraphNode(),b=this.getDirection();c.setDirection(b);this.insertAfter(c); | ||
return c}collapseAtStart(){let c=k.$createParagraphNode();this.getChildren().forEach(b=>c.append(b));this.replace(c);return!0}extractWithChild(){return!0}}function B(c){return"span"===c.nodeName.toLowerCase()?"26pt"===c.style.fontSize:!1}function A(c){c=c.nodeName.toLowerCase();let b=null;if("h1"===c||"h2"===c||"h3"===c||"h4"===c||"h5"===c||"h6"===c)b=C(c);return{node:b}}function x(){return{node:y()}}function C(c){return k.$applyNodeReplacement(new z(c))} | ||
function D(c,b){c.preventDefault();b.update(()=>{let d=k.$getSelection(),e=c instanceof InputEvent||c instanceof KeyboardEvent?null:c.clipboardData;null!=e&&(k.$isRangeSelection(d)||k.DEPRECATED_$isGridSelection(d))&&a.$insertDataTransferForRichText(e,d,b)},{tag:"paste"})} | ||
async function E(c,b){null!=b.getEditorState().read(()=>k.$getSelection())&&(await a.copyToClipboard__EXPERIMENTAL(b,c instanceof ClipboardEvent?c:null),b.update(()=>{let d=k.$getSelection();k.$isRangeSelection(d)?d.removeText():k.$isNodeSelection(d)&&d.getNodes().forEach(e=>e.remove())}))} | ||
function F(c){let b=null;c instanceof DragEvent?b=c.dataTransfer:c instanceof ClipboardEvent&&(b=c.clipboardData);if(null===b)return[!1,[],!1];var d=b.types;c=d.includes("Files");d=d.includes("text/html")||d.includes("text/plain");return[c,Array.from(b.files),d]} | ||
function G(c,b){var d=k.$getSelection();if(k.$isRangeSelection(d)){var e=new Set;d=d.getNodes();for(let m=0;m<d.length;m++){let n=d[m];var f=n.getKey();e.has(f)||(e.add(f),f=h.$getNearestBlockElementAncestorOrThrow(n),f.canInsertTab()?c(n):f.canIndent()&&b(f))}}}function H(c){c=k.$getNearestNodeFromDOMNode(c);return k.$isDecoratorNode(c)}exports.$createHeadingNode=C;exports.$createQuoteNode=y;exports.$isHeadingNode=function(c){return c instanceof z}; | ||
exports.$isQuoteNode=function(c){return c instanceof w};exports.DRAG_DROP_PASTE=v;exports.HeadingNode=z;exports.QuoteNode=w;exports.eventFiles=F; | ||
'use strict';var a=require("@lexical/clipboard"),g=require("@lexical/selection"),h=require("@lexical/utils"),k=require("lexical");let m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,q=m&&"documentMode"in document?document.documentMode:null;m&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);m&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); | ||
let r=m&&"InputEvent"in window&&!q?"getTargetRanges"in new window.InputEvent("input"):!1,t=m&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),u=m&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,v=k.createCommand("DRAG_DROP_PASTE_FILE"); | ||
class y extends k.ElementNode{static getType(){return"quote"}static clone(c){return new y(c.__key)}constructor(c){super(c)}createDOM(c){let b=document.createElement("blockquote");h.addClassNamesToElement(b,c.theme.quote);return b}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:z,priority:0})}}static importJSON(c){let b=A();b.setFormat(c.format);b.setIndent(c.indent);b.setDirection(c.direction);return b}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(){let c= | ||
k.$createParagraphNode(),b=this.getDirection();c.setDirection(b);this.insertAfter(c);return c}collapseAtStart(){let c=k.$createParagraphNode();this.getChildren().forEach(b=>c.append(b));this.replace(c);return!0}}function A(){return k.$applyNodeReplacement(new y)} | ||
class B extends k.ElementNode{static getType(){return"heading"}static clone(c){return new B(c.__tag,c.__key)}constructor(c,b){super(b);this.__tag=c}getTag(){return this.__tag}createDOM(c){let b=this.__tag,d=document.createElement(b);c=c.theme.heading;void 0!==c&&h.addClassNamesToElement(d,c[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, | ||
priority:0}),h6:()=>({conversion:C,priority:0}),p:c=>{c=c.firstChild;return null!==c&&D(c)?{conversion:()=>({node:null}),priority:3}:null},span:c=>D(c)?{conversion:()=>({node:E("h1")}),priority:3}:null}}static importJSON(c){let b=E(c.tag);b.setFormat(c.format);b.setIndent(c.indent);b.setDirection(c.direction);return b}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(){let c=k.$createParagraphNode(),b=this.getDirection();c.setDirection(b);this.insertAfter(c); | ||
return c}collapseAtStart(){let c=k.$createParagraphNode();this.getChildren().forEach(b=>c.append(b));this.replace(c);return!0}extractWithChild(){return!0}}function D(c){return"span"===c.nodeName.toLowerCase()?"26pt"===c.style.fontSize:!1}function C(c){c=c.nodeName.toLowerCase();let b=null;if("h1"===c||"h2"===c||"h3"===c||"h4"===c||"h5"===c||"h6"===c)b=E(c);return{node:b}}function z(){return{node:A()}}function E(c){return k.$applyNodeReplacement(new B(c))} | ||
function F(c,b){c.preventDefault();b.update(()=>{let d=k.$getSelection(),e=c instanceof InputEvent||c instanceof KeyboardEvent?null:c.clipboardData;null!=e&&(k.$isRangeSelection(d)||k.DEPRECATED_$isGridSelection(d))&&a.$insertDataTransferForRichText(e,d,b)},{tag:"paste"})} | ||
async function G(c,b){await a.copyToClipboard__EXPERIMENTAL(b,c instanceof ClipboardEvent?c:null);b.update(()=>{let d=k.$getSelection();k.$isRangeSelection(d)?d.removeText():k.$isNodeSelection(d)&&d.getNodes().forEach(e=>e.remove())})}function H(c){let b=null;c instanceof DragEvent?b=c.dataTransfer:c instanceof ClipboardEvent&&(b=c.clipboardData);if(null===b)return[!1,[],!1];var d=b.types;c=d.includes("Files");d=d.includes("text/html")||d.includes("text/plain");return[c,Array.from(b.files),d]} | ||
function I(c,b){var d=k.$getSelection();if(k.$isRangeSelection(d)){var e=new Set;d=d.getNodes();for(let f=0;f<d.length;f++){let n=d[f],w=n.getKey();if(e.has(w))continue;let l=h.$getNearestBlockElementAncestorOrThrow(n),x=l.getKey();l.canInsertTab()?(c(n),e.add(w)):l.canIndent()&&!e.has(x)&&(e.add(x),b(l))}}}function J(c){c=k.$getNearestNodeFromDOMNode(c);return k.$isDecoratorNode(c)}exports.$createHeadingNode=E;exports.$createQuoteNode=A;exports.$isHeadingNode=function(c){return c instanceof B}; | ||
exports.$isQuoteNode=function(c){return c instanceof y};exports.DRAG_DROP_PASTE=v;exports.HeadingNode=B;exports.QuoteNode=y;exports.eventFiles=H; | ||
exports.registerRichText=function(c){return h.mergeRegister(c.registerCommand(k.CLICK_COMMAND,()=>{const b=k.$getSelection();return k.$isNodeSelection(b)?(b.clear(),!0):!1},0),c.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),c.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), | ||
@@ -24,10 +23,10 @@ c.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),c.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?a.$insertDataTransferForRichText(e,d,c):k.$isRangeSelection(d)&& | ||
d=d.getNodes();for(const e of d)h.$getNearestBlockElementAncestorOrThrow(e).setFormat(b);return!0},k.COMMAND_PRIORITY_EDITOR),c.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),c.registerCommand(k.INSERT_PARAGRAPH_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;b.insertParagraph();return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.INDENT_CONTENT_COMMAND, | ||
()=>{G(()=>{c.dispatchCommand(k.CONTROLLED_TEXT_INSERTION_COMMAND,"\t")},b=>{const d=b.getIndent();10!==d&&b.setIndent(d+1)});return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.OUTDENT_CONTENT_COMMAND,()=>{G(b=>{k.$isTextNode(b)&&(b=b.getTextContent(),"\t"===b[b.length-1]&&c.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!0))},b=>{const d=b.getIndent();0!==d&&b.setIndent(d-1)});return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ARROW_UP_COMMAND,b=>{const d=k.$getSelection();return k.$isNodeSelection(d)&& | ||
!H(b.target)&&(b=d.getNodes(),0<b.length)?(b[0].selectPrevious(),!0):!1},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ARROW_DOWN_COMMAND,()=>{var b=k.$getSelection();return k.$isNodeSelection(b)&&(b=b.getNodes(),0<b.length)?(b[0].selectNext(0,0),!0):!1},k.COMMAND_PRIORITY_EDITOR),c.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,b.preventDefault(),g.$moveCharacter(d,e,!0),!0):!1:!1},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ARROW_RIGHT_COMMAND,b=>{const d=k.$getSelection();if(k.$isNodeSelection(d)&&!H(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),c.registerCommand(k.KEY_BACKSPACE_COMMAND, | ||
b=>{if(H(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()?c.dispatchCommand(k.OUTDENT_CONTENT_COMMAND,void 0):c.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!0)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_DELETE_COMMAND,b=>{if(H(b.target))return!1;const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1; | ||
()=>{I(()=>{c.dispatchCommand(k.CONTROLLED_TEXT_INSERTION_COMMAND,"\t")},b=>{const d=b.getIndent();10!==d&&b.setIndent(d+1)});return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.OUTDENT_CONTENT_COMMAND,()=>{I(b=>{k.$isTextNode(b)&&(b=b.getTextContent(),"\t"===b[b.length-1]&&c.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!0))},b=>{const d=b.getIndent();0!==d&&b.setIndent(d-1)});return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ARROW_UP_COMMAND,b=>{const d=k.$getSelection();return k.$isNodeSelection(d)&& | ||
!J(b.target)&&(b=d.getNodes(),0<b.length)?(b[0].selectPrevious(),!0):!1},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ARROW_DOWN_COMMAND,()=>{var b=k.$getSelection();return k.$isNodeSelection(b)&&(b=b.getNodes(),0<b.length)?(b[0].selectNext(0,0),!0):!1},k.COMMAND_PRIORITY_EDITOR),c.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,b.preventDefault(),g.$moveCharacter(d,e,!0),!0):!1:!1},k.COMMAND_PRIORITY_EDITOR),c.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),c.registerCommand(k.KEY_BACKSPACE_COMMAND, | ||
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()?c.dispatchCommand(k.OUTDENT_CONTENT_COMMAND,void 0):c.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!0)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_DELETE_COMMAND,b=>{if(J(b.target))return!1;const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1; | ||
b.preventDefault();return c.dispatchCommand(k.DELETE_CHARACTER_COMMAND,!1)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ENTER_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;if(null!==b){if((u||t)&&r)return!1;b.preventDefault();if(b.shiftKey)return c.dispatchCommand(k.INSERT_LINE_BREAK_COMMAND,!1)}return c.dispatchCommand(k.INSERT_PARAGRAPH_COMMAND,void 0)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_TAB_COMMAND,b=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1; | ||
b.preventDefault();return c.dispatchCommand(b.shiftKey?k.OUTDENT_CONTENT_COMMAND:k.INDENT_CONTENT_COMMAND,void 0)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ESCAPE_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;c.blur();return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DROP_COMMAND,b=>{const [,d]=F(b);if(0<d.length){var e=b.clientX;var f=b.clientY;e="undefined"!==typeof document.caretRangeFromPoint?document.caretRangeFromPoint(e,f):"undefined"!==document.caretPositionFromPoint? | ||
document.caretPositionFromPoint(e,f):null;if(null!==e){const {startOffset:m,endOffset:n,startContainer:I,endContainer:J}=e;e=k.$getNearestNodeFromDOMNode(I);f=k.$getNearestNodeFromDOMNode(J);if(null!==e&&null!==f){const p=k.$createRangeSelection();k.$isTextNode(e)?p.anchor.set(e.getKey(),m,"text"):p.anchor.set(e.getParentOrThrow().getKey(),e.getIndexWithinParent()+1,"element");k.$isTextNode(f)?p.focus.set(f.getKey(),n,"text"):p.focus.set(f.getParentOrThrow().getKey(),f.getIndexWithinParent()+1,"element"); | ||
e=k.$normalizeSelection__EXPERIMENTAL(p);k.$setSelection(e)}c.dispatchCommand(v,d)}b.preventDefault();return!0}b=k.$getSelection();return k.$isRangeSelection(b)?!0:!1},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DRAGSTART_COMMAND,b=>{const [d]=F(b),e=k.$getSelection();if(d&&!k.$isRangeSelection(e))return!1;b.preventDefault();return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DRAGOVER_COMMAND,b=>{const [d]=F(b),e=k.$getSelection();if(d&&!k.$isRangeSelection(e))return!1;b.preventDefault(); | ||
return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.COPY_COMMAND,b=>{a.copyToClipboard__EXPERIMENTAL(c,b instanceof ClipboardEvent?b:null);return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.CUT_COMMAND,b=>{E(b,c);return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.PASTE_COMMAND,b=>{const [,d,e]=F(b);if(0<d.length&&!e)return c.dispatchCommand(v,d),!0;const f=k.$getSelection();return k.$isRangeSelection(f)||k.DEPRECATED_$isGridSelection(f)?(D(b,c),!0):!1},k.COMMAND_PRIORITY_EDITOR))} | ||
b.preventDefault();return c.dispatchCommand(b.shiftKey?k.OUTDENT_CONTENT_COMMAND:k.INDENT_CONTENT_COMMAND,void 0)},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.KEY_ESCAPE_COMMAND,()=>{const b=k.$getSelection();if(!k.$isRangeSelection(b))return!1;c.blur();return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DROP_COMMAND,b=>{const [,d]=H(b);if(0<d.length){var e=b.clientX;var f=b.clientY;e="undefined"!==typeof document.caretRangeFromPoint?document.caretRangeFromPoint(e,f):"undefined"!==document.caretPositionFromPoint? | ||
document.caretPositionFromPoint(e,f):null;if(null!==e){const {startOffset:n,endOffset:w,startContainer:l,endContainer:x}=e;e=k.$getNearestNodeFromDOMNode(l);f=k.$getNearestNodeFromDOMNode(x);if(null!==e&&null!==f){const p=k.$createRangeSelection();k.$isTextNode(e)?p.anchor.set(e.getKey(),n,"text"):p.anchor.set(e.getParentOrThrow().getKey(),e.getIndexWithinParent()+1,"element");k.$isTextNode(f)?p.focus.set(f.getKey(),w,"text"):p.focus.set(f.getParentOrThrow().getKey(),f.getIndexWithinParent()+1,"element"); | ||
e=k.$normalizeSelection__EXPERIMENTAL(p);k.$setSelection(e)}c.dispatchCommand(v,d)}b.preventDefault();return!0}b=k.$getSelection();return k.$isRangeSelection(b)?!0:!1},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DRAGSTART_COMMAND,b=>{const [d]=H(b),e=k.$getSelection();if(d&&!k.$isRangeSelection(e))return!1;b.preventDefault();return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.DRAGOVER_COMMAND,b=>{const [d]=H(b),e=k.$getSelection();if(d&&!k.$isRangeSelection(e))return!1;b.preventDefault(); | ||
return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.COPY_COMMAND,b=>{a.copyToClipboard__EXPERIMENTAL(c,b instanceof ClipboardEvent?b:null);return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.CUT_COMMAND,b=>{G(b,c);return!0},k.COMMAND_PRIORITY_EDITOR),c.registerCommand(k.PASTE_COMMAND,b=>{const [,d,e]=H(b);if(0<d.length&&!e)return c.dispatchCommand(v,d),!0;const f=k.$getSelection();return k.$isRangeSelection(f)||k.DEPRECATED_$isGridSelection(f)?(F(b,c),!0):!1},k.COMMAND_PRIORITY_EDITOR))} |
@@ -10,9 +10,9 @@ { | ||
"license": "MIT", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"main": "LexicalRichText.js", | ||
"peerDependencies": { | ||
"lexical": "0.6.2", | ||
"@lexical/selection": "0.6.2", | ||
"@lexical/clipboard": "0.6.2", | ||
"@lexical/utils": "0.6.2" | ||
"lexical": "0.6.3", | ||
"@lexical/selection": "0.6.3", | ||
"@lexical/clipboard": "0.6.3", | ||
"@lexical/utils": "0.6.3" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42412
786