Make WordPress Core

Opened 6 years ago

Last modified 4 years ago

#43564 new defect (bug)

TinyMCE bookmark not removed

Reported by: waterlord93's profile waterlord93 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.9.4
Component: Editor Keywords: needs-patch
Focuses: ui, javascript, administration Cc:


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:

&lt;span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"&gt;&lt;/span&gt;

Here is example to replicate bug:

<iframe width="100%" height="450" style="border: 0;" src=";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.

Change History (3)

#1 @pento
5 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

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() in src/js/_enqueues/wp/editor/base.js, to move the cursor outside of <iframe> tags when switching between the Text and Visual editors.

#2 @maciejmackowiak
4 years ago

Any updates?

We are expiriencing same issue in WP 5.3.2 with Classic Editor plugin, and not only iframes are affected but also style and script tags.

This looks related to #42908

#3 @archon810
4 years ago

+1. This behavior along with br tags getting added is making using inline style tags impossible.

Note: See TracTickets for help on using tickets.