Changeset 6303
- Timestamp:
- 01/11/11 15:25:52 (2 years ago)
- Location:
- CKEditor/trunk
- Files:
-
- 2 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/dialog/plugin.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/CHANGES.html
r6302 r6303 79 79 <li><a href="http://dev.ckeditor.com/ticket/6791">#6791</a> : [IE7] Editor didn't show up when the replaced textarea's name was matching to the name of a meta tag in the page.</li> 80 80 <li><a href="http://dev.ckeditor.com/ticket/5684">#5684</a> : [FF] When "forcePasteAsPlainText" is used, cursor disappears after paste.</li> 81 <li><a href="http://dev.ckeditor.com/ticket/6390">#6390</a> : Prevents toolbar dialog buttons from being clicked twice.</li> 81 82 </ul> 82 83 <h3> -
CKEditor/trunk/_source/plugins/dialog/plugin.js
r6252 r6303 711 711 show : function() 712 712 { 713 var editor = this._.editor;714 if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )715 {716 var selection = editor.getSelection();717 selection && selection.lock();718 }719 720 713 // Insert the dialog's element to the root document. 721 714 var element = this._.element; … … 1853 1846 { 1854 1847 var html = [ 1855 '<div style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),1848 '<div tabIndex="-1" style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ), 1856 1849 '; z-index: ', baseFloatZIndex, 1857 1850 '; top: 0px; left: 0px; ', … … 1934 1927 win.on( 'resize', resizeFunc ); 1935 1928 resizeFunc(); 1929 coverElement.focus(); 1936 1930 if ( CKEDITOR.env.ie6Compat ) 1937 1931 { … … 2897 2891 2898 2892 })(); 2893 2894 // Extend the CKEDITOR.editor class with dialog specific functions. 2895 CKEDITOR.tools.extend( CKEDITOR.editor.prototype, 2896 /** @lends CKEDITOR.editor.prototype */ 2897 { 2898 /** 2899 * Loads and opens a registered dialog. 2900 * @param {String} dialogName The registered name of the dialog. 2901 * @param {Function} callback The function to be invoked after dialog instance created. 2902 * @see CKEDITOR.dialog.add 2903 * @example 2904 * CKEDITOR.instances.editor1.openDialog( 'smiley' ); 2905 * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. 2906 */ 2907 openDialog : function( dialogName, callback ) 2908 { 2909 if ( this.mode == 'wysiwyg' && CKEDITOR.env.ie ) 2910 { 2911 var selection = this.getSelection(); 2912 selection && selection.lock(); 2913 } 2914 2915 var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2916 dialogSkin = this.skin.dialog; 2917 2918 if ( CKEDITOR.dialog._.currentTop === null ) 2919 showCover( this ); 2920 2921 // If the dialogDefinition is already loaded, open it immediately. 2922 if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) 2923 { 2924 var storedDialogs = this._.storedDialogs || 2925 ( this._.storedDialogs = {} ); 2926 2927 var dialog = storedDialogs[ dialogName ] || 2928 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); 2929 2930 callback && callback.call( dialog, dialog ); 2931 dialog.show(); 2932 2933 return dialog; 2934 } 2935 else if ( dialogDefinitions == 'failed' ) 2936 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); 2937 2938 var me = this; 2939 2940 function onDialogFileLoaded( success ) 2941 { 2942 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2943 skin = me.skin.dialog; 2944 2945 // Check if both skin part and definition is loaded. 2946 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) 2947 return; 2948 2949 // In case of plugin error, mark it as loading failed. 2950 if ( typeof dialogDefinition != 'function' ) 2951 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; 2952 2953 me.openDialog( dialogName, callback ); 2954 } 2955 2956 if ( typeof dialogDefinitions == 'string' ) 2957 { 2958 var loadDefinition = 1; 2959 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 ); 2960 } 2961 2962 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); 2963 2964 return null; 2965 } 2966 }); 2899 2967 })(); 2900 2901 // Extend the CKEDITOR.editor class with dialog specific functions.2902 CKEDITOR.tools.extend( CKEDITOR.editor.prototype,2903 /** @lends CKEDITOR.editor.prototype */2904 {2905 /**2906 * Loads and opens a registered dialog.2907 * @param {String} dialogName The registered name of the dialog.2908 * @param {Function} callback The function to be invoked after dialog instance created.2909 * @see CKEDITOR.dialog.add2910 * @example2911 * CKEDITOR.instances.editor1.openDialog( 'smiley' );2912 * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.2913 */2914 openDialog : function( dialogName, callback )2915 {2916 var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],2917 dialogSkin = this.skin.dialog;2918 2919 // If the dialogDefinition is already loaded, open it immediately.2920 if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded )2921 {2922 var storedDialogs = this._.storedDialogs ||2923 ( this._.storedDialogs = {} );2924 2925 var dialog = storedDialogs[ dialogName ] ||2926 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );2927 2928 callback && callback.call( dialog, dialog );2929 dialog.show();2930 2931 return dialog;2932 }2933 else if ( dialogDefinitions == 'failed' )2934 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );2935 2936 // Not loaded? Load the .js file first.2937 var body = CKEDITOR.document.getBody(),2938 cursor = body.$.style.cursor,2939 me = this;2940 2941 body.setStyle( 'cursor', 'wait' );2942 2943 function onDialogFileLoaded( success )2944 {2945 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],2946 skin = me.skin.dialog;2947 2948 // Check if both skin part and definition is loaded.2949 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )2950 return;2951 2952 // In case of plugin error, mark it as loading failed.2953 if ( typeof dialogDefinition != 'function' )2954 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';2955 2956 me.openDialog( dialogName, callback );2957 body.setStyle( 'cursor', cursor );2958 }2959 2960 if ( typeof dialogDefinitions == 'string' )2961 {2962 var loadDefinition = 1;2963 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded );2964 }2965 2966 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );2967 2968 return null;2969 }2970 });2971 2968 2972 2969 CKEDITOR.plugins.add( 'dialog',
Note: See TracChangeset
for help on using the changeset viewer.
