[wp-trac] [WordPress Trac] #31412: TinyMCE views improvements

WordPress Trac noreply at wordpress.org
Sun Feb 22 10:47:24 UTC 2015


#31412: TinyMCE views improvements
-------------------------+-------------------------
 Reporter:  iseulde      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.2
Component:  TinyMCE      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  javascript
-------------------------+-------------------------

Comment (by iseulde):

 {{{
 edit: function( node ) {
         var gallery = wp.media.gallery,
                 self = this,
                 frame, data;

         data = window.decodeURIComponent( $( node ).attr('data-wpview-
 text') );
         frame = gallery.edit( data );

         frame.state('gallery-edit').on( 'update', function( selection ) {
                 var shortcode = gallery.shortcode( selection ).string();
                 $( node ).attr( 'data-wpview-text',
 window.encodeURIComponent( shortcode ) );
                 wp.mce.views.refreshView( self, shortcode, true );
         });

         frame.on( 'close', function() {
                 frame.detach();
         });
 }
 }}}

 becomes

 {{{
 edit: function( text, callback ) {
         var gallery = wp.media.gallery,
                 frame = gallery.edit( text );

                 frame.state( 'gallery-edit' ).on( 'update', function(
 selection ) {
                         callback( gallery.shortcode( selection ).string()
 );
                 } );

         frame.on( 'close', function() {
                 frame.detach();
         } );
 }
 }}}

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


More information about the wp-trac mailing list