penpot/frontend
Andrey Antukh 5a2c09f246 🐛 Fix TypeError when deleting text at edge spans in text editor
The text editor's SelectionController threw 'TypeError: Invalid text
node' when:

- Pressing Backspace to delete the only character of the **first** text
  span in a paragraph that contains multiple spans.
- Pressing Delete to delete the only character of the **last** text
  span in the same situation.
- Pressing a word-backward shortcut that empties the first span of a
  multi-span paragraph.

In all three cases the tree-iterator (previousNode / nextNode) returned
null because no sibling text node existed in that direction, and that
null was subsequently passed to getTextNodeLength() which calls
isTextNode() — which unconditionally throws when given a falsy value.

Fix: use the null-coalescing fallback to the first/last remaining
child's text node of the paragraph before calling collapse() /
getTextNodeLength().
2026-04-08 21:03:46 +02:00
..
2026-04-07 21:35:00 +02:00
2026-04-07 21:35:00 +02:00
2026-03-26 14:12:11 +01:00
2025-12-23 13:10:58 +01:00
2026-04-07 21:35:00 +02:00
2026-04-07 21:35:00 +02:00
2026-04-07 21:35:00 +02:00
2025-11-05 17:15:19 +01:00