Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pasting text on input was creating a new paragraph node instead of ad… #4246

Merged
merged 6 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/lexical-rich-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
INDENT_CONTENT_COMMAND,
INSERT_LINE_BREAK_COMMAND,
INSERT_PARAGRAPH_COMMAND,
isSelectionCapturedInDecoratorInput,
KEY_ARROW_DOWN_COMMAND,
KEY_ARROW_LEFT_COMMAND,
KEY_ARROW_RIGHT_COMMAND,
Expand Down Expand Up @@ -980,6 +981,11 @@ export function registerRichText(editor: LexicalEditor): () => void {
return true;
}

// if inputs then paste within the input ignore creating a new node on paste event
if (isSelectionCapturedInDecoratorInput(event.target as Node)) {
return false;
}

const selection = $getSelection();
if (
$isRangeSelection(selection) ||
Expand Down
1 change: 1 addition & 0 deletions packages/lexical/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export {
$setSelection,
$splitNode,
getNearestEditorFromDOMNode,
isSelectionCapturedInDecoratorInput,
isSelectionWithinEditor,
} from './LexicalUtils';
export {$isDecoratorNode, DecoratorNode} from './nodes/LexicalDecoratorNode';
Expand Down