facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.5k stars 1.45k forks source link

Fix insertText with element selection #5959

Closed zurfyx closed 3 weeks ago

zurfyx commented 3 weeks ago

It's valid to have an text + element selection that selection.getNodes() will only recognize as one node. This happens fairly often in FF when trying to span the entire text node selection to the entire line and is followed by a line break. See test to understand the problem at hand better.

I believe this PR fixes the entire problem and we don't need to understand further combinations, as insertText relies on normalized selection.

Closes https://github.com/facebook/lexical/issues/5233

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview Apr 24, 2024 9:59pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2024 9:59pm
github-actions[bot] commented 3 weeks ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 23.66 KB (-0.1% 🔽) 474 ms (-0.1% 🔽) 112 ms (+242.13% 🔺) 585 ms
packages/lexical-rich-text/dist/LexicalRichText.js 33.88 KB (-0.02% 🔽) 678 ms (-0.02% 🔽) 245 ms (+89.87% 🔺) 923 ms
packages/lexical-plain-text/dist/LexicalPlainText.js 33.86 KB (+0.27% 🔺) 678 ms (+0.27% 🔺) 155 ms (+51.7% 🔺) 833 ms
acywatson commented 3 weeks ago

fascinating