]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blobdiff - sources/plugins/a11yhelp/dialogs/a11yhelp.js
Update to 4.7.3
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / a11yhelp / dialogs / a11yhelp.js
index 73b930cc28ce8d65c7cb74f0c9fd7b082723cdb8..eb12d4c3f83126e8fd96a3cacfdba1902d9bc6ef 100644 (file)
@@ -77,7 +77,7 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
        // Modifier keys override.\r
        keyMap[ CKEDITOR.ALT ] = coreLang[ 18 ];\r
        keyMap[ CKEDITOR.SHIFT ] = coreLang[ 16 ];\r
-       keyMap[ CKEDITOR.CTRL ] = coreLang[ 17 ];\r
+       keyMap[ CKEDITOR.CTRL ] = CKEDITOR.env.mac ? coreLang[ 224 ] : coreLang[ 17 ];\r
 \r
        // Sort in desc.\r
        var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ];\r
@@ -85,7 +85,6 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
        function representKeyStroke( keystroke ) {\r
                var quotient, modifier,\r
                        presentation = [];\r
-\r
                for ( var i = 0; i < modifiers.length; i++ ) {\r
                        modifier = modifiers[ i ];\r
                        quotient = keystroke / modifiers[ i ];\r
@@ -100,23 +99,14 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
                return presentation.join( '+' );\r
        }\r
 \r
-       var variablesPattern = /\$\{(.*?)\}/g;\r
-\r
-       var replaceVariables = ( function() {\r
-               // Swaps keystrokes with their commands in object literal.\r
-               // This makes searching keystrokes by command much easier.\r
-               var keystrokesByCode = editor.keystrokeHandler.keystrokes,\r
-                       keystrokesByName = {};\r
-\r
-               for ( var i in keystrokesByCode )\r
-                       keystrokesByName[ keystrokesByCode[ i ] ] = i;\r
+       var variablesPattern = /\$\{(.*?)\}/g,\r
+               replaceVariables = function( match, name ) {\r
+                       var keystrokeCode = editor.getCommandKeystroke( name );\r
 \r
-               return function( match, name ) {\r
                        // Return the keystroke representation or leave match untouched\r
                        // if there's no keystroke for such command.\r
-                       return keystrokesByName[ name ] ? representKeyStroke( keystrokesByName[ name ] ) : match;\r
+                       return keystrokeCode ? representKeyStroke( keystrokeCode ) : match;\r
                };\r
-       } )();\r
 \r
        // Create the help list directly from lang file entries.\r
        function buildHelpContents() {\r
@@ -137,13 +127,17 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
 \r
                        for ( var j = 0; j < itemsLength; j++ ) {\r
                                var item = items[ j ],\r
-                                       itemLegend = item.legend.replace( variablesPattern, replaceVariables );\r
+                                       // (http://dev.ckeditor.com/ticket/16980) There should be a different hotkey shown in Commands on Edge browser.\r
+                                       itemLegend = CKEDITOR.env.edge && item.legendEdge ? item.legendEdge : item.legend;\r
 \r
-                               // (#9765) If some commands haven't been replaced in the legend,\r
+                               itemLegend = itemLegend.replace( variablesPattern, replaceVariables );\r
+\r
+                               // (http://dev.ckeditor.com/ticket/9765) If some commands haven't been replaced in the legend,\r
                                // most likely their keystrokes are unavailable and we shouldn't include\r
                                // them in our help list.\r
-                               if ( itemLegend.match( variablesPattern ) )\r
+                               if ( itemLegend.match( variablesPattern ) ) {\r
                                        continue;\r
+                               }\r
 \r
                                sectionHtml.push( itemTpl.replace( '%1', item.name ).replace( '%2', itemLegend ) );\r
                        }\r
@@ -179,7 +173,7 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
                                                        'overflow-y:auto;' +\r
                                                        'overflow-x:hidden;' +\r
                                                '}' +\r
-                                               // Some adjustments are to be done for Quirks to work "properly" (#5757)\r
+                                               // Some adjustments are to be done for Quirks to work "properly" (http://dev.ckeditor.com/ticket/5757)\r
                                                '.cke_browser_quirks .cke_accessibility_legend,' +\r
                                                '{' +\r
                                                        'height:390px' +\r