Skip to content

Commit

Permalink
Merge branch 't/10015' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Sep 28, 2016
2 parents 570f5aa + 90c0db2 commit 320de94
Show file tree
Hide file tree
Showing 80 changed files with 1,491 additions and 154 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -6,6 +6,7 @@ CKEditor 4 Changelog
New Features:

* [#14569](http://dev.ckeditor.com/ticket/14569): Added new CKEditor skin.
* [#10015](http://dev.ckeditor.com/ticket/10015): Make keyboard controls more discoverable.
* [#12541](http://dev.ckeditor.com/ticket/12541): Added the [Upload File](http://ckeditor.com/addon/uploadfile) plugin.
* [#13794](http://dev.ckeditor.com/ticket/13794): [Upload Image](http://ckeditor.com/addon/uploadimage) Use `uploaded.width/height` if set.
* [#13829](http://dev.ckeditor.com/ticket/13829): Fixed: No class in [Widget](http://ckeditor.com/addon/widget) wrapper that would identify the widget type.
Expand Down
10 changes: 10 additions & 0 deletions core/commanddefinition.js
Expand Up @@ -146,3 +146,13 @@
* @since 4.0
* @property {Boolean} [readOnly=false]
*/

/**
* Property should be set when command has no keystroke assigned by {@link CKEDITOR.editor#setKeystroke}, but
* keystroke is still supported. For example: `cut`, `copy` and `paste` commands are handled that way.
* This property is used when displaying keystroke information in tooltips and context menus. It is used by
* {@link CKEDITOR.editor#getCommandKeystroke}.
*
* @since 4.6.0
* @property {Number} fakeKeystroke
*/
26 changes: 26 additions & 0 deletions core/editor.js
Expand Up @@ -1323,6 +1323,32 @@
}
},

/**
* Returns keystroke that is assigned to specified {@link CKEDITOR.command}. If there is no keystroke assigned - returns null.
*
* @since 4.6.0
* @param {CKEDITOR.command} command
* @returns {Number} Keystroke assigned to provided command or null if there is no keystroke.
*/
getCommandKeystroke: function( command ) {
var commandName = command.name,
keystrokes = this.keystrokeHandler.keystrokes,
key;

// Some commands have a fake keystroke - for example CUT/COPY/PASTE commands are handled natively.
if ( command.fakeKeystroke ) {
return command.fakeKeystroke;
}

for ( key in keystrokes ) {
if ( keystrokes.hasOwnProperty( key ) && keystrokes[ key ] == commandName ) {
return key;
}
}

return null;
},

/**
* Shorthand for {@link CKEDITOR.filter#addFeature}.
*
Expand Down
61 changes: 61 additions & 0 deletions core/tools.js
Expand Up @@ -1313,6 +1313,67 @@
return false;
},

/**
* Converts keystroke to its string representation. Returns object with two fields:
*
* * `display` - string that should be used for visible labels,
* for Mac devices uses `⌥` for `ALT`, `⇧` for `SHIFT` and `⌘` for `COMMAND`.
* * `aria` - string that should be used for ARIA descriptions,
* it is not using special characters like `⌥`, `⇧` or `⌘`.
*
* var lang = editor.lang.common.keyboard;
* var shortcut = CKEDITOR.tools.keystrokeToString( lang, CKEDITOR.CTRL + 88 );
* console.log( shortcut.display ); // 'CTRL + X', on Mac '⌘ + X'
* console.log( shortcut.aria ); // 'CTRL + X', on Mac 'COMMAND + X'
*
* @since 4.6.0
* @param {Object} lang Language object with key name translation.
* @param {Number} keystroke Keystroke to convert.
* @returns {{display: String, aria: String}}
*/
keystrokeToString: function( lang, keystroke ) {
var special = keystroke & 0xFF0000,
key = keystroke & 0x00FFFF,
isMac = CKEDITOR.env.mac,
CTRL = 17,
CMD = 224,
ALT = 18,
SHIFT = 16,
display = [],
aria = [];


if ( special & CKEDITOR.CTRL ) {
display.push( isMac ? '⌘' : lang[ CTRL ] );
aria.push( isMac ? lang[ CMD ] : lang[ CTRL ] );
}

if ( special & CKEDITOR.ALT ) {
display.push( isMac ? '⌥' : lang[ ALT ] );
aria.push( lang[ ALT ] );
}

if ( special & CKEDITOR.SHIFT ) {
display.push( isMac ? '⇧' : lang[ SHIFT ] );
aria.push( lang[ SHIFT ] );
}

if ( key ) {
if ( lang[ key ] ) {
display.push( lang[ key ] );
aria.push( lang[ key ] );
} else {
display.push( String.fromCharCode( key ) );
aria.push( String.fromCharCode( key ) );
}
}

return {
display: display.join( '+' ),
aria: aria.join( '+' )
};
},

/**
* The data URI of a transparent image. May be used e.g. in HTML as an image source or in CSS in `url()`.
*
Expand Down
21 changes: 19 additions & 2 deletions lang/af.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'af' ] = {
alignMiddle: 'Middel',
alignBottom: 'Onder',
alignNone: 'Geen',
invalidValue : 'Ongeldige waarde',
invalidValue: 'Ongeldige waarde',
invalidHeight: 'Hoogte moet \'n getal wees',
invalidWidth: 'Breedte moet \'n getal wees.',
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).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'af' ] = {
cssLengthTooltip: 'Voeg \'n getal wert in pixel in, of \'n waarde met geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, nie beskikbaar nie</span>'
unavailable: '%1<span class="cke_accessibility">, nie beskikbaar nie</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/ar.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'ar' ] = {
alignMiddle: 'وسط',
alignBottom: 'أسفل',
alignNone: 'None', // MISSING
invalidValue : 'قيمة غير مفبولة.',
invalidValue: 'قيمة غير مفبولة.',
invalidHeight: 'الارتفاع يجب أن يكون عدداً.',
invalidWidth: 'العرض يجب أن يكون عدداً.',
invalidCssLength: 'قيمة الخانة المخصصة لـ "%1" يجب أن تكون رقما موجبا، باستخدام أو من غير استخدام وحدة CSS قياس مقبولة (px, %, in, cm, mm, em, ex, pt, or pc).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'ar' ] = {
cssLengthTooltip: 'أدخل رقما للقيمة بالبكسل أو رقما بوحدة CSS مقبولة (px, %, in, cm, mm, em, ex, pt, or pc).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, غير متاح</span>'
unavailable: '%1<span class="cke_accessibility">, غير متاح</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/bg.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bg' ] = {
alignMiddle: 'По средата',
alignBottom: 'Долу',
alignNone: 'Без подравняване',
invalidValue : 'Невалидна стойност.',
invalidValue: 'Невалидна стойност.',
invalidHeight: 'Височината трябва да е число.',
invalidWidth: 'Ширина требе да е число.',
invalidCssLength: 'Стойността на полето "%1" трябва да бъде положително число с или без валидна CSS измервателна единица (px, %, in, cm, mm, em, ex, pt, или pc).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bg' ] = {
cssLengthTooltip: 'Въведете числена стойност в пиксели или друга валидна CSS единица (px, %, in, cm, mm, em, ex, pt, или pc).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, недостъпно</span>'
unavailable: '%1<span class="cke_accessibility">, недостъпно</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/bn.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bn' ] = {
alignMiddle: 'মধ্য',
alignBottom: 'নীচে',
alignNone: 'None', // MISSING
invalidValue : 'Invalid value.', // MISSING
invalidValue: 'Invalid value.', // MISSING
invalidHeight: 'Height must be a number.', // MISSING
invalidWidth: 'Width must be a number.', // MISSING
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
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bn' ] = {
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

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, unavailable</span>' // MISSING
unavailable: '%1<span class="cke_accessibility">, unavailable</span>', // MISSING

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/bs.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'bs' ] = {
alignMiddle: 'Sredina',
alignBottom: 'Dno',
alignNone: 'None', // MISSING
invalidValue : 'Invalid value.', // MISSING
invalidValue: 'Invalid value.', // MISSING
invalidHeight: 'Height must be a number.', // MISSING
invalidWidth: 'Width must be a number.', // MISSING
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
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'bs' ] = {
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

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, unavailable</span>' // MISSING
unavailable: '%1<span class="cke_accessibility">, unavailable</span>', // MISSING

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/ca.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'ca' ] = {
alignMiddle: 'Centre',
alignBottom: 'Inferior',
alignNone: 'None', // MISSING
invalidValue : 'Valor no vàlid.',
invalidValue: 'Valor no vàlid.',
invalidHeight: 'L\'alçada ha de ser un número.',
invalidWidth: 'L\'amplada ha de ser un número.',
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).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'ca' ] = {
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).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, no disponible</span>'
unavailable: '%1<span class="cke_accessibility">, no disponible</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/cs.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'cs' ] = {
alignMiddle: 'Na střed',
alignBottom: 'Dolů',
alignNone: 'Žádné',
invalidValue : 'Neplatná hodnota.',
invalidValue: 'Neplatná hodnota.',
invalidHeight: 'Zadaná výška musí být číslo.',
invalidWidth: 'Šířka musí být číslo.',
invalidCssLength: 'Hodnota určená pro pole "%1" musí být kladné číslo bez nebo s platnou jednotkou míry CSS (px, %, in, cm, mm, em, ex, pt, nebo pc).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'cs' ] = {
cssLengthTooltip: 'Zadejte číslo jako hodnotu v pixelech nebo číslo s platnou jednotkou CSS (px, %, v cm, mm, em, ex, pt, nebo pc).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, nedostupné</span>'
unavailable: '%1<span class="cke_accessibility">, nedostupné</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};
21 changes: 19 additions & 2 deletions lang/cy.js
Expand Up @@ -86,7 +86,7 @@ CKEDITOR.lang[ 'cy' ] = {
alignMiddle: 'Canol',
alignBottom: 'Gwaelod',
alignNone: 'None', // MISSING
invalidValue : 'Gwerth annilys.',
invalidValue: 'Gwerth annilys.',
invalidHeight: 'Mae\'n rhaid i\'r uchder fod yn rhif.',
invalidWidth: 'Mae\'n rhaid i\'r lled fod yn rhif.',
invalidCssLength: 'Mae\'n rhaid i\'r gwerth ar gyfer maes "%1" fod yn rhif positif gyda neu heb uned fesuriad CSS dilys (px, %, in, cm, mm, em, ex, pt, neu pc).',
Expand All @@ -95,6 +95,23 @@ CKEDITOR.lang[ 'cy' ] = {
cssLengthTooltip: 'Rhowch rif am werth mewn picsel neu rhif gydag uned CSS dilys (px, %, in, cm, mm, em, pt neu pc).',

// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, ddim ar gael</span>'
unavailable: '%1<span class="cke_accessibility">, ddim ar gael</span>',

// Keyboard keys translations used for creating shortcuts descriptions in tooltips, context menus and ARIA labels.
keyboard: {
8: 'Backspace', // MISSING
13: 'Enter', // MISSING
16: 'Shift', // MISSING
17: 'Ctrl', // MISSING
18: 'Alt', // MISSING
32: 'Space', // MISSING
35: 'End', // MISSING
36: 'Home', // MISSING
46: 'Delete', // MISSING
224: 'Command' // MISSING
},

// Prepended to ARIA labels with shortcuts.
keyboardShortcut: 'Keyboard shortcut' // MISSING
}
};

0 comments on commit 320de94

Please sign in to comment.