[wp-trac] [WordPress Trac] #36689: New WPLink in Modal Window

WordPress Trac noreply at wordpress.org
Wed Apr 27 16:49:38 UTC 2016


#36689: New WPLink in Modal Window
--------------------------+-----------------------------------------
 Reporter:  berengerzyla  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  TinyMCE       |     Version:  4.5.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  javascript, administration
--------------------------+-----------------------------------------

Comment (by berengerzyla):

 Here is some more information about the context:

 - The modal is tied to a button in the main editor, and then adds a
 shortcode/placeholder.
 - The form of the modal is taken from a template.

 Here is the opening segment:

 {{{
 editor.windowManager.open( {

   html: this.template_form( […] ),
   onpostRender: function() {

     var options = $.extend( {}, tinyMCEPreInit.mceInit.content, {

       body_class: 'description',
       selector: '#description',
       toolbar1: 'bold,italic,link,unlink',
       toolbar2: '',
       toolbar3: '',
       toolbar4: '',
       theme_advanced_statusbar_location: 'none',
       elementpath: false,
       wpautop: false,
       remove_linebreaks: false,
       forced_root_block : "",
       apply_source_formatting: true

     } );

     tinymce.init( options );
     tinyMCE.execCommand( 'mceAddEditor', false, 'description' );

   },
   onclose: function() {

     tinyMCE.execCommand( "mceRemoveEditor", false, 'description' );

   },

 } );
 }}}

 … and a simple extract of my field in the template:

 {{{
 <div class="form-group row">
   <label class=col-sm-3 for=description>{{ data.labels.description
 }}</label>
   <div class=col-sm-9>
     <textarea class="form-control tinymce form-control-sm"
 name=description id=description rows="3">{{ data.values.description
 }}</textarea>
   </div>
 </div>
 }}}

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


More information about the wp-trac mailing list