diff options
Diffstat (limited to 'sources/plugins/a11yhelp/dialogs/a11yhelp.js')
-rw-r--r-- | sources/plugins/a11yhelp/dialogs/a11yhelp.js | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/sources/plugins/a11yhelp/dialogs/a11yhelp.js b/sources/plugins/a11yhelp/dialogs/a11yhelp.js index 73b930c..eb12d4c 100644 --- a/sources/plugins/a11yhelp/dialogs/a11yhelp.js +++ b/sources/plugins/a11yhelp/dialogs/a11yhelp.js | |||
@@ -77,7 +77,7 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { | |||
77 | // Modifier keys override. | 77 | // Modifier keys override. |
78 | keyMap[ CKEDITOR.ALT ] = coreLang[ 18 ]; | 78 | keyMap[ CKEDITOR.ALT ] = coreLang[ 18 ]; |
79 | keyMap[ CKEDITOR.SHIFT ] = coreLang[ 16 ]; | 79 | keyMap[ CKEDITOR.SHIFT ] = coreLang[ 16 ]; |
80 | keyMap[ CKEDITOR.CTRL ] = coreLang[ 17 ]; | 80 | keyMap[ CKEDITOR.CTRL ] = CKEDITOR.env.mac ? coreLang[ 224 ] : coreLang[ 17 ]; |
81 | 81 | ||
82 | // Sort in desc. | 82 | // Sort in desc. |
83 | var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ]; | 83 | var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ]; |
@@ -85,7 +85,6 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { | |||
85 | function representKeyStroke( keystroke ) { | 85 | function representKeyStroke( keystroke ) { |
86 | var quotient, modifier, | 86 | var quotient, modifier, |
87 | presentation = []; | 87 | presentation = []; |
88 | |||
89 | for ( var i = 0; i < modifiers.length; i++ ) { | 88 | for ( var i = 0; i < modifiers.length; i++ ) { |
90 | modifier = modifiers[ i ]; | 89 | modifier = modifiers[ i ]; |
91 | quotient = keystroke / modifiers[ i ]; | 90 | quotient = keystroke / modifiers[ i ]; |
@@ -100,23 +99,14 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { | |||
100 | return presentation.join( '+' ); | 99 | return presentation.join( '+' ); |
101 | } | 100 | } |
102 | 101 | ||
103 | var variablesPattern = /\$\{(.*?)\}/g; | 102 | var variablesPattern = /\$\{(.*?)\}/g, |
104 | 103 | replaceVariables = function( match, name ) { | |
105 | var replaceVariables = ( function() { | 104 | var keystrokeCode = editor.getCommandKeystroke( name ); |
106 | // Swaps keystrokes with their commands in object literal. | ||
107 | // This makes searching keystrokes by command much easier. | ||
108 | var keystrokesByCode = editor.keystrokeHandler.keystrokes, | ||
109 | keystrokesByName = {}; | ||
110 | |||
111 | for ( var i in keystrokesByCode ) | ||
112 | keystrokesByName[ keystrokesByCode[ i ] ] = i; | ||
113 | 105 | ||
114 | return function( match, name ) { | ||
115 | // Return the keystroke representation or leave match untouched | 106 | // Return the keystroke representation or leave match untouched |
116 | // if there's no keystroke for such command. | 107 | // if there's no keystroke for such command. |
117 | return keystrokesByName[ name ] ? representKeyStroke( keystrokesByName[ name ] ) : match; | 108 | return keystrokeCode ? representKeyStroke( keystrokeCode ) : match; |
118 | }; | 109 | }; |
119 | } )(); | ||
120 | 110 | ||
121 | // Create the help list directly from lang file entries. | 111 | // Create the help list directly from lang file entries. |
122 | function buildHelpContents() { | 112 | function buildHelpContents() { |
@@ -137,13 +127,17 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { | |||
137 | 127 | ||
138 | for ( var j = 0; j < itemsLength; j++ ) { | 128 | for ( var j = 0; j < itemsLength; j++ ) { |
139 | var item = items[ j ], | 129 | var item = items[ j ], |
140 | itemLegend = item.legend.replace( variablesPattern, replaceVariables ); | 130 | // (http://dev.ckeditor.com/ticket/16980) There should be a different hotkey shown in Commands on Edge browser. |
131 | itemLegend = CKEDITOR.env.edge && item.legendEdge ? item.legendEdge : item.legend; | ||
141 | 132 | ||
142 | // (#9765) If some commands haven't been replaced in the legend, | 133 | itemLegend = itemLegend.replace( variablesPattern, replaceVariables ); |
134 | |||
135 | // (http://dev.ckeditor.com/ticket/9765) If some commands haven't been replaced in the legend, | ||
143 | // most likely their keystrokes are unavailable and we shouldn't include | 136 | // most likely their keystrokes are unavailable and we shouldn't include |
144 | // them in our help list. | 137 | // them in our help list. |
145 | if ( itemLegend.match( variablesPattern ) ) | 138 | if ( itemLegend.match( variablesPattern ) ) { |
146 | continue; | 139 | continue; |
140 | } | ||
147 | 141 | ||
148 | sectionHtml.push( itemTpl.replace( '%1', item.name ).replace( '%2', itemLegend ) ); | 142 | sectionHtml.push( itemTpl.replace( '%1', item.name ).replace( '%2', itemLegend ) ); |
149 | } | 143 | } |
@@ -179,7 +173,7 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) { | |||
179 | 'overflow-y:auto;' + | 173 | 'overflow-y:auto;' + |
180 | 'overflow-x:hidden;' + | 174 | 'overflow-x:hidden;' + |
181 | '}' + | 175 | '}' + |
182 | // Some adjustments are to be done for Quirks to work "properly" (#5757) | 176 | // Some adjustments are to be done for Quirks to work "properly" (http://dev.ckeditor.com/ticket/5757) |
183 | '.cke_browser_quirks .cke_accessibility_legend,' + | 177 | '.cke_browser_quirks .cke_accessibility_legend,' + |
184 | '{' + | 178 | '{' + |
185 | 'height:390px' + | 179 | 'height:390px' + |