mirror of
https://github.com/penpot/penpot.git
synced 2026-03-29 15:52:17 +02: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:
@@ -366,6 +366,9 @@ export function getInlineStyle(state, blockKey, offset) {
|
||||
const NEWLINE_REGEX = /\r\n?|\n/g;
|
||||
|
||||
function splitTextIntoTextBlocks(text) {
|
||||
if (text == null) {
|
||||
return [];
|
||||
}
|
||||
return text.split(NEWLINE_REGEX);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user