/**\r
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.\r
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.\r
* For licensing, see LICENSE.md or http://ckeditor.com/license\r
*/\r
\r
title = body.getChild( 0 ),\r
close = body.getChild( 1 );\r
\r
- // Don't allow dragging on dialog (#13184).\r
+ // Don't allow dragging on dialog (http://dev.ckeditor.com/ticket/13184).\r
editor.plugins.clipboard && CKEDITOR.plugins.clipboard.preventDefaultDropOnElement( body );\r
\r
- // IFrame shim for dialog that masks activeX in IE. (#7619)\r
+ // IFrame shim for dialog that masks activeX in IE. (http://dev.ckeditor.com/ticket/7619)\r
if ( CKEDITOR.env.ie && !CKEDITOR.env.quirks && !CKEDITOR.env.edge ) {\r
var src = 'javascript:void(function(){' + encodeURIComponent( 'document.open();(' + CKEDITOR.tools.fixDomain + ')();document.close();' ) + '}())', // jshint ignore:line\r
iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +\r
tabsToRemove = {},\r
i, processed, stopPropagation;\r
\r
- if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (#4750)\r
+ if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (http://dev.ckeditor.com/ticket/4750)\r
( buttonsOrder == 'rtl' && dir == 'ltr' ) || ( buttonsOrder == 'ltr' && dir == 'rtl' ) )\r
defaultDefinition.buttons.reverse();\r
\r
\r
if ( definition.onOk ) {\r
this.on( 'ok', function( evt ) {\r
- // Dialog confirm might probably introduce content changes (#5415).\r
+ // Dialog confirm might probably introduce content changes (http://dev.ckeditor.com/ticket/5415).\r
editor.fire( 'saveSnapshot' );\r
setTimeout( function() {\r
editor.fire( 'saveSnapshot' );\r
currentIndex = currentIndex + offset;\r
\r
if ( hasTabs && !me._.tabBarMode && ( currentIndex == focusList.length || currentIndex == -1 ) ) {\r
- // If the dialog was not in tab mode, then focus the first tab (#13027).\r
+ // If the dialog was not in tab mode, then focus the first tab (http://dev.ckeditor.com/ticket/13027).\r
me._.tabBarMode = true;\r
me._.tabs[ me._.currentTabId ][ 0 ].focus();\r
me._.currentFocusIndex = -1;\r
button && CKEDITOR.tools.setTimeout( button.click, 0, button );\r
processed = 1;\r
}\r
- stopPropagation = 1; // Always block the propagation (#4269)\r
+ stopPropagation = 1; // Always block the propagation (http://dev.ckeditor.com/ticket/4269)\r
} else if ( keystroke == 27 /*ESC*/ ) {\r
button = this.getButton( 'cancel' );\r
\r
if ( this.fire( 'cancel', { hide: true } ).hide !== false )\r
this.hide();\r
}\r
- stopPropagation = 1; // Always block the propagation (#4269)\r
+ stopPropagation = 1; // Always block the propagation (http://dev.ckeditor.com/ticket/4269)\r
} else {\r
return;\r
}\r
dialogElement.on( 'keydown', keydownHandler, this );\r
\r
// Some browsers instead, don't cancel key events in the keydown, but in the\r
- // keypress. So we must do a longer trip in those cases. (#4531,#8985)\r
+ // keypress. So we must do a longer trip in those cases. (http://dev.ckeditor.com/ticket/4531,http://dev.ckeditor.com/ticket/8985)\r
if ( CKEDITOR.env.gecko )\r
dialogElement.on( 'keypress', keypressHandler, this );\r
\r
}\r
}, this, null, 0xffffffff );\r
\r
- // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661).\r
+ // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (http://dev.ckeditor.com/ticket/2661).\r
// This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken.\r
if ( CKEDITOR.env.ie6Compat ) {\r
this.on( 'load', function() {\r
var element = this._.element.getFirst(), rtl = this._.editor.lang.dir == 'rtl';\r
var isFixed = element.getComputedStyle( 'position' ) == 'fixed';\r
\r
- // (#8888) In some cases of a very small viewport, dialog is incorrectly\r
+ // (http://dev.ckeditor.com/ticket/8888) In some cases of a very small viewport, dialog is incorrectly\r
// positioned in IE7. It also happens that it remains sticky and user cannot\r
// scroll down/up to reveal dialog's content below/above the viewport; this is\r
// cumbersome.\r
// Reset all inputs back to their default value.\r
this.reset();\r
\r
- // Select the first tab by default.\r
- this.selectPage( this.definition.contents[ 0 ].id );\r
+ // Selects the first tab if no tab is already selected.\r
+ if ( this._.currentTabId === null ) {\r
+ this.selectPage( this.definition.contents[ 0 ].id );\r
+ }\r
\r
// Set z-index.\r
if ( CKEDITOR.dialog._.currentZIndex === null )\r
commitContent: function() {\r
var args = arguments;\r
this.foreach( function( widget ) {\r
- // Make sure IE triggers "change" event on last focused input before closing the dialog. (#7915)\r
+ // Make sure IE triggers "change" event on last focused input before closing the dialog. (http://dev.ckeditor.com/ticket/7915)\r
if ( CKEDITOR.env.ie && this._.currentFocusIndex == widget.focusIndex )\r
widget.getInputElement().$.blur();\r
\r
var editor = this._.editor;\r
editor.focus();\r
\r
- // Give a while before unlock, waiting for focus to return to the editable. (#172)\r
+ // Give a while before unlock, waiting for focus to return to the editable. (http://dev.ckeditor.com/ticket/172)\r
setTimeout( function() {\r
editor.focusManager.unlock();\r
\r
- // Fixed iOS focus issue (#12381).\r
+ // Fixed iOS focus issue (http://dev.ckeditor.com/ticket/12381).\r
// Keep in mind that editor.focus() does not work in this case.\r
if ( CKEDITOR.env.iOS ) {\r
editor.window.focus();\r
contentObj.resetInitValue && contentObj.resetInitValue();\r
} );\r
\r
- // Reset dialog state back to IDLE, if busy (#13213).\r
+ // Reset dialog state back to IDLE, if busy (http://dev.ckeditor.com/ticket/13213).\r
this.setState( CKEDITOR.DIALOG_STATE_IDLE );\r
},\r
\r
\r
// [IE] an invisible input[type='text'] will enlarge it's width\r
// if it's value is long when it shows, so we clear it's value\r
- // before it shows and then recover it (#5649)\r
+ // before it shows and then recover it (http://dev.ckeditor.com/ticket/5649)\r
if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat ) {\r
clearOrRecoverTextInputValue( selected[ 1 ] );\r
selected[ 1 ].show();\r
}\r
\r
function showCover( editor ) {\r
- var win = CKEDITOR.document.getWindow();\r
- var config = editor.config,\r
- backgroundColorStyle = config.dialog_backgroundCoverColor || 'white',\r
+ var win = CKEDITOR.document.getWindow(),\r
+ config = editor.config,\r
+ skinName = ( CKEDITOR.skinName || editor.config.skin ),\r
+ backgroundColorStyle = config.dialog_backgroundCoverColor || ( skinName == 'moono-lisa' ? 'black' : 'white' ),\r
backgroundCoverOpacity = config.dialog_backgroundCoverOpacity,\r
baseFloatZIndex = config.baseFloatZIndex,\r
coverKey = CKEDITOR.tools.genKey( backgroundColorStyle, backgroundCoverOpacity, baseFloatZIndex ),\r
resizeCover = resizeFunc;\r
win.on( 'resize', resizeFunc );\r
resizeFunc();\r
- // Using Safari/Mac, focus must be kept where it is (#7027)\r
+ // Using Safari/Mac, focus must be kept where it is (http://dev.ckeditor.com/ticket/7027)\r
if ( !( CKEDITOR.env.mac && CKEDITOR.env.webkit ) )\r
coverElement.focus();\r
\r
if ( elementDefinition && elementDefinition.padding !== undefined ) {\r
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );\r
}\r
- // In IE Quirks alignment has to be done on table cells. (#7324)\r
+ // In IE Quirks alignment has to be done on table cells. (http://dev.ckeditor.com/ticket/7324)\r
if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align ) {\r
styles.push( 'text-align:' + children[ i ].align );\r
}\r
html.push( 'height:100%;' );\r
html.push( 'width:' + cssLength( width || '100%' ), ';' );\r
\r
- // (#10123) Temp fix for dialog broken layout in latest webkit.\r
+ // (http://dev.ckeditor.com/ticket/10123) Temp fix for dialog broken layout in latest webkit.\r
if ( CKEDITOR.env.webkit )\r
html.push( 'float:none;' );\r
\r
styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' );\r
if ( elementDefinition && elementDefinition.padding !== undefined )\r
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );\r
- // In IE Quirks alignment has to be done on table cells. (#7324)\r
+ // In IE Quirks alignment has to be done on table cells. (http://dev.ckeditor.com/ticket/7324)\r
if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align )\r
styles.push( 'text-align:' + children[ i ].align );\r
if ( styles.length > 0 )\r
/**\r
* Generic dialog command. It opens a specific dialog when executed.\r
*\r
- * // Register the "link" command, which opens the "link" dialog.\r
+ * // Register the "link" command which opens the "link" dialog.\r
* editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );\r
*\r
* @class\r
* @param {String} dialogName The name of the dialog to open when executing\r
* this command.\r
* @param {Object} [ext] Additional command definition's properties.\r
+ * @param {String} [ext.tabId] You can provide additional property (`tabId`) if you wish to open the dialog on a specific tabId.\r
+ *\r
+ * // Open the dialog on the 'keystroke' tabId.\r
+ * editor.addCommand( 'keystroke', new CKEDITOR.dialogCommand( 'a11yHelp', { tabId: 'keystroke' } ) );\r
*/\r
CKEDITOR.dialogCommand = function( dialogName, ext ) {\r
this.dialogName = dialogName;\r
\r
CKEDITOR.dialogCommand.prototype = {\r
exec: function( editor ) {\r
- editor.openDialog( this.dialogName );\r
+ var tabId = this.tabId;\r
+ editor.openDialog( this.dialogName, function( dialog ) {\r
+ // Select different tab if it's provided (#830).\r
+ if ( tabId ) {\r
+ dialog.selectPage( tabId );\r
+ }\r
+ } );\r
},\r
\r
// Dialog commands just open a dialog ui, thus require no undo logic,\r