Skip to content
Permalink
Browse files

Merge branch 't/12204'

  • Loading branch information...
Reinmar committed Aug 13, 2014
2 parents f9c98f4 + 1e2ce1d commit 24b4fc5db8e0d910dffb8ae1c5ee2524adf89906
Showing with 54 additions and 32 deletions.
  1. +1 −0 CHANGES.md
  2. +12 −14 core/creators/themedui.js
  3. +19 −18 plugins/floatingspace/plugin.js
  4. +22 −0 tests/core/editor/title.js
@@ -23,6 +23,7 @@ Fixed Issues:
* [#12215](http://dev.ckeditor.com/ticket/12215): Fixed: Basepath resolution doesn't recognize semicolon as a query separator.
* [#12135](http://dev.ckeditor.com/ticket/12135): Fixed: Remove format does not work on widgets.
* [#12298](http://dev.ckeditor.com/ticket/12298): [IE11] Fixed: Clicking below body in Compatibility Mode will no longer reset selection to the first line.
* [#12204](http://dev.ckeditor.com/ticket/12204): Fixed: Editor's voice label is not affected by [`config.title`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-title).

Other Changes:

@@ -370,8 +370,6 @@ CKEDITOR.replaceClass = 'ckeditor';
}
}

var themedTpl;

function loadTheme( editor ) {
var name = editor.name,
element = editor.element,
@@ -381,29 +379,29 @@ CKEDITOR.replaceClass = 'ckeditor';
var topHtml = editor.fire( 'uiSpace', { space: 'top', html: '' } ).html;
var bottomHtml = editor.fire( 'uiSpace', { space: 'bottom', html: '' } ).html;

if ( !themedTpl ) {
themedTpl = CKEDITOR.addTemplate( 'maincontainer', '<{outerEl}' +
var themedTpl = new CKEDITOR.template(
'<{outerEl}' +
' id="cke_{name}"' +
' class="{id} cke cke_reset cke_chrome cke_editor_{name} cke_{langDir} ' + CKEDITOR.env.cssClass + '" ' +
' dir="{langDir}"' +
' lang="{langCode}"' +
' role="application"' +
' aria-labelledby="cke_{name}_arialbl">' +
'<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' +
'<{outerEl} class="cke_inner cke_reset" role="presentation">' +
'{topHtml}' +
'<{outerEl} id="{contentId}" class="cke_contents cke_reset" role="presentation"></{outerEl}>' +
'{bottomHtml}' +
'</{outerEl}>' +
'</{outerEl}>' );
}
( editor.title ? ' aria-labelledby="cke_{name}_arialbl"' : '' ) +
'>' +
( editor.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' : '' ) +
'<{outerEl} class="cke_inner cke_reset" role="presentation">' +
'{topHtml}' +
'<{outerEl} id="{contentId}" class="cke_contents cke_reset" role="presentation"></{outerEl}>' +
'{bottomHtml}' +
'</{outerEl}>' +
'</{outerEl}>' );

var container = CKEDITOR.dom.element.createFromHtml( themedTpl.output( {
id: editor.id,
name: name,
langDir: editor.lang.dir,
langCode: editor.langCode,
voiceLabel: [ editor.lang.editor, editor.name ].join( ', ' ),
voiceLabel: editor.title,
topHtml: topHtml ? '<span id="' + editor.ui.spaceId( 'top' ) + '" class="cke_top cke_reset_all" role="presentation" style="height:auto">' + topHtml + '</span>' : '',
contentId: editor.ui.spaceId( 'contents' ),
bottomHtml: bottomHtml ? '<span id="' + editor.ui.spaceId( 'bottom' ) + '" class="cke_bottom cke_reset_all" role="presentation">' + bottomHtml + '</span>' : '',
@@ -4,22 +4,7 @@
*/

( function() {
var floatSpaceTpl = CKEDITOR.addTemplate( 'floatcontainer', '<div' +
' id="cke_{name}"' +
' class="cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_float cke_{langDir} ' + CKEDITOR.env.cssClass + '"' +
' dir="{langDir}"' +
' title="' + ( CKEDITOR.env.gecko ? ' ' : '' ) + '"' +
' lang="{langCode}"' +
' role="application"' +
' style="{style}"' +
' aria-labelledby="cke_{name}_arialbl"' +
'>' +
'<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' +
'<div class="cke_inner">' +
'<div id="{topId}" class="cke_top" role="presentation">{content}</div>' +
'</div>' +
'</div>' ),
win = CKEDITOR.document.getWindow(),
var win = CKEDITOR.document.getWindow(),
pixelate = CKEDITOR.tools.cssLength;

CKEDITOR.plugins.add( 'floatingspace', {
@@ -278,15 +263,31 @@
} )();

if ( topHtml ) {
var floatSpace = CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( floatSpaceTpl.output( {
var floatSpaceTpl = new CKEDITOR.template(
'<div' +
' id="cke_{name}"' +
' class="cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_float cke_{langDir} ' + CKEDITOR.env.cssClass + '"' +
' dir="{langDir}"' +
' title="' + ( CKEDITOR.env.gecko ? ' ' : '' ) + '"' +
' lang="{langCode}"' +
' role="application"' +
' style="{style}"' +
( editor.title ? ' aria-labelledby="cke_{name}_arialbl"' : ' ' ) +
'>' +
( editor.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' : ' ' ) +
'<div class="cke_inner">' +
'<div id="{topId}" class="cke_top" role="presentation">{content}</div>' +
'</div>' +
'</div>' ),
floatSpace = CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( floatSpaceTpl.output( {
content: topHtml,
id: editor.id,
langDir: editor.lang.dir,
langCode: editor.langCode,
name: editor.name,
style: 'display:none;z-index:' + ( config.baseFloatZIndex - 1 ),
topId: editor.ui.spaceId( 'top' ),
voiceLabel: editor.lang.editorPanel + ', ' + editor.name
voiceLabel: editor.title
} ) ) ),

// Use event buffers to reduce CPU load when tons of events are fired.
@@ -1,4 +1,5 @@
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: wysiwygarea,floatingspace,toolbar */

( function() {
'use strict';
@@ -145,6 +146,10 @@
return editable.isInline() ? editable : editor.window.getFrame();
}

function getVoiceLabel( editor ) {
return CKEDITOR.document.getById( 'cke_' + editor.name + '_arialbl' );
}

function assertTitle( expected, editor, msg ) {
assert.areSame(
expected,
@@ -170,6 +175,17 @@
assert.isTrue( !!~element.getAttribute( 'title' ).indexOf( editor.title ), 'editor.title used as an attribute of editable of ' + editor.name );
}

function assertVoiceLabelIsBasedOnTitle( editor ) {
var element = getVoiceLabel( editor );

if ( !editor.title ) {
assert.isNull( element, 'editor: ' + editor.name );
} else {
assert.isNotNull( element, 'editor: ' + editor.name + ' - element' )
assert.areSame( editor.title, element.getText(), 'editor: ' + editor.name + ' - value' );
}
}

setUpEditors();

var tests = {
@@ -207,6 +223,12 @@
assertTitleSetOnEditable( editors[ i ] );
},

'test voice label have properly set title': function() {
for ( var i in editors ) {
assertVoiceLabelIsBasedOnTitle( editors[ i ] );
}
},

'test restore title after instance is destroyed': function() {
var tcs = {
existing1: 'foo',

0 comments on commit 24b4fc5

Please sign in to comment.
You can’t perform that action at this time.