Ticket #6390: 6390_4.patch
File 6390_4.patch, 6.3 KB (added by , 13 years ago) |
---|
-
_source/plugins/dialog/plugin.js
710 710 */ 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; 722 715 var definition = this.definition; … … 1852 1845 if ( !coverElement ) 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; ', 1858 1851 ( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ), … … 1933 1926 resizeCover = resizeFunc; 1934 1927 win.on( 'resize', resizeFunc ); 1935 1928 resizeFunc(); 1929 coverElement.focus(); 1936 1930 if ( CKEDITOR.env.ie6Compat ) 1937 1931 { 1938 1932 // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll. … … 2896 2890 }); 2897 2891 2898 2892 })(); 2899 })();2900 2893 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.add 2910 * @example 2911 * 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; 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; 2918 2917 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 = {} ); 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 = {} ); 2924 2926 2925 var dialog = storedDialogs[ dialogName ] ||2926 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );2927 var dialog = storedDialogs[ dialogName ] || 2928 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); 2927 2929 2928 callback && callback.call( dialog, dialog );2929 dialog.show();2930 callback && callback.call( dialog, dialog ); 2931 dialog.show(); 2930 2932 2931 return dialog;2932 }2933 else if ( dialogDefinitions == 'failed' )2934 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );2933 return dialog; 2934 } 2935 else if ( dialogDefinitions == 'failed' ) 2936 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); 2935 2937 2936 // Not loaded? Load the .js file first. 2937 var body = CKEDITOR.document.getBody(), 2938 cursor = body.$.style.cursor, 2939 me = this; 2938 var me = this; 2940 2939 2941 body.setStyle( 'cursor', 'wait' ); 2942 2943 function onDialogFileLoaded( success ) 2944 { 2945 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2946 skin = me.skin.dialog; 2940 function onDialogFileLoaded( success ) 2941 { 2942 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2943 skin = me.skin.dialog; 2947 2944 2948 // Check if both skin part and definition is loaded.2949 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )2950 return;2945 // Check if both skin part and definition is loaded. 2946 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) 2947 return; 2951 2948 2952 // In case of plugin error, mark it as loading failed.2953 if ( typeof dialogDefinition != 'function' )2954 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';2949 // In case of plugin error, mark it as loading failed. 2950 if ( typeof dialogDefinition != 'function' ) 2951 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; 2955 2952 2956 me.openDialog( dialogName, callback ); 2957 body.setStyle( 'cursor', cursor ); 2958 } 2953 me.openDialog( dialogName, callback ); 2954 } 2959 2955 2960 if ( typeof dialogDefinitions == 'string' )2961 {2962 var loadDefinition = 1;2963 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded);2964 }2956 if ( typeof dialogDefinitions == 'string' ) 2957 { 2958 var loadDefinition = 1; 2959 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 ); 2960 } 2965 2961 2966 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );2962 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); 2967 2963 2968 return null; 2969 } 2970 }); 2964 return null; 2965 } 2966 }); 2967 })(); 2971 2968 2972 2969 CKEDITOR.plugins.add( 'dialog', 2973 2970 {