wysiwyg-editor
wysiwyg-editor copied to clipboard
Clear formatting plugin fails with script error in some cases.
Expected behavior
The formatting should be cleared.
Actual behavior.
The formatting isn't cleared and a script error is printed in devtools.
Steps to reproduce the problem.
Using this fiddle: https://jsfiddle.net/xp8ezhj3/2/ do the following steps:
- Click in editor
- Type text 'test1' and press enter
- Type text 'test2'
- Press Ctrl+A to select all text
- Press Ctrl+B to make the text bold
- While the bold text is still selected, click the 'clear formatting' toolbar icon with the mouse.
- Notice the formatting isnt cleared
Editor version.
3.0.5
OS.
Windows 10
Browser.
Firefox 68.0.2 Edge 44.18362.267.0 Chrome 76.0.3809.100 IE11
Recording.
Can create one if necessary
This seems to happen when selecting a string of text that is itself wrapped in a closing tag. After selecting, if I switch to code view, it's clear that the closing tag is not part of the selection which I wonder is part of the cause:
https://user-images.githubusercontent.com/5510974/190485529-374246fd-c727-4c00-afba-31c75a7781c6.mov
Selecting all and then clearing formatting works as expected.