reddit-moderator-toolbox icon indicating copy to clipboard operation
reddit-moderator-toolbox copied to clipboard

Highlighted words get stripped out when editing

Open creesch opened this issue 4 years ago • 1 comments

https://www.reddit.com/r/toolbox/comments/npml0l/toolbox_seems_to_be_editing_out_highlighted_words/

Not sure what is causing it, there might just be a weird interaction going with how reddit implemented the edit mechanism.

creesch avatar Jun 01 '21 09:06 creesch

I think I figured it out already, the edit textarea is already part of the DOM just not displayed. Highlighting also targets that accidentally creating a span element in the textarea which then on activating edit gets stripped out.

So the fix is likely as simple as making the highlight selector a bit more specific to exclude anything that is a child of a div with the usertext-edit class.

edit:

Had a look at comment.js and the selectors there look ok. But in queutools we also apply highlighting and there they look like they would cause this issue.

https://github.com/toolbox-team/reddit-moderator-toolbox/blob/master/extension/data/modules/queuetools.js#L1091-L1095

Can't currently test it out properly though.

creesch avatar Jun 01 '21 09:06 creesch