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

Props iseulde.
Fixes #40690.
Built from https://develop.svn.wordpress.org/trunk@40587


git-svn-id: http://core.svn.wordpress.org/trunk@40457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-05-09 01:40:46 +00:00
parent cc9d3cfbb3
commit ec622956c8
6 changed files with 8 additions and 22 deletions

View File

@ -682,7 +682,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
mceIframe = document.getElementById( editor.id + '_ifr' ), mceIframe = document.getElementById( editor.id + '_ifr' ),
mceToolbar, mceToolbar,
mceStatusbar, mceStatusbar,
namesAdded,
wpStatusbar; wpStatusbar;
if ( container ) { if ( container ) {
@ -700,7 +699,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
buttonGroup; buttonGroup;
each( buttons, function( item ) { each( buttons, function( item ) {
var itemName, ui, name; var itemName;
function bindSelectorChanged() { function bindSelectorChanged() {
var selection = editor.selection; var selection = editor.selection;
@ -768,19 +767,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
buttonGroup = null; buttonGroup = null;
} else { } else {
// Add the new WP* types to the factory
if ( ! namesAdded ) {
ui = tinymce.ui;
for ( name in ui ) {
if ( name.toLowerCase().indexOf( 'wp' ) === 0 ) {
Factory.add( name, ui[name] );
}
}
namesAdded = true;
}
if ( ! buttonGroup ) { if ( ! buttonGroup ) {
buttonGroup = { buttonGroup = {
type: 'buttongroup', type: 'buttongroup',

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
( function( tinymce ) { ( function( tinymce ) {
tinymce.ui.WPLinkPreview = tinymce.ui.Control.extend( { tinymce.ui.Factory.add( 'WPLinkPreview', tinymce.ui.Control.extend( {
url: '#', url: '#',
renderHtml: function() { renderHtml: function() {
return ( return (
@ -50,9 +50,9 @@
tinymce.$( this.getEl().firstChild ).attr( 'href', this.url ).text( url ); tinymce.$( this.getEl().firstChild ).attr( 'href', this.url ).text( url );
} }
} }
} ); } ) );
tinymce.ui.WPLinkInput = tinymce.ui.Control.extend( { tinymce.ui.Factory.add( 'WPLinkInput', tinymce.ui.Control.extend( {
renderHtml: function() { renderHtml: function() {
return ( return (
'<div id="' + this._id + '" class="wp-link-input">' + '<div id="' + this._id + '" class="wp-link-input">' +
@ -82,7 +82,7 @@
urlInput.value = ''; urlInput.value = '';
urlInput.nextSibling.value = ''; urlInput.nextSibling.value = '';
} }
} ); } ) );
tinymce.PluginManager.add( 'wplink', function( editor ) { tinymce.PluginManager.add( 'wplink', function( editor ) {
var toolbar; var toolbar;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-40586'; $wp_version = '4.8-alpha-40587';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.