Edit File by line
/home/zeestwma/redstone.../wp-inclu.../js/tinymce/plugins/wpdialog...
File: plugin.js
/* global tinymce */
[0] Fix | Delete
/**
[1] Fix | Delete
* Included for back-compat.
[2] Fix | Delete
* The default WindowManager in TinyMCE 4.0 supports three types of dialogs:
[3] Fix | Delete
* - With HTML created from JS.
[4] Fix | Delete
* - With inline HTML (like WPWindowManager).
[5] Fix | Delete
* - Old type iframe based dialogs.
[6] Fix | Delete
* For examples see the default plugins: https://github.com/tinymce/tinymce/tree/master/js/tinymce/plugins
[7] Fix | Delete
*/
[8] Fix | Delete
tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) {
[9] Fix | Delete
if ( this.wp ) {
[10] Fix | Delete
return this;
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
this.wp = {};
[14] Fix | Delete
this.parent = editor.windowManager;
[15] Fix | Delete
this.editor = editor;
[16] Fix | Delete
[17] Fix | Delete
tinymce.extend( this, this.parent );
[18] Fix | Delete
[19] Fix | Delete
this.open = function( args, params ) {
[20] Fix | Delete
var $element,
[21] Fix | Delete
self = this,
[22] Fix | Delete
wp = this.wp;
[23] Fix | Delete
[24] Fix | Delete
if ( ! args.wpDialog ) {
[25] Fix | Delete
return this.parent.open.apply( this, arguments );
[26] Fix | Delete
} else if ( ! args.id ) {
[27] Fix | Delete
return;
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
if ( typeof jQuery === 'undefined' || ! jQuery.wp || ! jQuery.wp.wpdialog ) {
[31] Fix | Delete
// wpdialog.js is not loaded.
[32] Fix | Delete
if ( window.console && window.console.error ) {
[33] Fix | Delete
window.console.error('wpdialog.js is not loaded. Please set "wpdialogs" as dependency for your script when calling wp_enqueue_script(). You may also want to enqueue the "wp-jquery-ui-dialog" stylesheet.');
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
return;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
wp.$element = $element = jQuery( '#' + args.id );
[40] Fix | Delete
[41] Fix | Delete
if ( ! $element.length ) {
[42] Fix | Delete
return;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
if ( window.console && window.console.log ) {
[46] Fix | Delete
window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.');
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
wp.features = args;
[50] Fix | Delete
wp.params = params;
[51] Fix | Delete
[52] Fix | Delete
// Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog.
[53] Fix | Delete
editor.nodeChanged();
[54] Fix | Delete
[55] Fix | Delete
// Create the dialog if necessary.
[56] Fix | Delete
if ( ! $element.data('wpdialog') ) {
[57] Fix | Delete
$element.wpdialog({
[58] Fix | Delete
title: args.title,
[59] Fix | Delete
width: args.width,
[60] Fix | Delete
height: args.height,
[61] Fix | Delete
modal: true,
[62] Fix | Delete
dialogClass: 'wp-dialog',
[63] Fix | Delete
zIndex: 300000
[64] Fix | Delete
});
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
$element.wpdialog('open');
[68] Fix | Delete
[69] Fix | Delete
$element.on( 'wpdialogclose', function() {
[70] Fix | Delete
if ( self.wp.$element ) {
[71] Fix | Delete
self.wp = {};
[72] Fix | Delete
}
[73] Fix | Delete
});
[74] Fix | Delete
};
[75] Fix | Delete
[76] Fix | Delete
this.close = function() {
[77] Fix | Delete
if ( ! this.wp.features || ! this.wp.features.wpDialog ) {
[78] Fix | Delete
return this.parent.close.apply( this, arguments );
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
this.wp.$element.wpdialog('close');
[82] Fix | Delete
};
[83] Fix | Delete
};
[84] Fix | Delete
[85] Fix | Delete
tinymce.PluginManager.add( 'wpdialogs', function( editor ) {
[86] Fix | Delete
// Replace window manager.
[87] Fix | Delete
editor.on( 'init', function() {
[88] Fix | Delete
editor.windowManager = new tinymce.WPWindowManager( editor );
[89] Fix | Delete
});
[90] Fix | Delete
});
[91] Fix | Delete
[92] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function