@lexical/plain-text
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -124,3 +124,3 @@ /** | ||
return true; | ||
}, 0), editor.registerCommand(lexical.DELETE_WORD_COMMAND, isBackward => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DELETE_WORD_COMMAND, isBackward => { | ||
const selection = lexical.$getSelection(); | ||
@@ -134,3 +134,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.DELETE_LINE_COMMAND, isBackward => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DELETE_LINE_COMMAND, isBackward => { | ||
const selection = lexical.$getSelection(); | ||
@@ -144,3 +144,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.INSERT_TEXT_COMMAND, eventOrText => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_TEXT_COMMAND, eventOrText => { | ||
const selection = lexical.$getSelection(); | ||
@@ -169,3 +169,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, payload => { | ||
const selection = lexical.$getSelection(); | ||
@@ -179,3 +179,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.INSERT_LINE_BREAK_COMMAND, selectStart => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_LINE_BREAK_COMMAND, selectStart => { | ||
const selection = lexical.$getSelection(); | ||
@@ -189,3 +189,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, payload => { | ||
const selection = lexical.$getSelection(); | ||
@@ -199,3 +199,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.KEY_ARROW_LEFT_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ARROW_LEFT_COMMAND, payload => { | ||
const selection$1 = lexical.$getSelection(); | ||
@@ -217,3 +217,3 @@ | ||
return false; | ||
}, 0), editor.registerCommand(lexical.KEY_ARROW_RIGHT_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ARROW_RIGHT_COMMAND, payload => { | ||
const selection$1 = lexical.$getSelection(); | ||
@@ -235,3 +235,3 @@ | ||
return false; | ||
}, 0), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -245,3 +245,3 @@ | ||
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, true); | ||
}, 0), editor.registerCommand(lexical.KEY_DELETE_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_DELETE_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -255,3 +255,3 @@ | ||
return editor.dispatchCommand(lexical.DELETE_CHARACTER_COMMAND, false); | ||
}, 0), editor.registerCommand(lexical.KEY_ENTER_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.KEY_ENTER_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -268,3 +268,3 @@ | ||
return editor.dispatchCommand(lexical.INSERT_LINE_BREAK_COMMAND); | ||
}, 0), editor.registerCommand(lexical.COPY_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.COPY_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -278,3 +278,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.CUT_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.CUT_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -288,3 +288,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.PASTE_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.PASTE_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -298,3 +298,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.DROP_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DROP_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -309,3 +309,3 @@ | ||
return true; | ||
}, 0), editor.registerCommand(lexical.DRAGSTART_COMMAND, event => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.DRAGSTART_COMMAND, event => { | ||
const selection = lexical.$getSelection(); | ||
@@ -320,3 +320,3 @@ | ||
return true; | ||
}, 0)); | ||
}, lexical.COMMAND_PRIORITY_EDITOR)); | ||
initializeEditor(editor, initialEditorState); | ||
@@ -323,0 +323,0 @@ return removeListener; |
@@ -10,7 +10,8 @@ /** | ||
function r(d,e){if(null!==e)if(void 0===e)d.update(()=>{var f=l.$getRoot();if(null===f.getFirstChild()){const b=l.$createParagraphNode();f.append(b);f=document.activeElement;(null!==l.$getSelection()||null!==f&&f===d.getRootElement())&&b.select()}},m);else if(null!==e)switch(typeof e){case "string":e=d.parseEditorState(e);d.setEditorState(e,m);break;case "object":d.setEditorState(e,m);break;case "function":d.update(e,m)}} | ||
exports.registerPlainText=function(d,e){const f=k.mergeRegister(d.registerCommand(l.DELETE_CHARACTER_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteCharacter(b);return!0},0),d.registerCommand(l.DELETE_WORD_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteWord(b);return!0},0),d.registerCommand(l.DELETE_LINE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteLine(b);return!0},0),d.registerCommand(l.INSERT_TEXT_COMMAND, | ||
b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;if("string"===typeof b)c.insertText(b);else{const g=b.dataTransfer;null!=g?a.$insertDataTransferForPlainText(g,c):(b=b.data)&&c.insertText(b)}return!0},0),d.registerCommand(l.REMOVE_TEXT_COMMAND,()=>{const b=l.$getSelection();if(!l.$isRangeSelection(b))return!1;b.removeText();return!0},0),d.registerCommand(l.INSERT_LINE_BREAK_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.insertLineBreak(b);return!0},0), | ||
d.registerCommand(l.INSERT_PARAGRAPH_COMMAND,()=>{const b=l.$getSelection();if(!l.$isRangeSelection(b))return!1;b.insertLineBreak();return!0},0),d.registerCommand(l.KEY_ARROW_LEFT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;const g=b.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(c,!0)?(b.preventDefault(),h.$moveCharacter(c,g,!0),!0):!1},0),d.registerCommand(l.KEY_ARROW_RIGHT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;const g= | ||
b.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(c,!1)?(b.preventDefault(),h.$moveCharacter(c,g,!1),!0):!1},0),d.registerCommand(l.KEY_BACKSPACE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return d.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0)},0),d.registerCommand(l.KEY_DELETE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return d.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!1)},0),d.registerCommand(l.KEY_ENTER_COMMAND, | ||
b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;null!==b&&b.preventDefault();return d.dispatchCommand(l.INSERT_LINE_BREAK_COMMAND)},0),d.registerCommand(l.COPY_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;n(b,d);return!0},0),d.registerCommand(l.CUT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;q(b,d);return!0},0),d.registerCommand(l.PASTE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;p(b,d);return!0}, | ||
0),d.registerCommand(l.DROP_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return!0},0),d.registerCommand(l.DRAGSTART_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return!0},0));r(d,e);return f}; | ||
exports.registerPlainText=function(d,e){const f=k.mergeRegister(d.registerCommand(l.DELETE_CHARACTER_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteCharacter(b);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DELETE_WORD_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteWord(b);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DELETE_LINE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteLine(b); | ||
return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.INSERT_TEXT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;if("string"===typeof b)c.insertText(b);else{const g=b.dataTransfer;null!=g?a.$insertDataTransferForPlainText(g,c):(b=b.data)&&c.insertText(b)}return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.REMOVE_TEXT_COMMAND,()=>{const b=l.$getSelection();if(!l.$isRangeSelection(b))return!1;b.removeText();return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.INSERT_LINE_BREAK_COMMAND, | ||
b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.insertLineBreak(b);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.INSERT_PARAGRAPH_COMMAND,()=>{const b=l.$getSelection();if(!l.$isRangeSelection(b))return!1;b.insertLineBreak();return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.KEY_ARROW_LEFT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;const g=b.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(c,!0)?(b.preventDefault(),h.$moveCharacter(c, | ||
g,!0),!0):!1},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.KEY_ARROW_RIGHT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;const g=b.shiftKey;return h.$shouldOverrideDefaultCharacterSelection(c,!1)?(b.preventDefault(),h.$moveCharacter(c,g,!1),!0):!1},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.KEY_BACKSPACE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return d.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!0)},l.COMMAND_PRIORITY_EDITOR), | ||
d.registerCommand(l.KEY_DELETE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return d.dispatchCommand(l.DELETE_CHARACTER_COMMAND,!1)},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.KEY_ENTER_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;null!==b&&b.preventDefault();return d.dispatchCommand(l.INSERT_LINE_BREAK_COMMAND)},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.COPY_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1; | ||
n(b,d);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.CUT_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;q(b,d);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.PASTE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;p(b,d);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DROP_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DRAGSTART_COMMAND, | ||
b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;b.preventDefault();return!0},l.COMMAND_PRIORITY_EDITOR));r(d,e);return f}; |
@@ -10,9 +10,9 @@ { | ||
"license": "MIT", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "LexicalPlainText.js", | ||
"peerDependencies": { | ||
"lexical": "0.2.1", | ||
"@lexical/utils": "0.2.1", | ||
"@lexical/selection": "0.2.1", | ||
"@lexical/clipboard": "0.2.1" | ||
"lexical": "0.2.2", | ||
"@lexical/utils": "0.2.2", | ||
"@lexical/selection": "0.2.2", | ||
"@lexical/clipboard": "0.2.2" | ||
}, | ||
@@ -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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
16755
298
1