浏览代码

Rename navigation commands to goTo[Previous|Next]RestrictedEditingRegion.

Maciej Gołaszewski 6 年之前
父节点
当前提交
d61d4a2438

+ 6 - 6
packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js

@@ -21,7 +21,7 @@ import { getMarkerAtPosition, isSelectionInMarker } from './restrictededitingmod
  * The Restricted Editing Mode editing feature.
  *
  * * It introduces the exception marker group that renders to `<spans>` with the `ck-restricted-editing-exception` CSS class.
- * * It registers the `'goToPreviousRestrictedEditingRegion'` and `'goToNextRestrictedEditingRegion'` commands.
+ * * It registers the `'goToPreviousRestrictedEditingException'` and `'goToNextRestrictedEditingException'` commands.
  * * Also enables highlighting exception markers that are selected.
  *
  * @extends module:core/plugin~Plugin
@@ -50,7 +50,7 @@ export default class RestrictedEditingModeEditing extends Plugin {
 		 * @type {Set.<String>}
 		 * @private
 		 */
-		this._alwaysEnabled = new Set( [ 'undo', 'redo', 'goToPreviousRestrictedEditingRegion', 'goToNextRestrictedEditingRegion' ] );
+		this._alwaysEnabled = new Set( [ 'undo', 'redo', 'goToPreviousRestrictedEditingException', 'goToNextRestrictedEditingException' ] );
 
 		/**
 		 * Commands allowed in non-restricted areas.
@@ -78,10 +78,10 @@ export default class RestrictedEditingModeEditing extends Plugin {
 		this._setupCommandsToggling();
 
 		// Commands & keystrokes that allow navigation in the content.
-		editor.commands.add( 'goToPreviousRestrictedEditingRegion', new RestrictedEditingNavigationCommand( editor, 'backward' ) );
-		editor.commands.add( 'goToNextRestrictedEditingRegion', new RestrictedEditingNavigationCommand( editor, 'forward' ) );
-		editor.keystrokes.set( 'Tab', getCommandExecuter( editor, 'goToNextRestrictedEditingRegion' ) );
-		editor.keystrokes.set( 'Shift+Tab', getCommandExecuter( editor, 'goToPreviousRestrictedEditingRegion' ) );
+		editor.commands.add( 'goToPreviousRestrictedEditingException', new RestrictedEditingNavigationCommand( editor, 'backward' ) );
+		editor.commands.add( 'goToNextRestrictedEditingException', new RestrictedEditingNavigationCommand( editor, 'forward' ) );
+		editor.keystrokes.set( 'Tab', getCommandExecuter( editor, 'goToNextRestrictedEditingException' ) );
+		editor.keystrokes.set( 'Shift+Tab', getCommandExecuter( editor, 'goToPreviousRestrictedEditingException' ) );
 
 		// Block clipboard completely in restricted mode.
 		this.listenTo( this.editor.editing.view.document, 'clipboardInput', evt => {

+ 2 - 2
packages/ckeditor5-restricted-editing/src/restrictededitingmodeui.js

@@ -41,12 +41,12 @@ export default class RestrictedEditingModeUI extends Plugin {
 			const listItems = new Collection();
 
 			listItems.add( this._getButtonDefinition(
-				'goToPreviousRestrictedEditingRegion',
+				'goToPreviousRestrictedEditingException',
 				t( 'Previous editable region' ),
 				'Shift+Tab'
 			) );
 			listItems.add( this._getButtonDefinition(
-				'goToNextRestrictedEditingRegion',
+				'goToNextRestrictedEditingException',
 				t( 'Next editable region' ),
 				'Tab'
 			) );

+ 8 - 6
packages/ckeditor5-restricted-editing/tests/restrictededitingmodeediting.js

@@ -40,13 +40,15 @@ describe( 'RestrictedEditingModeEditing', () => {
 			expect( editor.plugins.get( RestrictedEditingModeEditing ) ).to.be.instanceOf( RestrictedEditingModeEditing );
 		} );
 
-		it( 'adds a "goToPreviousRestrictedEditingRegion" command', () => {
-			expect( editor.commands.get( 'goToPreviousRestrictedEditingRegion' ) )
+		it( 'adds a "goToPreviousRestrictedEditingException" command', () => {
+			expect( editor.commands.get( 'goToPreviousRestrictedEditingException' ) )
 				.to.be.instanceOf( RestrictedEditingModeNavigationCommand );
 		} );
 
-		it( 'adds a "goToNextRestrictedEditingRegion" command', () => {
-			expect( editor.commands.get( 'goToNextRestrictedEditingRegion' ) ).to.be.instanceOf( RestrictedEditingModeNavigationCommand );
+		it( 'adds a "goToNextRestrictedEditingException" command', () => {
+			expect(
+				editor.commands.get( 'goToNextRestrictedEditingException' )
+			).to.be.instanceOf( RestrictedEditingModeNavigationCommand );
 		} );
 	} );
 
@@ -791,7 +793,7 @@ describe( 'RestrictedEditingModeEditing', () => {
 			view.document.fire( 'keydown', domEvtDataStub );
 
 			sinon.assert.calledOnce( editor.execute );
-			sinon.assert.calledWithExactly( editor.execute, 'goToNextRestrictedEditingRegion' );
+			sinon.assert.calledWithExactly( editor.execute, 'goToNextRestrictedEditingException' );
 			sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 			sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 		} );
@@ -844,7 +846,7 @@ describe( 'RestrictedEditingModeEditing', () => {
 			view.document.fire( 'keydown', domEvtDataStub );
 
 			sinon.assert.calledOnce( editor.execute );
-			sinon.assert.calledWithExactly( editor.execute, 'goToPreviousRestrictedEditingRegion' );
+			sinon.assert.calledWithExactly( editor.execute, 'goToPreviousRestrictedEditingException' );
 			sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 			sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 		} );

+ 4 - 4
packages/ckeditor5-restricted-editing/tests/restrictededitingmodeui.js

@@ -25,8 +25,8 @@ describe( 'RestrictedEditingModeUI', () => {
 			plugins: [ RestrictedEditingModeEditing, RestrictedEditingModeUI ]
 		} );
 
-		goToPreviousCommand = editor.commands.get( 'goToPreviousRestrictedEditingRegion' );
-		goToNextCommand = editor.commands.get( 'goToNextRestrictedEditingRegion' );
+		goToPreviousCommand = editor.commands.get( 'goToPreviousRestrictedEditingException' );
+		goToNextCommand = editor.commands.get( 'goToNextRestrictedEditingException' );
 	} );
 
 	afterEach( async () => {
@@ -120,10 +120,10 @@ describe( 'RestrictedEditingModeUI', () => {
 				const spy = sinon.spy( editor, 'execute' );
 
 				goToPreviousButton.fire( 'execute' );
-				sinon.assert.calledWith( spy.firstCall, 'goToPreviousRestrictedEditingRegion' );
+				sinon.assert.calledWith( spy.firstCall, 'goToPreviousRestrictedEditingException' );
 
 				goToNextButton.fire( 'execute' );
-				sinon.assert.calledWith( spy.secondCall, 'goToNextRestrictedEditingRegion' );
+				sinon.assert.calledWith( spy.secondCall, 'goToNextRestrictedEditingException' );
 			} );
 		} );
 	} );