WordPress.org

Make WordPress Core

Opened 19 months ago

Last modified 4 months 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:
PR Number:

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:

&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="https://www.google.com/maps/embed/v1/place?key=xxxx&amp;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 (1)

#1 @pento
4 months 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.

Note: See TracTickets for help on using tickets.