@lexical/rich-text
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -616,6 +616,2 @@ /** | ||
return true; | ||
} else if (lexical.$isElementNode(possibleNode) && !possibleNode.isInline() && !possibleNode.canBeEmpty()) { | ||
possibleNode.select(); | ||
event.preventDefault(); | ||
return true; | ||
} | ||
@@ -622,0 +618,0 @@ } |
@@ -24,11 +24,10 @@ /** | ||
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, | ||
()=>{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= | ||
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=== | ||
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, | ||
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, | ||
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; | ||
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; | ||
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); | ||
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)&& | ||
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)? | ||
(F(b,a),!0):!1},k.COMMAND_PRIORITY_EDITOR))} | ||
()=>{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=k.$getAdjacentNode(d.focus,!0),k.$isDecoratorNode(d)&&!d.isIsolated()&&!d.isInline()))return d.selectPrevious(),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===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,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,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;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;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);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)&&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)?(F(b,a),!0):!1},k.COMMAND_PRIORITY_EDITOR))} |
@@ -10,9 +10,9 @@ { | ||
"license": "MIT", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"main": "LexicalRichText.js", | ||
"peerDependencies": { | ||
"lexical": "0.11.0", | ||
"@lexical/selection": "0.11.0", | ||
"@lexical/clipboard": "0.11.0", | ||
"@lexical/utils": "0.11.0" | ||
"lexical": "0.11.1", | ||
"@lexical/selection": "0.11.1", | ||
"@lexical/clipboard": "0.11.1", | ||
"@lexical/utils": "0.11.1" | ||
}, | ||
@@ -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
45549
849
206
24
47
6
142