Make WordPress Core

Changeset 40587


Ignore:
Timestamp:
05/09/2017 01:39:49 AM (10 years ago)
Author:
azaozz
Message:

TinyMCE: improve adding of custom UI to the MCE Factory.

Props iseulde.
Fixes #40690.

Location:
trunk/src/wp-includes/js/tinymce/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r40583 r40587  
    683683                        mceToolbar,
    684684                        mceStatusbar,
    685                         namesAdded,
    686685                        wpStatusbar;
    687686
    … …  
    701700
    702701                        each( buttons, function( item ) {
    703                                 var itemName, ui, name;
     702                                var itemName;
    704703
    705704                                function bindSelectorChanged() {
    … …  
    769768                                                buttonGroup = null;
    770769                                        } else {
    771                                                 // Add the new WP* types to the factory
    772                                                 if ( ! namesAdded ) {
    773                                                         ui = tinymce.ui;
    774 
    775                                                         for ( name in ui ) {
    776                                                                 if ( name.toLowerCase().indexOf( 'wp' ) === 0 ) {
    777                                                                         Factory.add( name, ui[name] );
    778                                                                 }
    779                                                         }
    780 
    781                                                         namesAdded = true;
    782                                                 }
    783 
    784770                                                if ( ! buttonGroup ) {
    785771                                                        buttonGroup = {
  • trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js

    r38891 r40587  
    11( function( tinymce ) {
    2         tinymce.ui.WPLinkPreview = tinymce.ui.Control.extend( {
     2        tinymce.ui.Factory.add( 'WPLinkPreview', tinymce.ui.Control.extend( {
    33                url: '#',
    44                renderHtml: function() {
    … …  
    5151                        }
    5252                }
    53         } );
    54 
    55         tinymce.ui.WPLinkInput = tinymce.ui.Control.extend( {
     53        } ) );
     54
     55        tinymce.ui.Factory.add( 'WPLinkInput', tinymce.ui.Control.extend( {
    5656                renderHtml: function() {
    5757                        return (
    … …  
    8383                        urlInput.nextSibling.value = '';
    8484                }
    85         } );
     85        } ) );
    8686
    8787        tinymce.PluginManager.add( 'wplink', function( editor ) {
Note: See TracChangeset for help on using the changeset viewer.