[wp-trac] [WordPress Trac] #36434: Consider TinyMCE's implementation of `contenteditable="false"` for views

WordPress Trac noreply at wordpress.org
Mon Jul 4 18:20:06 UTC 2016


#36434: Consider TinyMCE's implementation of `contenteditable="false"` for views
----------------------------+-------------------------
 Reporter:  iseulde         |       Owner:  iseulde
     Type:  task (blessed)  |      Status:  accepted
 Priority:  normal          |   Milestone:  4.6
Component:  TinyMCE         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  javascript
----------------------------+-------------------------

Comment (by bduclos):

 There's an issue with the new code when I try to copy paste a shortcode
 view containing HTML code.
 e.g: I have the following shortcode:
 {{{
 [toggle title="Toggle Title"]<h1>Lorem ipsum</h1>[/toggle]
 }}}
 in Visual Mode, copy the view and paste it, it generates the following
 view:
  [[Image(http://i.imgur.com/dYqUr8P.gif)]]

 Switching back and forth between the Text and Visual mode restores the
 correct view.

 The issue seems to come from the code inside wp-
 includes/js/tinymce/plugins/wpview/plugin.js line 90 (removing it fixes
 this issue):

 {{{
 // Make sure views are copied as their text.
 editor.on( 'drop objectselected', function( event ) {
     if ( isView( event.targetClone ) ) {
          event.targetClone = editor.getDoc().createTextNode(
                 window.decodeURIComponent( editor.dom.getAttrib(
 event.targetClone, 'data-wpview-text' ) )
         );
     }
 } );

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36434#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list