Skip to content

Commit

Permalink
Fixed #413 - Merge pull request #404 from cksource/t/16980
Browse files Browse the repository at this point in the history
Adding Paste as Plain text keystroke to the help dialog.
  • Loading branch information
mlewand committed May 31, 2017
2 parents 906ecba + 3b46f2b commit 606ced7
Show file tree
Hide file tree
Showing 67 changed files with 374 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -3,6 +3,10 @@

## CKEditor 4.7.1

New Features:

* [#413](https://github.com/ckeditor/ckeditor-dev/issues/413): Added Paste as Plain Text hotkey in [Accessibility Help](http://ckeditor.com/addon/a11yhelp) instructions

## CKEditor 4.7

**Important Notes:**
Expand Down
3 changes: 3 additions & 0 deletions dev/langtool/meta/ckeditor.plugin-a11yhelp-dialogs/meta.txt
Expand Up @@ -35,6 +35,9 @@ legend.1.items.8.name = Label for the Access Next Focus Space Command section of
legend.1.items.8.legend = Keyboard shortcut instructions for the Access Next Focus Space command displayed in the Accessibility Instructions dialog window.
legend.1.items.9.name = Label for the Accessibility Help section of the Accessibility Instructions dialog window.
legend.1.items.9.legend = Keyboard shortcut instructions for the Accessibility Help command displayed in the Accessibility Instructions dialog window.
legend.1.items.10.name = Label for the Paste as Plain Text Command section of the Accessibility Instructions dialog window.
legend.1.items.10.legend = Keyboard shortcut instructions for the Paste as Plain Text command displayed in the Accessibility Instructions dialog window.
legend.1.items.10.legendEdge = Paste as Plain Text keyboard shortcut instructions displayed in the Accessibility Instructions dialog window, displayed for Microsoft Edge browser.
backspace = The label for the "Backspace" key.
tab = The label for the "Tab" key.
enter = The label for the "Enter" key.
Expand Down
28 changes: 11 additions & 17 deletions plugins/a11yhelp/dialogs/a11yhelp.js
Expand Up @@ -77,15 +77,14 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
// Modifier keys override.
keyMap[ CKEDITOR.ALT ] = coreLang[ 18 ];
keyMap[ CKEDITOR.SHIFT ] = coreLang[ 16 ];
keyMap[ CKEDITOR.CTRL ] = coreLang[ 17 ];
keyMap[ CKEDITOR.CTRL ] = CKEDITOR.env.mac ? coreLang[ 224 ] : coreLang[ 17 ];

// Sort in desc.
var modifiers = [ CKEDITOR.ALT, CKEDITOR.SHIFT, CKEDITOR.CTRL ];

function representKeyStroke( keystroke ) {
var quotient, modifier,
presentation = [];

for ( var i = 0; i < modifiers.length; i++ ) {
modifier = modifiers[ i ];
quotient = keystroke / modifiers[ i ];
Expand All @@ -100,23 +99,14 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {
return presentation.join( '+' );
}

var variablesPattern = /\$\{(.*?)\}/g;

var replaceVariables = ( function() {
// Swaps keystrokes with their commands in object literal.
// This makes searching keystrokes by command much easier.
var keystrokesByCode = editor.keystrokeHandler.keystrokes,
keystrokesByName = {};

for ( var i in keystrokesByCode )
keystrokesByName[ keystrokesByCode[ i ] ] = i;
var variablesPattern = /\$\{(.*?)\}/g,
replaceVariables = function( match, name ) {
var keystrokeCode = editor.getCommandKeystroke( name );

return function( match, name ) {
// Return the keystroke representation or leave match untouched
// if there's no keystroke for such command.
return keystrokesByName[ name ] ? representKeyStroke( keystrokesByName[ name ] ) : match;
return keystrokeCode ? representKeyStroke( keystrokeCode ) : match;
};
} )();

// Create the help list directly from lang file entries.
function buildHelpContents() {
Expand All @@ -137,13 +127,17 @@ CKEDITOR.dialog.add( 'a11yHelp', function( editor ) {

for ( var j = 0; j < itemsLength; j++ ) {
var item = items[ j ],
itemLegend = item.legend.replace( variablesPattern, replaceVariables );
// (#16980) There should be a different hotkey shown in Commands on Edge browser.
itemLegend = CKEDITOR.env.edge && item.legendEdge ? item.legendEdge : item.legend;

itemLegend = itemLegend.replace( variablesPattern, replaceVariables );

// (#9765) If some commands haven't been replaced in the legend,
// most likely their keystrokes are unavailable and we shouldn't include
// them in our help list.
if ( itemLegend.match( variablesPattern ) )
if ( itemLegend.match( variablesPattern ) ) {
continue;
}

sectionHtml.push( itemTpl.replace( '%1', item.name ).replace( '%2', itemLegend ) );
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/af.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'af', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/ar.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'ar', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/az.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'az', {
{
name: 'Hərtərəfli Kömək',
legend: '${a11yHelp} basın'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/bg.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'bg', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/ca.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'ca', {
{
name: 'Ajuda d\'accessibilitat',
legend: 'Premi ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/cs.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'cs', {
{
name: ' Nápověda přístupnosti',
legend: 'Stiskněte ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/cy.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'cy', {
{
name: 'Cymorth Hygyrchedd',
legend: 'Pwyswch ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/da.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'da', {
{
name: 'Tilgængelighedshjælp',
legend: 'Kilk ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/de-ch.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'de-ch', {
{
name: 'Eingabehilfen',
legend: 'Drücken Sie ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/de.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'de', {
{
name: 'Eingabehilfen',
legend: 'Drücken Sie ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/el.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'el', {
{
name: 'Βοήθεια Προσβασιμότητας',
legend: 'Πατήστε ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/en-gb.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'en-gb', {
{
name: ' Accessibility Help',
legend: 'Press ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/en.js
Expand Up @@ -98,6 +98,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'en', {
{
name: ' Accessibility Help',
legend: 'Press ${a11yHelp}'
},
{
name: ' Paste as plain text',
legend: 'Press ${pastetext}',
legendEdge: 'Press ${pastetext}, followed by ${paste}'
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/eo.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'eo', {
{
name: 'Helpilo pri atingeblo',
legend: 'Premu ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/es.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'es', {
{
name: 'Ayuda de Accesibilidad',
legend: 'Presiona ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/et.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'et', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/eu.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'eu', {
{
name: 'Erabilerraztasunaren laguntza',
legend: 'Sakatu ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/fa.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'fa', {
{
name: 'راهنمای دسترسی',
legend: 'فشردن ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/fi.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'fi', {
{
name: 'Saavutettavuus ohjeet',
legend: 'Paina ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/fo.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'fo', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/fr-ca.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'fr-ca', {
{
name: 'Aide d\'accessibilité',
legend: 'Appuyer sur ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/fr.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'fr', {
{
name: ' Aide sur l\'accessibilité',
legend: 'Appuyer sur ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/gl.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'gl', {
{
name: 'Axuda da accesibilidade',
legend: 'Prema ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/gu.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'gu', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/he.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'he', {
{
name: ' הוראות נגישות',
legend: 'לחץ ${a11yHelp}'
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/a11yhelp/dialogs/lang/hi.js
Expand Up @@ -79,6 +79,11 @@ CKEDITOR.plugins.setLang( 'a11yhelp', 'hi', {
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
},
{
name: ' Paste as plain text', // MISSING
legend: 'Press ${pastetext}', // MISSING
legendEdge: 'Press ${pastetext}, followed by ${paste}' // MISSING
}
]
}
Expand Down

0 comments on commit 606ced7

Please sign in to comment.