浏览代码

Merge pull request #66 from ckeditor/t/65

Aligned engine usage to its changes.
Szymon Kupś 9 年之前
父节点
当前提交
00e3705ca1

+ 4 - 3
packages/ckeditor5-typing/src/deletecommand.js

@@ -50,17 +50,18 @@ export default class DeleteCommand extends Command {
 	 * or a piece of content in the {@link typing.DeleteCommand#direction defined direction}.
 	 *
 	 * @param {Object} [options] The command options.
-	 * @param {'character'} [options.unit='character'] See {@link engine.model.composer.modifySelection}'s options.
+	 * @param {'character'} [options.unit='character'] See {@link engine.controller.modifySelection}'s options.
 	 */
 	_doExecute( options = {} ) {
 		const doc = this.editor.document;
+		const dataController = this.editor.data;
 
 		doc.enqueueChanges( () => {
 			const selection = Selection.createFromSelection( doc.selection );
 
 			// Try to extend the selection in the specified direction.
 			if ( selection.isCollapsed ) {
-				doc.composer.modifySelection( selection, { direction: this.direction, unit: options.unit } );
+				dataController.modifySelection( selection, { direction: this.direction, unit: options.unit } );
 			}
 
 			// If selection is still collapsed, then there's nothing to delete.
@@ -76,7 +77,7 @@ export default class DeleteCommand extends Command {
 				);
 			} );
 
-			doc.composer.deleteContents( this._buffer.batch, selection, { merge: true } );
+			dataController.deleteContent( selection, this._buffer.batch, { merge: true } );
 			this._buffer.input( changeCount );
 
 			doc.selection.setRanges( selection.getRanges(), selection.isBackward );

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

@@ -78,7 +78,7 @@ export default class Input extends Feature {
 		}
 
 		doc.enqueueChanges( () => {
-			doc.composer.deleteContents( this._buffer.batch, doc.selection );
+			this.editor.data.deleteContent( doc.selection, this._buffer.batch );
 		} );
 	}
 

+ 2 - 2
packages/ckeditor5-typing/tests/deletecommand.js

@@ -67,7 +67,7 @@ describe( 'DeleteCommand', () => {
 		it( 'does not try to delete when selection is at the boundary', () => {
 			const spy = sinon.spy();
 
-			doc.composer.on( 'deleteContents', spy );
+			editor.data.on( 'deleteContent', spy );
 			setData( doc, '<p>[]foo</p>' );
 
 			editor.execute( 'delete' );
@@ -79,7 +79,7 @@ describe( 'DeleteCommand', () => {
 		it( 'passes options to modifySelection', () => {
 			const spy = sinon.spy();
 
-			doc.composer.on( 'modifySelection', spy );
+			editor.data.on( 'modifySelection', spy );
 			setData( doc, '<p>foo[]bar</p>' );
 
 			editor.commands.get( 'delete' ).direction = 'forward';