TinyMCE: improve adding of custom UI to the MCE Factory.
Props iseulde. Fixes #40690. git-svn-id: https://develop.svn.wordpress.org/trunk@40587 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6e868eed6e
commit
3d2137f1b4
@ -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',
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user