X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialog%2Fplugin.js;h=ee8d0e6d1c151dd8b668dc53e8275a0a9a423168;hb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;hp=c052120dcb0c6119e0aff1dd9ee387e97097ae27;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/dialog/plugin.js b/_source/plugins/dialog/plugin.js index c052120..ee8d0e6 100644 --- a/_source/plugins/dialog/plugin.js +++ b/_source/plugins/dialog/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -7,11 +7,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * @fileOverview The floating dialog plugin. */ -CKEDITOR.plugins.add( 'dialog', - { - requires : [ 'dialogui' ] - }); - /** * No resize for this dialog. * @constant @@ -73,9 +68,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; return null; } - // Stores dialog related data from skin definitions. e.g. margin sizes. - var skinData = {}; - /** * This is the base class for runtime dialog objects. An instance of this * class represents a single named dialog for a single editor instance. @@ -89,11 +81,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; { // Load the dialog definition. var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ]; - if ( !definition ) - { - console.log( 'Error: The dialog "' + dialogName + '" is not defined.' ); - return; - } // Completes the definition with the default values. definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition ); @@ -105,14 +92,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // functions. definition = new definitionObject( this, definition ); - // Fire the "dialogDefinition" event, making it possible to customize - // the dialog definition. - this.definition = definition = CKEDITOR.fire( 'dialogDefinition', - { - name : dialogName, - definition : definition - } - , editor ).definition; var doc = CKEDITOR.document; @@ -148,6 +127,12 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; this.parts = themeBuilt.parts; + CKEDITOR.tools.setTimeout( function() + { + editor.fire( 'ariaWidget', this.parts.contents ); + }, + 0, this ); + // Set the startup styles for the dialog, avoiding it enlarging the // page size on the dialog creation. this.parts.dialog.setStyles( @@ -161,6 +146,14 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Call the CKEDITOR.event constructor to initialize this instance. CKEDITOR.event.call( this ); + // Fire the "dialogDefinition" event, making it possible to customize + // the dialog definition. + this.definition = definition = CKEDITOR.fire( 'dialogDefinition', + { + name : dialogName, + definition : definition + } + , editor ).definition; // Initialize load, show, hide, ok and cancel events. if ( definition.onLoad ) this.on( 'load', definition.onLoad ); @@ -257,6 +250,26 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; this.hide(); }, this ); + // Sort focus list according to tab order definitions. + function setupFocus() + { + var focusList = me._.focusList; + focusList.sort( function( a, b ) + { + // Mimics browser tab order logics; + if ( a.tabIndex != b.tabIndex ) + return b.tabIndex - a.tabIndex; + // Sort is not stable in some browsers, + // fall-back the comparator to 'focusIndex'; + else + return a.focusIndex - b.focusIndex; + }); + + var size = focusList.length; + for ( var i = 0; i < size; i++ ) + focusList[ i ].focusIndex = i; + } + function changeFocus( forward ) { var focusList = me._.focusList, @@ -264,24 +277,44 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; if ( focusList.length < 1 ) return; - var currentIndex = ( me._.currentFocusIndex + offset + focusList.length ) % focusList.length; + var current = me._.currentFocusIndex; + + // Trigger the 'blur' event of any input element before anything, + // since certain UI updates may depend on it. + try + { + focusList[ current ].getInputElement().$.blur(); + } + catch( e ){} + + var startIndex = ( current + offset + focusList.length ) % focusList.length, + currentIndex = startIndex; while ( !focusList[ currentIndex ].isFocusable() ) { currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length; - if ( currentIndex == me._.currentFocusIndex ) + if ( currentIndex == startIndex ) break; } focusList[ currentIndex ].focus(); + + // Select whole field content. + if ( focusList[ currentIndex ].type == 'text' ) + focusList[ currentIndex ].select(); } + this.changeFocus = changeFocus; + + var processed; + function focusKeydownHandler( evt ) { // If I'm not the top dialog, ignore. if ( me != CKEDITOR.dialog._.currentTop ) return; - var keystroke = evt.data.getKeystroke(), - processed = false; + var keystroke = evt.data.getKeystroke(); + + processed = 0; if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 ) { var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 ); @@ -300,14 +333,14 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; changeFocus( !shiftPressed ); } - processed = true; + processed = 1; } - else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode ) + else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 ) { // Alt-F10 puts focus into the current tab item in the tab bar. me._.tabBarMode = true; me._.tabs[ me._.currentTabId ][ 0 ].focus(); - processed = true; + processed = 1; } else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode ) { @@ -315,7 +348,15 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; nextId = ( keystroke == 37 ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) ); me.selectPage( nextId ); me._.tabs[ nextId ][ 0 ].focus(); - processed = true; + processed = 1; + } + else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode ) + { + this.selectPage( this._.currentTabId ); + this._.tabBarMode = false; + this._.currentFocusIndex = -1; + changeFocus( true ); + processed = 1; } if ( processed ) @@ -325,10 +366,20 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; } } + function focusKeyPressHandler( evt ) + { + processed && evt.data.preventDefault(); + } + + var dialogElement = this._.element; // Add the dialog keyboard handlers. this.on( 'show', function() { - CKEDITOR.document.on( 'keydown', focusKeydownHandler, this, null, 0 ); + dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 ); + // Some browsers instead, don't cancel key events in the keydown, but in the + // keypress. So we must do a longer trip in those cases. (#4531) + if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) + dialogElement.on( 'keypress', focusKeyPressHandler, this ); if ( CKEDITOR.env.ie6Compat ) { @@ -338,7 +389,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; } ); this.on( 'hide', function() { - CKEDITOR.document.removeListener( 'keydown', focusKeydownHandler ); + dialogElement.removeListener( 'keydown', focusKeydownHandler ); + if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) + dialogElement.removeListener( 'keypress', focusKeyPressHandler ); } ); this.on( 'iframeAdded', function( evt ) { @@ -349,10 +402,30 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Auto-focus logic in dialog. this.on( 'show', function() { - if ( !this._.hasFocus ) + // Setup tabIndex on showing the dialog instead of on loading + // to allow dynamic tab order happen in dialog definition. + setupFocus(); + + if ( editor.config.dialog_startupFocusTab + && me._.tabIdList.length > 1 ) + { + me._.tabBarMode = true; + me._.tabs[ me._.currentTabId ][ 0 ].focus(); + } + else if ( !this._.hasFocus ) { this._.currentFocusIndex = -1; - changeFocus( true ); + + // Decide where to put the initial focus. + if ( definition.onFocus ) + { + var initialFocus = definition.onFocus.call( this ); + // Focus the field that the user specified. + initialFocus && initialFocus.focus(); + } + // Focus the first field in layout order. + else + changeFocus( true ); /* * IE BUG: If the initial focus went into a non-text element (e.g. button), @@ -401,28 +474,22 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; for ( var i = 0 ; i < definition.contents.length ; i++ ) this.addPage( definition.contents[i] ); - var tabRegex = /cke_dialog_tab(\s|$|_)/, - tabOuterRegex = /cke_dialog_tab(\s|$)/; this.parts['tabs'].on( 'click', function( evt ) { - var target = evt.data.getTarget(), firstNode = target, id, page; - + var target = evt.data.getTarget(); // If we aren't inside a tab, bail out. - if ( !( tabRegex.test( target.$.className ) || target.getName() == 'a' ) ) - return; - - // Find the outer container of the tab. - id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) ); - this.selectPage( id ); - - if ( this._.tabBarMode ) + if ( target.hasClass( 'cke_dialog_tab' ) ) { - this._.tabBarMode = false; - this._.currentFocusIndex = -1; - changeFocus( true ); + var id = target.$.id; + this.selectPage( id.substr( 0, id.lastIndexOf( '_' ) ) ); + if ( this._.tabBarMode ) + { + this._.tabBarMode = false; + this._.currentFocusIndex = -1; + changeFocus( true ); + } + evt.data.preventDefault(); } - - evt.data.preventDefault(); }, this ); // Insert buttons. @@ -438,17 +505,18 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; for ( i = 0 ; i < buttons.length ; i++ ) this._.buttons[ buttons[i].id ] = buttons[i]; - - CKEDITOR.skins.load( editor, 'dialog' ); }; // Focusable interface. Use it via dialog.addFocusable. - function Focusable( dialog, element, index ) { + function Focusable( dialog, element, index ) + { this.element = element; this.focusIndex = index; + // TODO: support tabIndex for focusables. + this.tabIndex = 0; this.isFocusable = function() { - return true; + return !element.getAttribute( 'disabled' ) && element.isVisible(); }; this.focus = function() { @@ -576,8 +644,12 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; */ show : function() { - if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - this._.editor.getSelection().lock(); + var editor = this._.editor; + if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) + { + var selection = editor.getSelection(); + selection && selection.lock(); + } // Insert the dialog's element to the root document. var element = this._.element; @@ -621,8 +693,12 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; this._.parentDialog = null; addCover( this._.editor ); - CKEDITOR.document.on( 'keydown', accessKeyDownHandler ); - CKEDITOR.document.on( 'keyup', accessKeyUpHandler ); + element.on( 'keydown', accessKeyDownHandler ); + element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); + + // Prevent some keys from bubbling up. (#4269) + for ( var event in { keyup :1, keydown :1, keypress :1 } ) + element.on( event, preventKeyBubbling ); } else { @@ -656,6 +732,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Execute onLoad for the first show. this.fireOnce( 'load', {} ); this.fire( 'show', {} ); + this._.editor.fire( 'dialogShow', this ); // Save the initial values of the dialog. this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); @@ -719,6 +796,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; hide : function() { this.fire( 'hide', {} ); + this._.editor.fire( 'dialogHide', this ); // Remove the dialog's element from the root document. var element = this._.element; @@ -747,14 +825,21 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; CKEDITOR.dialog._.currentZIndex = null; // Remove access key handlers. - CKEDITOR.document.removeListener( 'keydown', accessKeyDownHandler ); - CKEDITOR.document.removeListener( 'keyup', accessKeyUpHandler ); + element.removeListener( 'keydown', accessKeyDownHandler ); + element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); + + // Remove bubbling-prevention handler. (#4269) + for ( var event in { keyup :1, keydown :1, keypress :1 } ) + element.removeListener( event, preventKeyBubbling ); var editor = this._.editor; editor.focus(); if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - editor.getSelection().unlock( true ); + { + var selection = editor.getSelection(); + selection && selection.unlock( true ); + } } else CKEDITOR.dialog._.currentZIndex -= 10; @@ -786,29 +871,32 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Create the HTML for the tab and the content block. var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) ); - var tab = CKEDITOR.dom.element.createFromHtml( [ + page.setAttribute( 'role', 'tabpanel' ); + + var env = CKEDITOR.env; + var tabId = contents.id + '_' + CKEDITOR.tools.getNextNumber(), + tab = CKEDITOR.dom.element.createFromHtml( [ ' 0 ? ' cke_last' : 'cke_first' ), titleHtml, ( !!contents.hidden ? ' style="display:none"' : '' ), - ' id="', contents.id + '_', CKEDITOR.tools.getNextNumber(), '"' + - ' href="javascript:void(0)"', - ' hidefocus="true">', + ' id="', tabId, '"', + env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"', + ' tabIndex="-1"', + ' hidefocus="true"', + ' role="tab">', contents.label, '' ].join( '' ) ); - // If only a single page exist, a different style is used in the central pane. - if ( this._.pageCount === 0 ) - this.parts.dialog.addClass( 'cke_single_page' ); - else - this.parts.dialog.removeClass( 'cke_single_page' ); + page.setAttribute( 'aria-labelledby', tabId ); // Take records for the tabs and elements created. this._.tabs[ contents.id ] = [ tab, page ]; this._.tabIdList.push( contents.id ); - this._.pageCount++; + !contents.hidden && this._.pageCount++; this._.lastTab = tab; + this.updateStyle(); var contentMap = this._.contents[ contents.id ] = {}, cursor, @@ -856,6 +944,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; tab.removeClass( 'cke_dialog_tab_selected' ); page.hide(); } + page.setAttribute( 'aria-hidden', i != id ); } var selected = this._.tabs[id]; @@ -865,6 +954,13 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id ); }, + // Dialog state-specific style updates. + updateStyle : function() + { + // If only a single page shown, a different style is used in the central pane. + this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' ); + }, + /** * Hides a page's tab away from the dialog. * @param {String} id The page's Id. @@ -874,9 +970,15 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; hidePage : function( id ) { var tab = this._.tabs[id] && this._.tabs[id][0]; - if ( !tab ) + if ( !tab || this._.pageCount == 1 ) return; + // Switch to other tab first when we're hiding the active tab. + else if ( id == this._.currentTabId ) + this.selectPage( getPreviousVisibleTab.call( this ) ); + tab.hide(); + this._.pageCount--; + this.updateStyle(); }, /** @@ -891,6 +993,8 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; if ( !tab ) return; tab.show(); + this._.pageCount++; + this.updateStyle(); }, /** @@ -925,7 +1029,8 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; */ getContentElement : function( pageId, elementId ) { - return this._.contents[pageId][elementId]; + var page = this._.contents[ pageId ]; + return page && page[ elementId ]; }, /** @@ -1172,12 +1277,15 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; var defaultDialogDefinition = { - resizable : CKEDITOR.DIALOG_RESIZE_NONE, + resizable : CKEDITOR.DIALOG_RESIZE_BOTH, minWidth : 600, minHeight : 400, buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] }; + // The buttons in MacOS Apps are in reverse order #4750 + CKEDITOR.env.mac && defaultDialogDefinition.buttons.reverse(); + // Tool function used to return an item from an array based on its id // property. var getById = function( array, id, recurse ) @@ -1424,7 +1532,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; element = dialog.getElement().getFirst(), editor = dialog.getParentEditor(), magnetDistance = editor.config.dialog_magnetDistance, - margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ]; + margins = editor.skin.margins || [ 0, 0, 0, 0 ]; + + if ( typeof magnetDistance == 'undefined' ) + magnetDistance = 20; function mouseMoveHandler( evt ) { @@ -1499,7 +1610,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; minWidth = definition.minWidth || 0, minHeight = definition.minHeight || 0, resizable = definition.resizable, - margins = skinData[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ]; + margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ]; function topSizer( coords, dy ) { @@ -1645,11 +1756,13 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; if ( !coverElement ) { + var backgroundColorStyle = editor.config.dialog_backgroundCoverColor || 'white'; + var html = [ '
' ]; @@ -1657,7 +1770,8 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; if ( CKEDITOR.env.ie6Compat ) { // Support for custom document.domain in IE. - var isCustomDomain = CKEDITOR.env.isCustomDomain(); + var isCustomDomain = CKEDITOR.env.isCustomDomain(), + iframeHtml = ''; html.push( '' ); return html.join( '' ); }; - CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, null, innerHTML ); + CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); } }; })(); @@ -2421,7 +2551,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; */ isVisible : function() { - return !!this.getInputElement().$.offsetHeight; + return this.getInputElement().isVisible(); }, /** @@ -2522,9 +2652,12 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; { editor.openDialog( this.dialogName ); }, + // Dialog commands just open a dialog ui, thus require no undo logic, // undo support should dedicate to specific dialog implementation. - canUndo: false + canUndo: false, + + editorFocus : CKEDITOR.env.ie }; (function() @@ -2645,17 +2778,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; } }; })(); - - // Grab the margin data from skin definition and store it away. - CKEDITOR.skins.add = ( function() - { - var original = CKEDITOR.skins.add; - return function( skinName, skinDefinition ) - { - skinData[ skinName ] = { margins : skinDefinition.margins }; - return original.apply( this, arguments ); - }; - } )(); })(); // Extend the CKEDITOR.editor class with dialog specific functions. @@ -2665,17 +2787,19 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, /** * Loads and opens a registered dialog. * @param {String} dialogName The registered name of the dialog. + * @param {Function} callback The function to be invoked after dialog instance created. * @see CKEDITOR.dialog.add * @example * CKEDITOR.instances.editor1.openDialog( 'smiley' ); * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. */ - openDialog : function( dialogName ) + openDialog : function( dialogName, callback ) { - var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ]; + var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], + dialogSkin = this.skin.dialog; // If the dialogDefinition is already loaded, open it immediately. - if ( typeof dialogDefinitions == 'function' ) + if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) { var storedDialogs = this._.storedDialogs || ( this._.storedDialogs = {} ); @@ -2683,6 +2807,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, var dialog = storedDialogs[ dialogName ] || ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); + callback && callback.call( dialog, dialog ); dialog.show(); return dialog; @@ -2696,47 +2821,93 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, me = this; body.setStyle( 'cursor', 'wait' ); - CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), function() - { - // In case of plugin error, mark it as loading failed. - if ( typeof CKEDITOR.dialog._.dialogDefinitions[ dialogName ] != 'function' ) - CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; - me.openDialog( dialogName ); - body.setStyle( 'cursor', cursor ); - } ); + + function onDialogFileLoaded( success ) + { + var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], + skin = me.skin.dialog; + + // Check if both skin part and definition is loaded. + if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) + return; + + // In case of plugin error, mark it as loading failed. + if ( typeof dialogDefinition != 'function' ) + CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; + + me.openDialog( dialogName, callback ); + body.setStyle( 'cursor', cursor ); + } + + if ( typeof dialogDefinitions == 'string' ) + { + var loadDefinition = 1; + CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded ); + } + + CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); return null; } }); +CKEDITOR.plugins.add( 'dialog', + { + requires : [ 'dialogui' ] + }); + // Dialog related configurations. /** * The color of the dialog background cover. It should be a valid CSS color * string. + * @name CKEDITOR.config.dialog_backgroundCoverColor * @type String - * @default white + * @default 'white' * @example * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; */ -CKEDITOR.config.dialog_backgroundCoverColor = 'white'; /** * The opacity of the dialog background cover. It should be a number within the * range [0.0, 1.0]. + * @name CKEDITOR.config.dialog_backgroundCoverOpacity * @type Number * @default 0.5 * @example * config.dialog_backgroundCoverOpacity = 0.7; */ -CKEDITOR.config.dialog_backgroundCoverOpacity = 0.5; + +/** + * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened. + * @name CKEDITOR.config.dialog_startupFocusTab + * @type Boolean + * @default false + * @example + * config.dialog_startupFocusTab = true; + */ /** * The distance of magnetic borders used in moving and resizing dialogs, * measured in pixels. + * @name CKEDITOR.config.dialog_magnetDistance * @type Number * @default 20 * @example * config.dialog_magnetDistance = 30; */ -CKEDITOR.config.dialog_magnetDistance = 20; + +/** + * Fired when a dialog definition is about to be used to create a dialog into + * an editor instance. This event makes it possible to customize the definition + * before creating it. + *

Note that this event is called only the first time a specific dialog is + * opened. Successive openings will use the cached dialog, and this event will + * not get fired.

+ * @name CKEDITOR#dialogDefinition + * @event + * @param {CKEDITOR.dialog.dialogDefinition} data The dialog defination that + * is being loaded. + * @param {CKEDITOR.editor} editor The editor instance that will use the + * dialog. + */