8
0
Эх сурвалжийг харах

Enabled keystroke information in navigation buttons of the RestrictedEditingUI plugin.

Aleksander Nowodzinski 6 жил өмнө
parent
commit
e4ee7ba6e4

+ 13 - 3
packages/ckeditor5-restricted-editing/src/restrictededitingui.js

@@ -40,8 +40,16 @@ export default class RestrictedEditingUI extends Plugin {
 			const dropdownView = createDropdown( locale );
 			const listItems = new Collection();
 
-			listItems.add( this._getButtonDefinition( 'goToPreviousRestrictedEditingRegion', t( 'Previous editable region' ) ) );
-			listItems.add( this._getButtonDefinition( 'goToNextRestrictedEditingRegion', t( 'Next editable region' ) ) );
+			listItems.add( this._getButtonDefinition(
+				'goToPreviousRestrictedEditingRegion',
+				t( 'Previous editable region' ),
+				'Shift+Tab'
+			) );
+			listItems.add( this._getButtonDefinition(
+				'goToNextRestrictedEditingRegion',
+				t( 'Next editable region' ),
+				'Tab'
+			) );
 
 			addListToDropdown( dropdownView, listItems );
 
@@ -70,7 +78,7 @@ export default class RestrictedEditingUI extends Plugin {
 	 * @param {String} label Translated label of the button.
 	 * @returns {module:ui/dropdown/utils~ListDropdownItemDefinition}
 	 */
-	_getButtonDefinition( commandName, label ) {
+	_getButtonDefinition( commandName, label, kestroke ) {
 		const editor = this.editor;
 		const command = editor.commands.get( commandName );
 		const definition = {
@@ -78,6 +86,8 @@ export default class RestrictedEditingUI extends Plugin {
 			model: new Model( {
 				label,
 				withText: true,
+				keystroke: kestroke,
+				withKeystroke: true,
 				_commandName: commandName
 			} )
 		};

+ 4 - 0
packages/ckeditor5-restricted-editing/tests/restrictededitingui.js

@@ -73,7 +73,9 @@ describe( 'RestrictedEditingUI', () => {
 
 				expect( button.isOn ).to.be.false;
 				expect( button.withText ).to.be.true;
+				expect( button.withKeystroke ).to.be.true;
 				expect( button.label ).to.equal( 'Previous editable region' );
+				expect( button.keystroke ).to.equal( 'Shift+Tab' );
 			} );
 
 			it( 'should have one that goes forward', () => {
@@ -82,7 +84,9 @@ describe( 'RestrictedEditingUI', () => {
 
 				expect( button.isOn ).to.be.false;
 				expect( button.withText ).to.be.true;
+				expect( button.withKeystroke ).to.be.true;
 				expect( button.label ).to.equal( 'Next editable region' );
+				expect( button.keystroke ).to.equal( 'Tab' );
 			} );
 
 			it( 'should focus the view after executing the command', () => {