Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
4.02k stars 614 forks source link

Shaky crash issue: TypeError: Range.setEnd: Argument 1 does not implement interface Node. #1245

Closed scscgit closed 1 year ago

scscgit commented 3 years ago

I observed issue of Trumbowyg crashing the page despite latest version https://github.com/Alex-D/Trumbowyg/releases/tag/v2.25.1, which had supposedly fixed an issue https://github.com/Alex-D/Trumbowyg/issues/1233 (fixed in https://github.com/Alex-D/Trumbowyg/commit/5ad49f30e31cc9a543f9dfc7c1d9a33bd6c3bae5) that seems to be related based on the error message (TypeError: Range.setEnd: Argument 1 does not implement interface Node.). As the fix replaced t.range.startContainer.parentNode by t.range, I suspect that a similar check needs to be performed at https://github.com/Alex-D/Trumbowyg/blob/fd304a39433b5918291824bfe961bb54d60bfc29/src/trumbowyg.js#L1831

Note that I'm unable to reproduce this intentionally, and I don't have any debugging setup in place to discover the conditions or root cause. This doesn't usually occur (but it's fatal when it does, causing a motivation to wrap this component in some Vue error boundary - too bad https://github.com/ankurk91/vue-trumbowyg is archived so it can't be done there). I currently don't have any more information except the following screenshot(s):

image

It has occurred again, so at least I confirmed some variables in debugger:

image

Description

Alex-D commented 1 year ago

Nobody else has reported this bug, but maybe was fixed since, I do not know :/