Skip to content

Commit 320de94

Browse files
committed
Merge branch 't/10015' into major
2 parents 570f5aa + 90c0db2 commit 320de94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1491
-154
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
66
New Features:
77

88
* [#14569](http://dev.ckeditor.com/ticket/14569): Added new CKEditor skin.
9+
* [#10015](http://dev.ckeditor.com/ticket/10015): Make keyboard controls more discoverable.
910
* [#12541](http://dev.ckeditor.com/ticket/12541): Added the [Upload File](http://ckeditor.com/addon/uploadfile) plugin.
1011
* [#13794](http://dev.ckeditor.com/ticket/13794): [Upload Image](http://ckeditor.com/addon/uploadimage) Use `uploaded.width/height` if set.
1112
* [#13829](http://dev.ckeditor.com/ticket/13829): Fixed: No class in [Widget](http://ckeditor.com/addon/widget) wrapper that would identify the widget type.

core/commanddefinition.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,13 @@
146146
* @since 4.0
147147
* @property {Boolean} [readOnly=false]
148148
*/
149+
150+
/**
151+
* Property should be set when command has no keystroke assigned by {@link CKEDITOR.editor#setKeystroke}, but
152+
* keystroke is still supported. For example: `cut`, `copy` and `paste` commands are handled that way.
153+
* This property is used when displaying keystroke information in tooltips and context menus. It is used by
154+
* {@link CKEDITOR.editor#getCommandKeystroke}.
155+
*
156+
* @since 4.6.0
157+
* @property {Number} fakeKeystroke
158+
*/

core/editor.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,32 @@
13231323
}
13241324
},
13251325

1326+
/**
1327+
* Returns keystroke that is assigned to specified {@link CKEDITOR.command}. If there is no keystroke assigned - returns null.
1328+
*
1329+
* @since 4.6.0
1330+
* @param {CKEDITOR.command} command
1331+
* @returns {Number} Keystroke assigned to provided command or null if there is no keystroke.
1332+
*/
1333+
getCommandKeystroke: function( command ) {
1334+
var commandName = command.name,
1335+
keystrokes = this.keystrokeHandler.keystrokes,
1336+
key;
1337+
1338+
// Some commands have a fake keystroke - for example CUT/COPY/PASTE commands are handled natively.
1339+
if ( command.fakeKeystroke ) {
1340+
return command.fakeKeystroke;
1341+
}
1342+
1343+
for ( key in keystrokes ) {
1344+
if ( keystrokes.hasOwnProperty( key ) && keystrokes[ key ] == commandName ) {
1345+
return key;
1346+
}
1347+
}
1348+
1349+
return null;
1350+
},
1351+
13261352
/**
13271353
* Shorthand for {@link CKEDITOR.filter#addFeature}.
13281354
*

core/tools.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,67 @@
13131313
return false;
13141314
},
13151315

1316+
/**
1317+
* Converts keystroke to its string representation. Returns object with two fields:
1318+
*
1319+
* * `display` - string that should be used for visible labels,
1320+
* for Mac devices uses `⌥` for `ALT`, `⇧` for `SHIFT` and `⌘` for `COMMAND`.
1321+
* * `aria` - string that should be used for ARIA descriptions,
1322+
* it is not using special characters like `⌥`, `⇧` or `⌘`.
1323+
*
1324+
* var lang = editor.lang.common.keyboard;
1325+
* var shortcut = CKEDITOR.tools.keystrokeToString( lang, CKEDITOR.CTRL + 88 );
1326+
* console.log( shortcut.display ); // 'CTRL + X', on Mac '⌘ + X'
1327+
* console.log( shortcut.aria ); // 'CTRL + X', on Mac 'COMMAND + X'
1328+
*
1329+
* @since 4.6.0
1330+
* @param {Object} lang Language object with key name translation.
1331+
* @param {Number} keystroke Keystroke to convert.
1332+
* @returns {{display: String, aria: String}}
1333+
*/
1334+
keystrokeToString: function( lang, keystroke ) {
1335+
var special = keystroke & 0xFF0000,
1336+
key = keystroke & 0x00FFFF,
1337+
isMac = CKEDITOR.env.mac,
1338+
CTRL = 17,
1339+
CMD = 224,
1340+
ALT = 18,
1341+
SHIFT = 16,
1342+
display = [],
1343+
aria = [];
1344+
1345+
1346+
if ( special & CKEDITOR.CTRL ) {
1347+
display.push( isMac ? '⌘' : lang[ CTRL ] );
1348+
aria.push( isMac ? lang[ CMD ] : lang[ CTRL ] );
1349+
}
1350+
1351+
if ( special & CKEDITOR.ALT ) {
1352+
display.push( isMac ? '⌥' : lang[ ALT ] );
1353+
aria.push( lang[ ALT ] );
1354+
}
1355+
1356+
if ( special & CKEDITOR.SHIFT ) {
1357+
display.push( isMac ? '⇧' : lang[ SHIFT ] );
1358+
aria.push( lang[ SHIFT ] );
1359+
}
1360+
1361+
if ( key ) {
1362+
if ( lang[ key ] ) {
1363+
display.push( lang[ key ] );
1364+
aria.push( lang[ key ] );
1365+
} else {
1366+
display.push( String.fromCharCode( key ) );
1367+
aria.push( String.fromCharCode( key ) );
1368+
}
1369+
}
1370+
1371+
return {
1372+
display: display.join( '+' ),
1373+
aria: aria.join( '+' )
1374+
};
1375+
},
1376+
13161377
/**
13171378
* The data URI of a transparent image. May be used e.g. in HTML as an image source or in CSS in `url()`.
13181379
*

lang/af.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'af' ] = {
8686
alignMiddle: 'Middel',
8787
alignBottom: 'Onder',
8888
alignNone: 'Geen',
89-
invalidValue : 'Ongeldige waarde',
89+
invalidValue: 'Ongeldige waarde',
9090
invalidHeight: 'Hoogte moet \'n getal wees',
9191
invalidWidth: 'Breedte moet \'n getal wees.',
9292
invalidCssLength: 'Die waarde vir die "%1" veld moet \'n posetiewe getal wees met of sonder \'n geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).',
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'af' ] = {
9595
cssLengthTooltip: 'Voeg \'n getal wert in pixel in, of \'n waarde met geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).',
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, nie beskikbaar nie</span>'
98+
unavailable: '%1<span class="cke_accessibility">, nie beskikbaar nie</span>',
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

lang/ar.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'ar' ] = {
8686
alignMiddle: 'وسط',
8787
alignBottom: 'أسفل',
8888
alignNone: 'None', // MISSING
89-
invalidValue : 'قيمة غير مفبولة.',
89+
invalidValue: 'قيمة غير مفبولة.',
9090
invalidHeight: 'الارتفاع يجب أن يكون عدداً.',
9191
invalidWidth: 'العرض يجب أن يكون عدداً.',
9292
invalidCssLength: 'قيمة الخانة المخصصة لـ "%1" يجب أن تكون رقما موجبا، باستخدام أو من غير استخدام وحدة CSS قياس مقبولة (px, %, in, cm, mm, em, ex, pt, or pc).',
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'ar' ] = {
9595
cssLengthTooltip: 'أدخل رقما للقيمة بالبكسل أو رقما بوحدة CSS مقبولة (px, %, in, cm, mm, em, ex, pt, or pc).',
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, غير متاح</span>'
98+
unavailable: '%1<span class="cke_accessibility">, غير متاح</span>',
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

lang/bg.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bg' ] = {
8686
alignMiddle: 'По средата',
8787
alignBottom: 'Долу',
8888
alignNone: 'Без подравняване',
89-
invalidValue : 'Невалидна стойност.',
89+
invalidValue: 'Невалидна стойност.',
9090
invalidHeight: 'Височината трябва да е число.',
9191
invalidWidth: 'Ширина требе да е число.',
9292
invalidCssLength: 'Стойността на полето "%1" трябва да бъде положително число с или без валидна CSS измервателна единица (px, %, in, cm, mm, em, ex, pt, или pc).',
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bg' ] = {
9595
cssLengthTooltip: 'Въведете числена стойност в пиксели или друга валидна CSS единица (px, %, in, cm, mm, em, ex, pt, или pc).',
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, недостъпно</span>'
98+
unavailable: '%1<span class="cke_accessibility">, недостъпно</span>',
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

lang/bn.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bn' ] = {
8686
alignMiddle: 'মধ্য',
8787
alignBottom: 'নীচে',
8888
alignNone: 'None', // MISSING
89-
invalidValue : 'Invalid value.', // MISSING
89+
invalidValue: 'Invalid value.', // MISSING
9090
invalidHeight: 'Height must be a number.', // MISSING
9191
invalidWidth: 'Width must be a number.', // MISSING
9292
invalidCssLength: 'Value specified for the "%1" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bn' ] = {
9595
cssLengthTooltip: 'Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, unavailable</span>' // MISSING
98+
unavailable: '%1<span class="cke_accessibility">, unavailable</span>', // MISSING
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

lang/bs.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bs' ] = {
8686
alignMiddle: 'Sredina',
8787
alignBottom: 'Dno',
8888
alignNone: 'None', // MISSING
89-
invalidValue : 'Invalid value.', // MISSING
89+
invalidValue: 'Invalid value.', // MISSING
9090
invalidHeight: 'Height must be a number.', // MISSING
9191
invalidWidth: 'Width must be a number.', // MISSING
9292
invalidCssLength: 'Value specified for the "%1" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bs' ] = {
9595
cssLengthTooltip: 'Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, unavailable</span>' // MISSING
98+
unavailable: '%1<span class="cke_accessibility">, unavailable</span>', // MISSING
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

lang/ca.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CKEDITOR.lang[ 'ca' ] = {
8686
alignMiddle: 'Centre',
8787
alignBottom: 'Inferior',
8888
alignNone: 'None', // MISSING
89-
invalidValue : 'Valor no vàlid.',
89+
invalidValue: 'Valor no vàlid.',
9090
invalidHeight: 'L\'alçada ha de ser un número.',
9191
invalidWidth: 'L\'amplada ha de ser un número.',
9292
invalidCssLength: 'El valor especificat per als "%1" camps ha de ser un número positiu amb o sense unitat de mesura vàlida de CSS (px, %, in, cm, mm, em, ex, pt o pc).',
@@ -95,6 +95,23 @@ CKEDITOR.lang[ 'ca' ] = {
9595
cssLengthTooltip: 'Introduïu un número per un valor en píxels o un número amb una unitat vàlida de CSS (px, %, in, cm, mm, em, ex, pt o pc).',
9696

9797
// Put the voice-only part of the label in the span.
98-
unavailable: '%1<span class="cke_accessibility">, no disponible</span>'
98+
unavailable: '%1<span class="cke_accessibility">, no disponible</span>',
99+
100+
// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
101+
keyboard: {
102+
8: 'Backspace', // MISSING
103+
13: 'Enter', // MISSING
104+
16: 'Shift', // MISSING
105+
17: 'Ctrl', // MISSING
106+
18: 'Alt', // MISSING
107+
32: 'Space', // MISSING
108+
35: 'End', // MISSING
109+
36: 'Home', // MISSING
110+
46: 'Delete', // MISSING
111+
224: 'Command' // MISSING
112+
},
113+
114+
// Prepended to ARIA labels with shortcuts.
115+
keyboardShortcut: 'Keyboard shortcut' // MISSING
99116
}
100117
};

0 commit comments

Comments
 (0)