Ticket #40854: 40854.2.diff
File 40854.2.diff, 2.7 KB (added by , 8 years ago) |
---|
-
src/wp-admin/js/editor.js
545 545 wp.editor.initialize = function( id, settings ) { 546 546 var init; 547 547 var defaults; 548 var addMediaButton; 548 549 549 550 if ( ! $ || ! id || ! wp.editor.getDefaultSettings ) { 550 551 return; … … 559 560 }; 560 561 } 561 562 563 if ( settings.mediaButtons ) { 564 addMediaButton = $( '<button type="button" class="button insert-media add_media">' ); 565 addMediaButton.append( '<span class="wp-media-buttons-icon"></span>' ); 566 addMediaButton.append( document.createTextNode( ' ' + 'Add Media' ) ); // @todo i18n, window.tinymce.translate is not available if ! user_can_richedit(). 567 addMediaButton.data( 'editor', id ); 568 } 569 562 570 // Add wrap and the Visual|Text tabs. 563 571 if ( settings.tinymce && settings.quicktags ) { 564 572 var $textarea = $( '#' + id ); 573 565 574 var $wrap = $( '<div>' ).attr( { 566 575 'class': 'wp-core-ui wp-editor-wrap tmce-active', 567 576 id: 'wp-' + id + '-wrap' 568 577 } ); 578 569 579 var $editorContainer = $( '<div class="wp-editor-container">' ); 580 570 581 var $button = $( '<button>' ).attr( { 571 582 type: 'button', 572 583 'data-wp-editor-id': id 573 584 } ); 574 585 586 var $editorTools = $( '<div class="wp-editor-tools">' ); 587 588 if ( settings.mediaButtons ) { 589 $editorTools.append( 590 $( '<div class="wp-media-buttons">' ) 591 .append( addMediaButton ) 592 ); 593 } 594 575 595 $wrap.append( 576 $ ( '<div class="wp-editor-tools">' )596 $editorTools 577 597 .append( $( '<div class="wp-editor-tabs">' ) 578 598 .append( $button.clone().attr({ 579 599 id: id + '-tmce', -
src/wp-admin/js/widgets/text-widgets.js
230 230 // The user has disabled TinyMCE. 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 236 237 return; … … 242 243 wp.editor.remove( id ); 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 252 265 /**