Ticket #6390: 6390_3.patch
File 6390_3.patch, 6.6 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; … … 758 751 { 759 752 CKEDITOR.dialog._.currentTop = this; 760 753 this._.parentDialog = null; 761 showCover( this._.editor );762 754 763 755 element.on( 'keydown', accessKeyDownHandler ); 764 756 element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); … … 1852 1844 if ( !coverElement ) 1853 1845 { 1854 1846 var html = [ 1855 '<div style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),1847 '<div tabIndex="-1" style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ), 1856 1848 '; z-index: ', baseFloatZIndex, 1857 1849 '; top: 0px; left: 0px; ', 1858 1850 ( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ), … … 1933 1925 resizeCover = resizeFunc; 1934 1926 win.on( 'resize', resizeFunc ); 1935 1927 resizeFunc(); 1928 coverElement.focus(); 1936 1929 if ( CKEDITOR.env.ie6Compat ) 1937 1930 { 1938 1931 // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll. … … 2896 2889 }); 2897 2890 2898 2891 })(); 2899 })();2900 2892 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; 2893 // Extend the CKEDITOR.editor class with dialog specific functions. 2894 CKEDITOR.tools.extend( CKEDITOR.editor.prototype, 2895 /** @lends CKEDITOR.editor.prototype */ 2896 { 2897 /** 2898 * Loads and opens a registered dialog. 2899 * @param {String} dialogName The registered name of the dialog. 2900 * @param {Function} callback The function to be invoked after dialog instance created. 2901 * @see CKEDITOR.dialog.add 2902 * @example 2903 * CKEDITOR.instances.editor1.openDialog( 'smiley' ); 2904 * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. 2905 */ 2906 openDialog : function( dialogName, callback ) 2907 { 2908 if ( this.mode == 'wysiwyg' && CKEDITOR.env.ie ) 2909 { 2910 var selection = this.getSelection(); 2911 selection && selection.lock(); 2912 } 2913 2914 var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2915 dialogSkin = this.skin.dialog; 2918 2916 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 = {} );2917 // If the dialogDefinition is already loaded, open it immediately. 2918 if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) 2919 { 2920 var storedDialogs = this._.storedDialogs || 2921 ( this._.storedDialogs = {} ); 2924 2922 2925 var dialog = storedDialogs[ dialogName ] ||2926 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );2923 var dialog = storedDialogs[ dialogName ] || 2924 ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); 2927 2925 2928 callback && callback.call( dialog, dialog );2929 dialog.show();2926 callback && callback.call( dialog, dialog ); 2927 dialog.show(); 2930 2928 2931 return dialog;2932 }2933 else if ( dialogDefinitions == 'failed' )2934 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );2929 return dialog; 2930 } 2931 else if ( dialogDefinitions == 'failed' ) 2932 throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); 2935 2933 2936 // Not loaded? Load the .js file first. 2937 var body = CKEDITOR.document.getBody(), 2938 cursor = body.$.style.cursor, 2939 me = this; 2934 var me = this; 2940 2935 2941 body.setStyle( 'cursor', 'wait' ); 2942 2943 function onDialogFileLoaded( success ) 2944 { 2945 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2946 skin = me.skin.dialog; 2936 function onDialogFileLoaded( success ) 2937 { 2938 var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], 2939 skin = me.skin.dialog; 2947 2940 2948 // Check if both skin part and definition is loaded.2949 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )2950 return;2941 // Check if both skin part and definition is loaded. 2942 if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) 2943 return; 2951 2944 2952 // In case of plugin error, mark it as loading failed.2953 if ( typeof dialogDefinition != 'function' )2954 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';2945 // In case of plugin error, mark it as loading failed. 2946 if ( typeof dialogDefinition != 'function' ) 2947 CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; 2955 2948 2956 me.openDialog( dialogName, callback ); 2957 body.setStyle( 'cursor', cursor ); 2958 } 2949 me.openDialog( dialogName, callback ); 2950 } 2959 2951 2960 if ( typeof dialogDefinitions == 'string' ) 2961 { 2962 var loadDefinition = 1; 2963 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded ); 2964 } 2952 if ( CKEDITOR.dialog._.currentTop === null ) 2953 showCover( this ); 2954 2955 if ( typeof dialogDefinitions == 'string' ) 2956 { 2957 var loadDefinition = 1; 2958 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 ); 2959 } 2965 2960 2966 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );2961 CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); 2967 2962 2968 return null; 2969 } 2970 }); 2963 return null; 2964 } 2965 }); 2966 })(); 2971 2967 2972 2968 CKEDITOR.plugins.add( 'dialog', 2973 2969 {