Changeset 26899
- Timestamp:
- 01/03/2014 02:33:00 AM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-editor.php
r26898 r26899 235 235 'wpgallery', 236 236 'wplink', 237 'wpdialogs', 237 238 ) ) ); 238 239 -
trunk/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js
r26876 r26899 1 1 /* global tinymce */ 2 3 tinymce.WPWindowManager = function( editor ) { 4 var element; 2 /** 3 * Included for back-compat. 4 * The default WindowManager in TinyMCE 4.0 supports three types of dialogs: 5 * - With HTML created from JS. 6 * - With inline HTML (like WPWindowManager). 7 * - Old type iframe based dialogs. 8 * For examples see the default plugins: https://github.com/tinymce/tinymce/tree/master/js/tinymce/plugins 9 */ 10 tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) { 5 11 6 12 this.parent = editor.windowManager; 7 13 this.editor = editor; 8 14 9 tinymce.extend( this, this.parent ) 15 tinymce.extend( this, this.parent ); 10 16 11 17 this.open = function( args, params ) { 12 var self = this, element;18 var self = this, $element; 13 19 14 if ( ! args.wpDialog ) 20 if ( ! args.wpDialog ) { 15 21 return this.parent.open( args, params ); 16 else if ( ! args.id )22 } else if ( ! args.id ) { 17 23 return; 24 } 18 25 19 self.element = element = jQuery('#' + args.id); 20 if ( ! element.length ) 26 self.element = $element = jQuery( '#' + args.id ); 27 28 if ( ! $element.length ) { 21 29 return; 30 } 31 32 if ( window && window.console ) { 33 window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.'); 34 } 22 35 23 36 self.features = args; 24 37 self.params = params; 25 self.onOpen.dispatch( self, args, params ); 26 self.windows.push( element ); 38 self.windows.push( $element ); 27 39 28 // Store selection 29 // self.bookmark = self.editor.selection.getBookmark(1);40 // Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog. 41 editor.nodeChanged(); 30 42 31 43 // Create the dialog if necessary 32 if ( ! element.data('wpdialog') ) {33 element.wpdialog({44 if ( ! $element.data('wpdialog') ) { 45 $element.wpdialog({ 34 46 title: args.title, 35 47 width: args.width, … … 41 53 } 42 54 43 element.wpdialog('open'); 55 $element.wpdialog('open'); 56 57 $element.on( 'wpdialogclose', function() { 58 var i = self.windows.length; 59 60 while ( i-- && i > -1 ) { 61 if ( self.windows[i] === self.element ) { 62 self.windows.splice( i, 1 ); 63 } 64 } 65 }); 44 66 }; 45 67 46 68 this.close = function() { 47 if ( ! this.features.wpDialog ) 69 if ( ! this.features.wpDialog ) { 48 70 return this.parent.close.apply( this, arguments ); 71 } 49 72 50 73 this.element.wpdialog('close');
Note: See TracChangeset
for help on using the changeset viewer.