mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix null text crash on paste in text editor
The splitTextIntoTextBlocks function in @penpot/draft-js called .split() on the text parameter without a null check. When pasting content without text data (e.g., images only), Draft.js passes null to handlePastedText, causing a TypeError. Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
8729fed724
commit
d863c7065f
@ -366,6 +366,9 @@ export function getInlineStyle(state, blockKey, offset) {
|
|||||||
const NEWLINE_REGEX = /\r\n?|\n/g;
|
const NEWLINE_REGEX = /\r\n?|\n/g;
|
||||||
|
|
||||||
function splitTextIntoTextBlocks(text) {
|
function splitTextIntoTextBlocks(text) {
|
||||||
|
if (text == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return text.split(NEWLINE_REGEX);
|
return text.split(NEWLINE_REGEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user