fastmail / Squire

The rich text editor for arbitrary HTML.
MIT License
4.75k stars 406 forks source link

linkifyText throws a DOMException if a link is inserted inside a text node #430

Closed ganthern closed 1 year ago

ganthern commented 1 year ago
Uncaught DOMException: Index or size is negative or greater than the allowed amount squire-raw.js:1659
    linkifyText http://localhost:63342/Squire/dist/squire-raw.js:1659
    Space http://localhost:63342/Squire/dist/squire-raw.js:1845
    (Async: setTimeout handler)
    Space http://localhost:63342/Squire/dist/squire-raw.js:1844
    _onKey http://localhost:63342/Squire/dist/squire-raw.js:1906
    fireEvent http://localhost:63342/Squire/dist/squire-raw.js:2331
    handleEvent http://localhost:63342/Squire/dist/squire-raw.js:2303
    (Async: EventListener.handleEvent)
    addEventListener http://localhost:63342/Squire/dist/squire-raw.js:2350
    Squire http://localhost:63342/Squire/dist/squire-raw.js:2130
    <anonymous> http://localhost:63342/Squire/Demo.html?_ijt=v2lth7efi9vp5nvk8pc0gsmb1&_ij_reload=RELOAD_ON_SAVE:121

the reason are the following lines: https://github.com/fastmail/Squire/blob/a8cd95a688cb5c974528dd80b92017a81a55f62d/source/keyboard/KeyHelpers.ts#L127-L133

I'm not sure what the exact bug is here.

https://github.com/tutao/tutanota/issues/5339

neilj commented 1 year ago

Thanks for the report!