Changeset 41344
- Timestamp:
- 09/08/2017 10:56:10 AM (7 years ago)
- Location:
- trunk/src/wp-admin/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/editor.js
r41151 r41344 563 563 if ( settings.tinymce && settings.quicktags ) { 564 564 var $textarea = $( '#' + id ); 565 565 566 var $wrap = $( '<div>' ).attr( { 566 567 'class': 'wp-core-ui wp-editor-wrap tmce-active', 567 568 id: 'wp-' + id + '-wrap' 568 569 } ); 570 569 571 var $editorContainer = $( '<div class="wp-editor-container">' ); 572 570 573 var $button = $( '<button>' ).attr( { 571 574 type: 'button', … … 573 576 } ); 574 577 578 var $editorTools = $( '<div class="wp-editor-tools">' ); 579 580 if ( settings.mediaButtons ) { 581 var buttonText = 'Add Media'; 582 583 if ( window._wpMediaViewsL10n && window._wpMediaViewsL10n.addMedia ) { 584 buttonText = window._wpMediaViewsL10n.addMedia; 585 } 586 587 var $addMediaButton = $( '<button type="button" class="button insert-media add_media">' ); 588 589 $addMediaButton.append( '<span class="wp-media-buttons-icon"></span>' ); 590 $addMediaButton.append( document.createTextNode( ' ' + buttonText ) ); 591 $addMediaButton.data( 'editor', id ); 592 593 $editorTools.append( 594 $( '<div class="wp-media-buttons">' ) 595 .append( $addMediaButton ) 596 ); 597 } 598 575 599 $wrap.append( 576 $ ( '<div class="wp-editor-tools">' )600 $editorTools 577 601 .append( $( '<div class="wp-editor-tabs">' ) 578 602 .append( $button.clone().attr({ -
trunk/src/wp-admin/js/widgets/text-widgets.js
r41260 r41344 231 231 if ( typeof window.tinymce === 'undefined' ) { 232 232 wp.editor.initialize( id, { 233 quicktags: true 233 quicktags: true, 234 mediaButtons: true 234 235 }); 235 236 … … 243 244 } 244 245 246 // Add or enable the `wpview` plugin. 247 $( document ).one( 'wp-before-tinymce-init.text-widget-init', function( event, init ) { 248 // If somebody has removed all plugins, they must have a good reason. 249 // Keep it that way. 250 if ( ! init.plugins ) { 251 return; 252 } else if ( ! /\bwpview\b/.test( init.plugins ) ) { 253 init.plugins += ',wpview'; 254 } 255 } ); 256 245 257 wp.editor.initialize( id, { 246 258 tinymce: { 247 259 wpautop: true 248 260 }, 249 quicktags: true 261 quicktags: true, 262 mediaButtons: true 250 263 }); 251 264
Note: See TracChangeset
for help on using the changeset viewer.