Opened 7 years ago
Last modified 5 years ago
#43564 new defect (bug)
TinyMCE bookmark not removed
Reported by: | waterlord93 | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.9.4 |
Component: | Editor | Keywords: | needs-patch |
Focuses: | ui, javascript, administration | Cc: |
Description
If cursor is placed between <iframe> and </iframe> in text mode each time I switch from Text to Visual mode what i guess (from editor.js code) is bookmark is added and not removed, it just keeps stacking with each change.
code that appears between tags is:
<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>
Here is example to replicate bug:
<iframe width="100%" height="450" style="border: 0;" src="https://www.google.com/maps/embed/v1/place?key=xxxx&q=NewYork" frameborder="0"></iframe>
Note: If possible, please use valid key and query, i had to remove them for demonstration, but bug happens even with this code.
Paste that code in Text mode, click between >< of "></iframe>" and switch to Visual mode, then switch back to Text mode (do not click anywhere in Visual mode). Every time this is repeated, it just keeps adding mentioned code.
My humble guess is that this is happening because Visual is generating map preview from iframe tag so it can not detect that same place in code when it is switched back to Text mode.
Thank you for the bug report, @waterlord93!
I'm able to reproduce this issue in WordPress
trunk
using the Classic Editor plugin.It looks like the fix will be to add a special case to
adjustTextAreaSelectionCursors()
insrc/js/_enqueues/wp/editor/base.js
, to move the cursor outside of<iframe>
tags when switching between the Text and Visual editors.