mirror of
https://github.com/penpot/penpot.git
synced 2026-03-26 03:01:16 -04:00
When pasting an image (with no text content) into the text editor, Draft.js calls handlePastedText with null/empty text. The previous fix guarded splitTextIntoTextBlocks against null, but insertText still attempted to build a fragment from an empty block array, causing Modifier.replaceWithFragment to crash with 'Cannot read properties of undefined (reading getLength)'. Fix insertText to return the original state unchanged when there are no text blocks to insert. Also guard handle-pasted-text in the ClojureScript editor to skip the insert-text call entirely when text is nil or empty. Signed-off-by: Andrey Antukh <niwi@niwi.nz>