WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#35219 closed defect (bug) (invalid)

Extra HTML added to visual text editor

Reported by: tgaribaldi Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: reporter-feedback
Focuses: Cc:

Description

The issue we have been having is that we provide HTML code for widgets, and these widgets are being duplicated on the wordpress blogs. To recreate

  1. Start a new post
  2. Enter some text in the Visual editor window
  3. Now switch to HTML and embed some HTML code. An example widget for us is pasted below
  4. Now switch back to Visual and enter more text or something
  5. Go to HTML and enter another widget

Save and post
notice the HTML has been duplicated a couple times, is there any way to prevent this when switching between visual editor and html editor?

I submitted a support ticket with our hosting service (wpengine.com) and they have not been able to find a solution and it seems that the problem is with wordpress.org's text editor itself as this is happening on all wordpress.org blogs

Hopefully that is clear, please let me know if you have any solutions, ideas or other questions! Thanks!

Sample widget code:
<!-- SHOPSTYLE COLLECTIVE WIDGET CODE START --> <div class="shopsense-widget" data-options="%7B%22widgetId%22%3A%2256732be7e7055a9f0e0f0134%22%2C%22version%22%3A1%2C%22pid%22%3A%22uid8100-24574090-40%22%2C%22size%22%3A200%2C%22columns%22%3A3%2C%22rows%22%3A1%2C%22url%22%3A%22https%3A%2F%2Fapi.shopstyle.com%2Fapi%2Fv2%22%7D"><script> !function(doc,s,id){ var e, p; if(!doc.getElementById(id)) { e = doc.createElement(s); e.id = id; p = 'shopsensewidget.shopstyle.com/widget-script.js'; var cb = new Date().getTime(); p += '?cb=' + cb; e.src = p; doc.body.appendChild(e); } if(typeof window.ss_shopsense === 'object'){ if(doc.readyState === 'complete'){ window.ss_shopsense.init(); } } }(document, 'script', 'shopsensewidget-script'); </script> <iframe src="shopsensewidget.shopstyle.com/#/?options=%7B%22widgetId%22%3A%2256732be7e7055a9f0e0f0134%22%2C%22version%22%3A1%2C%22pid%22%3A%22uid8100-24574090-40%22%2C%22size%22%3A200%2C%22columns%22%3A3%2C%22rows%22%3A1%2C%22url%22%3A%22https%3A%2F%2Fapi.shopstyle.com%2Fapi%2Fv2%22%7D" height="275px" width="705px" seamless style="border: 0;"></iframe></div> <!-- SHOPSTYLE COLLECTIVE WIDGET CODE END -->

Change History (5)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to TinyMCE

#2 @swissspidy
5 years ago

  • Keywords reporter-feedback added

I can't replicate this on a local install. Nothing is duplicated.

Does this still occur if you try it on a local install, with all plugins deactivated? Does it happen with some other HTML code as well? A simpler, reproducible test case would make this easier.

#3 @azaozz
5 years ago

I can't reproduce this either (in 4.4 and trunk). The only change I see when switching Text => Visual and back is that TinyMCE wraps the content of the <script> tag with <![CDATA[ ... ]]>.

Perhaps a bit more info will shed some light on this. Assuming you're running WordPress 4.4:

  • Does the duplication happen when you switch Text => Visual and back? Or does it happen only after saving/publishing the post?
  • Does it make any difference if you remove the HTML comments?
  • The "media" TinyMCE plugin replaces the iframe with a placeholder (that's the grey square you see in the Visual editor). If the duplication happens on switching editors, does it make a difference if you disable that plugin by commenting it out in wp-includes/class-wp-editor.php: https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/class-wp-editor.php#L391.

#4 @azaozz
5 years ago

One more thing: could you provide a better example of the HTML (with any sensitive parts replaced/removed). Wrapping it in {{{ code here }}} will help ensure it is not mangled.

Version 0, edited 5 years ago by azaozz (next)

#5 @azaozz
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

No reporter feedback for months. Assuming this was caused by a plugin or perhaps a browser extension and was resolved since.

Closing as invalid, feel free to reopen with more info/better example of the pasted content.

Last edited 5 years ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.