X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fpiedsjaloux-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fplugins%2Fbutton%2Fplugin.js;fp=sources%2Fplugins%2Fbutton%2Fplugin.js;h=e91fa86cbd5568f7f2643d963a933f1623ffca7d;hp=0ce75c64ff138a1befceef6dee76eac7c5f872d2;hb=317f8f8f0651488f226b5280a8f036c7c135c639;hpb=1096cdefb1c9a3f3c4ca6807e272da6c92e5ed9c
diff --git a/sources/plugins/button/plugin.js b/sources/plugins/button/plugin.js
index 0ce75c6..e91fa86 100644
--- a/sources/plugins/button/plugin.js
+++ b/sources/plugins/button/plugin.js
@@ -1,5 +1,5 @@
/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
@@ -12,6 +12,7 @@
' hidefocus="true"' +
' role="button"' +
' aria-labelledby="{id}_label"' +
+ ' aria-describedby="{id}_description"' +
' aria-haspopup="{hasArrow}"' +
' aria-disabled="{ariaDisabled}"';
@@ -28,13 +29,14 @@
template += ' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event);"' +
' onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' +
- ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188
+ ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // http://dev.ckeditor.com/ticket/188
'="CKEDITOR.tools.callFunction({clickFn},this);return false;">' +
' ' +
'{label}' +
+ '{ariaShortcut}' +
'{arrowHtml}' +
'';
@@ -47,7 +49,7 @@
btnTpl = CKEDITOR.addTemplate( 'button', template );
CKEDITOR.plugins.add( 'button', {
- lang: 'af,ar,bg,ca,cs,da,de,de-ch,el,en,en-gb,eo,es,eu,fa,fi,fr,gl,he,hu,id,it,ja,km,ko,ku,lt,nb,nl,pl,pt,pt-br,ro,ru,sk,sl,sq,sv,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
+ lang: 'af,ar,az,bg,ca,cs,da,de,de-ch,el,en,en-gb,eo,es,es-mx,eu,fa,fi,fr,gl,he,hr,hu,id,it,ja,km,ko,ku,lt,nb,nl,no,oc,pl,pt,pt-br,ro,ru,sk,sl,sq,sv,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
beforeInit: function( editor ) {
editor.ui.addHandler( CKEDITOR.UI_BUTTON, CKEDITOR.ui.button.handler );
}
@@ -138,7 +140,9 @@
stateName = '',
command = this.command,
// Get the command name.
- clickFn;
+ clickFn,
+ keystroke,
+ shortcut;
this._.editor = editor;
@@ -185,7 +189,7 @@
}
instance.execute();
- // Fixed iOS focus issue when your press disabled button (#12381).
+ // Fixed iOS focus issue when your press disabled button (http://dev.ckeditor.com/ticket/12381).
if ( env.iOS ) {
editor.focus();
}
@@ -239,13 +243,20 @@
}, this );
}
- if ( !command )
+ if ( !command ) {
stateName += 'off';
+ } else {
+ keystroke = editor.getCommandKeystroke( command );
+
+ if ( keystroke ) {
+ shortcut = CKEDITOR.tools.keystrokeToString( editor.lang.common.keyboard, keystroke );
+ }
+ }
var name = this.name || this.command,
iconName = name;
- // Check if we're pointing to an icon defined by another command. (#9555)
+ // Check if we're pointing to an icon defined by another command. (http://dev.ckeditor.com/ticket/9555)
if ( this.icon && !( /\./ ).test( this.icon ) ) {
iconName = this.icon;
this.icon = null;
@@ -259,7 +270,8 @@
cls: this.className || '',
state: stateName,
ariaDisabled: stateName == 'disabled' ? 'true' : 'false',
- title: this.title,
+ title: this.title + ( shortcut ? ' (' + shortcut.display + ')' : '' ),
+ ariaShortcut: shortcut ? editor.lang.common.keyboardShortcut + ' ' + shortcut.aria : '',
titleJs: env.gecko && !env.hc ? '' : ( this.title || '' ).replace( "'", '' ),
hasArrow: this.hasArrow ? 'true' : 'false',
keydownFn: keydownFn,
@@ -299,7 +311,7 @@
element.removeAttribute( 'aria-disabled' );
if ( !this.hasArrow ) {
- // Note: aria-pressed attribute should not be added to menuButton instances. (#11331)
+ // Note: aria-pressed attribute should not be added to menuButton instances. (http://dev.ckeditor.com/ticket/11331)
state == CKEDITOR.TRISTATE_ON ?
element.setAttribute( 'aria-pressed', true ) :
element.removeAttribute( 'aria-pressed' );