]> git.immae.eu Git - perso/Immae/Projets/packagist/piedsjaloux-ckeditor-component.git/blobdiff - sources/plugins/button/plugin.js
Add oembed
[perso/Immae/Projets/packagist/piedsjaloux-ckeditor-component.git] / sources / plugins / button / plugin.js
index 0ce75c64ff138a1befceef6dee76eac7c5f872d2..e91fa86cbd5568f7f2643d963a933f1623ffca7d 100644 (file)
@@ -1,5 +1,5 @@
 /**\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
@@ -12,6 +12,7 @@
                ' hidefocus="true"' +\r
                ' role="button"' +\r
                ' aria-labelledby="{id}_label"' +\r
+               ' aria-describedby="{id}_description"' +\r
                ' aria-haspopup="{hasArrow}"' +\r
                ' aria-disabled="{ariaDisabled}"';\r
 \r
 \r
        template += ' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event);"' +\r
                ' onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' +\r
-               ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188\r
+               ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // http://dev.ckeditor.com/ticket/188\r
                        '="CKEDITOR.tools.callFunction({clickFn},this);return false;">' +\r
                '<span class="cke_button_icon cke_button__{iconName}_icon" style="{style}"';\r
 \r
 \r
        template += '>&nbsp;</span>' +\r
                '<span id="{id}_label" class="cke_button_label cke_button__{name}_label" aria-hidden="false">{label}</span>' +\r
+               '<span id="{id}_description" class="cke_button_label" aria-hidden="false">{ariaShortcut}</span>' +\r
                '{arrowHtml}' +\r
                '</a>';\r
 \r
@@ -47,7 +49,7 @@
                btnTpl = CKEDITOR.addTemplate( 'button', template );\r
 \r
        CKEDITOR.plugins.add( 'button', {\r
-               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%\r
+               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%\r
                beforeInit: function( editor ) {\r
                        editor.ui.addHandler( CKEDITOR.UI_BUTTON, CKEDITOR.ui.button.handler );\r
                }\r
                                stateName = '',\r
                                command = this.command,\r
                                // Get the command name.\r
-                               clickFn;\r
+                               clickFn,\r
+                               keystroke,\r
+                               shortcut;\r
 \r
                        this._.editor = editor;\r
 \r
                                }\r
                                instance.execute();\r
 \r
-                               // Fixed iOS focus issue when your press disabled button (#12381).\r
+                               // Fixed iOS focus issue when your press disabled button (http://dev.ckeditor.com/ticket/12381).\r
                                if ( env.iOS ) {\r
                                        editor.focus();\r
                                }\r
                                }, this );\r
                        }\r
 \r
-                       if ( !command )\r
+                       if ( !command ) {\r
                                stateName += 'off';\r
+                       } else {\r
+                               keystroke = editor.getCommandKeystroke( command );\r
+\r
+                               if ( keystroke ) {\r
+                                       shortcut = CKEDITOR.tools.keystrokeToString( editor.lang.common.keyboard, keystroke );\r
+                               }\r
+                       }\r
 \r
                        var name = this.name || this.command,\r
                                iconName = name;\r
 \r
-                       // Check if we're pointing to an icon defined by another command. (#9555)\r
+                       // Check if we're pointing to an icon defined by another command. (http://dev.ckeditor.com/ticket/9555)\r
                        if ( this.icon && !( /\./ ).test( this.icon ) ) {\r
                                iconName = this.icon;\r
                                this.icon = null;\r
                                cls: this.className || '',\r
                                state: stateName,\r
                                ariaDisabled: stateName == 'disabled' ? 'true' : 'false',\r
-                               title: this.title,\r
+                               title: this.title + ( shortcut ? ' (' + shortcut.display + ')' : '' ),\r
+                               ariaShortcut: shortcut ? editor.lang.common.keyboardShortcut + ' ' + shortcut.aria : '',\r
                                titleJs: env.gecko && !env.hc ? '' : ( this.title || '' ).replace( "'", '' ),\r
                                hasArrow: this.hasArrow ? 'true' : 'false',\r
                                keydownFn: keydownFn,\r
                                        element.removeAttribute( 'aria-disabled' );\r
 \r
                                if ( !this.hasArrow ) {\r
-                                       // Note: aria-pressed attribute should not be added to menuButton instances. (#11331)\r
+                                       // Note: aria-pressed attribute should not be added to menuButton instances. (http://dev.ckeditor.com/ticket/11331)\r
                                        state == CKEDITOR.TRISTATE_ON ?\r
                                                element.setAttribute( 'aria-pressed', true ) :\r
                                                element.removeAttribute( 'aria-pressed' );\r