Skip to content

Commit

Permalink
Merge branch 't/10866' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Oct 24, 2013
2 parents e235ac9 + 33405d1 commit 29ae680
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -29,6 +29,7 @@ Fixed Issues:
* [#10879](http://dev.ckeditor.com/ticket/10879): Remove format should not leak from nested editable.
* [#10877](http://dev.ckeditor.com/ticket/10877): Fixed: WebSpellChecker fails to apply changes if nested editable was focused.
* [#10870](http://dev.ckeditor.com/ticket/10870): Fixed: `paste` command is not being disabled when clipboard is empty any more.
* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the Image2 dialog.

## CKEditor 4.3 Beta

Expand Down
8 changes: 4 additions & 4 deletions plugins/dialog/plugin.js
Expand Up @@ -2335,6 +2335,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
}
});

// Completes this object with everything we have in the
// definition.
CKEDITOR.tools.extend( this, elementDefinition );

// Register the object as a tab focus if it can be included.
if ( this.keyboardFocusable ) {
this.tabIndex = elementDefinition.tabIndex || 0;
Expand All @@ -2344,10 +2348,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
dialog._.currentFocusIndex = me.focusIndex;
});
}

// Completes this object with everything we have in the
// definition.
CKEDITOR.tools.extend( this, elementDefinition );
},

/**
Expand Down
124 changes: 76 additions & 48 deletions plugins/dialogui/plugin.js
Expand Up @@ -130,9 +130,19 @@ CKEDITOR.plugins.add( 'dialogui', {
var innerHTML = function() {
var html = [],
requiredClass = elementDefinition.required ? ' cke_required' : '';
if ( elementDefinition.labelLayout != 'horizontal' )
html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="' + _.labelId + '"', ( _.inputId ? ' for="' + _.inputId + '"' : '' ), ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>', elementDefinition.label, '</label>', '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">', contentHtml.call( this, dialog, elementDefinition ), '</div>' );
else {
if ( elementDefinition.labelLayout != 'horizontal' ) {
html.push(
'<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="' + _.labelId + '"',
( _.inputId ? ' for="' + _.inputId + '"' : '' ),
( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>',
elementDefinition.label,
'</label>',
'<div class="cke_dialog_ui_labeled_content"',
( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ),
' role="radiogroup" aria-labelledby="' + _.labelId + '">',
contentHtml.call( this, dialog, elementDefinition ),
'</div>' );
} else {
var hboxDefinition = {
type: 'hbox',
widths: elementDefinition.widths,
Expand Down Expand Up @@ -371,56 +381,76 @@ CKEDITOR.plugins.add( 'dialogui', {
return;

initPrivateObject.call( this, elementDefinition );

if ( !this._[ 'default' ] )
this._[ 'default' ] = this._.initValue = elementDefinition.items[ 0 ][ 1 ];

if ( elementDefinition.validate )
this.validate = elementDefinition.valdiate;

var children = [],
me = this;

var innerHTML = function() {
var inputHtmlList = [],
html = [],
commonAttributes = { 'class': 'cke_dialog_ui_radio_item', 'aria-labelledby': this._.labelId },
commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio';
for ( var i = 0; i < elementDefinition.items.length; i++ ) {
var item = elementDefinition.items[ i ],
title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ],
value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ],
inputId = CKEDITOR.tools.getNextId() + '_radio_input',
labelId = inputId + '_label',
inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
id: inputId,
title: null,
type: null
}, true ),
labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, {
title: title
}, true ),
inputAttributes = {
type: 'radio',
'class': 'cke_dialog_ui_radio_input',
name: commonName,
value: value,
'aria-labelledby': labelId
},
inputHtml = [];
if ( me._[ 'default' ] == value )
inputAttributes.checked = 'checked';
cleanInnerDefinition( inputDefinition );
cleanInnerDefinition( labelDefinition );

if ( typeof inputDefinition.inputStyle != 'undefined' )
inputDefinition.style = inputDefinition.inputStyle;

children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
inputHtml.push( ' ' );
new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id: labelId, 'for': inputAttributes.id }, item[ 0 ] );
inputHtmlList.push( inputHtml.join( '' ) );
}
new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html );
return html.join( '' );
};
var inputHtmlList = [],
html = [],
commonName = ( elementDefinition.id ? elementDefinition.id : CKEDITOR.tools.getNextId() ) + '_radio';

for ( var i = 0; i < elementDefinition.items.length; i++ ) {
var item = elementDefinition.items[ i ],
title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ],
value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ],
inputId = CKEDITOR.tools.getNextId() + '_radio_input',
labelId = inputId + '_label',

inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
id: inputId,
title: null,
type: null
}, true ),

labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, {
title: title
}, true ),

inputAttributes = {
type: 'radio',
'class': 'cke_dialog_ui_radio_input',
name: commonName,
value: value,
'aria-labelledby': labelId
},

inputHtml = [];

if ( me._[ 'default' ] == value )
inputAttributes.checked = 'checked';

cleanInnerDefinition( inputDefinition );
cleanInnerDefinition( labelDefinition );

if ( typeof inputDefinition.inputStyle != 'undefined' )
inputDefinition.style = inputDefinition.inputStyle;

// Make inputs of radio type focusable (#10866).
inputDefinition.keyboardFocusable = true;

children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );

inputHtml.push( ' ' );

new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, {
id: labelId,
'for': inputAttributes.id
}, item[ 0 ] );

inputHtmlList.push( inputHtml.join( '' ) );
}

new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html );

return html.join( '' );
};

CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
this._.children = children;
Expand Down Expand Up @@ -1158,9 +1188,7 @@ CKEDITOR.plugins.add( 'dialogui', {
}
return null;
}
},

keyboardFocusable: true
}
}, commonPrototype, true );

/** @class CKEDITOR.ui.dialog.file */
Expand Down

0 comments on commit 29ae680

Please sign in to comment.