Ver código fonte

Merge pull request #116 from ckeditor/t/ckeditor5-engine/1074

Internal: Aligned selection method names to the changes in the engine.
Piotr Jasiun 8 anos atrás
pai
commit
5d37322ff0

+ 1 - 1
packages/ckeditor5-typing/src/inputcommand.js

@@ -90,7 +90,7 @@ export default class InputCommand extends Command {
 				this.editor.data.model.selection.setRanges( [ resultRange ] );
 			} else if ( isCollapsedRange ) {
 				// If range was collapsed just shift the selection by the number of inserted characters.
-				this.editor.data.model.selection.collapse( range.start.getShiftedBy( textInsertions ) );
+				this.editor.data.model.selection.setCollapsedAt( range.start.getShiftedBy( textInsertions ) );
 			}
 
 			this._buffer.unlock();

+ 8 - 8
packages/ckeditor5-typing/tests/input.js

@@ -206,7 +206,7 @@ describe( 'Input feature', () => {
 			// This test case emulates spellchecker correction.
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 6 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 6 );
 
 			view.fire( 'mutations',
 				[ {
@@ -226,7 +226,7 @@ describe( 'Input feature', () => {
 			// This test case emulates spellchecker correction.
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 6 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 6 );
 
 			testUtils.sinon.spy( Batch.prototype, 'weakInsert' );
 			testUtils.sinon.spy( Batch.prototype, 'remove' );
@@ -250,7 +250,7 @@ describe( 'Input feature', () => {
 			editor.setData( '<p>Foo hous a</p>' );
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
 
 			view.fire( 'mutations',
 				[ {
@@ -271,7 +271,7 @@ describe( 'Input feature', () => {
 			editor.setData( '<p>Bar athat foo</p>' );
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 8 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 8 );
 
 			view.fire( 'mutations',
 				[ {
@@ -292,7 +292,7 @@ describe( 'Input feature', () => {
 			editor.setData( '<p>Foo hous e</p>' );
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
 
 			view.fire( 'mutations',
 				[ {
@@ -312,8 +312,8 @@ describe( 'Input feature', () => {
 			editor.setData( '<p>Foo house</p>' );
 
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( viewRoot.getChild( 0 ).getChild( 0 ), 8 );
-			viewSelection.setFocus( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
+			viewSelection.setCollapsedAt( viewRoot.getChild( 0 ).getChild( 0 ), 8 );
+			viewSelection.moveFocusTo( viewRoot.getChild( 0 ).getChild( 0 ), 9 );
 
 			view.fire( 'mutations',
 				[ {
@@ -930,7 +930,7 @@ describe( 'Input feature', () => {
 			const paragraph = viewRoot.getChild( 0 );
 			const strong = paragraph.getChild( 0 );
 			const viewSelection = new ViewSelection();
-			viewSelection.collapse( paragraph, 0 );
+			viewSelection.setCollapsedAt( paragraph, 0 );
 
 			// Simulate mutations and DOM change.
 			domRoot.childNodes[ 0 ].innerHTML = '<b>textx</b>';

+ 1 - 1
packages/ckeditor5-typing/tests/spellchecking.js

@@ -236,7 +236,7 @@ function emulateSpellcheckerMutation( editor, nodeIndex, resultPositionIndex, ol
 	const viewRoot = view.getRoot();
 	const viewSelection = new ViewSelection();
 
-	viewSelection.collapse( viewRoot.getChild( nodeIndex ).getChild( 0 ), resultPositionIndex );
+	viewSelection.setCollapsedAt( viewRoot.getChild( nodeIndex ).getChild( 0 ), resultPositionIndex );
 
 	view.fire( 'mutations',
 		[ {