Explorar el Código

Aligned code to the API changes in engine.

Maciej Bukowski hace 8 años
padre
commit
7536bbd67f

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

@@ -63,7 +63,6 @@ export default class DeleteCommand extends Command {
 	execute( options = {} ) {
 	execute( options = {} ) {
 		const model = this.editor.model;
 		const model = this.editor.model;
 		const doc = model.document;
 		const doc = model.document;
-		const dataController = this.editor.data;
 
 
 		model.enqueueChange( this._buffer.batch, writer => {
 		model.enqueueChange( this._buffer.batch, writer => {
 			this._buffer.lock();
 			this._buffer.lock();
@@ -79,7 +78,7 @@ export default class DeleteCommand extends Command {
 
 
 			// Try to extend the selection in the specified direction.
 			// Try to extend the selection in the specified direction.
 			if ( selection.isCollapsed ) {
 			if ( selection.isCollapsed ) {
-				dataController.modifySelection( selection, { direction: this.direction, unit: options.unit } );
+				model.modifySelection( selection, { direction: this.direction, unit: options.unit } );
 			}
 			}
 
 
 			// Check if deleting in an empty editor. See #61.
 			// Check if deleting in an empty editor. See #61.
@@ -102,7 +101,7 @@ export default class DeleteCommand extends Command {
 				);
 				);
 			} );
 			} );
 
 
-			dataController.deleteContent( selection, { doNotResetEntireContent } );
+			model.deleteContent( selection, { doNotResetEntireContent } );
 			this._buffer.input( changeCount );
 			this._buffer.input( changeCount );
 
 
 			doc.selection.setRanges( selection.getRanges(), selection.isBackward );
 			doc.selection.setRanges( selection.getRanges(), selection.isBackward );

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

@@ -88,7 +88,7 @@ export default class Input extends Plugin {
 		buffer.lock();
 		buffer.lock();
 
 
 		model.enqueueChange( buffer.batch, () => {
 		model.enqueueChange( buffer.batch, () => {
-			this.editor.data.deleteContent( doc.selection );
+			this.editor.model.deleteContent( doc.selection );
 		} );
 		} );
 
 
 		buffer.unlock();
 		buffer.unlock();

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

@@ -94,7 +94,7 @@ describe( 'DeleteCommand', () => {
 		it( 'does not try to delete when selection is at the boundary', () => {
 		it( 'does not try to delete when selection is at the boundary', () => {
 			const spy = sinon.spy();
 			const spy = sinon.spy();
 
 
-			editor.data.on( 'deleteContent', spy );
+			editor.model.on( 'deleteContent', spy );
 			setData( model, '<paragraph>[]foo</paragraph>' );
 			setData( model, '<paragraph>[]foo</paragraph>' );
 
 
 			editor.execute( 'delete' );
 			editor.execute( 'delete' );
@@ -106,7 +106,7 @@ describe( 'DeleteCommand', () => {
 		it( 'passes options to modifySelection', () => {
 		it( 'passes options to modifySelection', () => {
 			const spy = sinon.spy();
 			const spy = sinon.spy();
 
 
-			editor.data.on( 'modifySelection', spy );
+			editor.model.on( 'modifySelection', spy );
 			setData( model, '<paragraph>foo[]bar</paragraph>' );
 			setData( model, '<paragraph>foo[]bar</paragraph>' );
 
 
 			editor.commands.get( 'delete' ).direction = 'forward';
 			editor.commands.get( 'delete' ).direction = 'forward';
@@ -123,7 +123,7 @@ describe( 'DeleteCommand', () => {
 		it( 'passes options to deleteContent #1', () => {
 		it( 'passes options to deleteContent #1', () => {
 			const spy = sinon.spy();
 			const spy = sinon.spy();
 
 
-			editor.data.on( 'deleteContent', spy );
+			editor.model.on( 'deleteContent', spy );
 			setData( model, '<paragraph>foo[]bar</paragraph>' );
 			setData( model, '<paragraph>foo[]bar</paragraph>' );
 
 
 			editor.execute( 'delete' );
 			editor.execute( 'delete' );
@@ -137,7 +137,7 @@ describe( 'DeleteCommand', () => {
 		it( 'passes options to deleteContent #2', () => {
 		it( 'passes options to deleteContent #2', () => {
 			const spy = sinon.spy();
 			const spy = sinon.spy();
 
 
-			editor.data.on( 'deleteContent', spy );
+			editor.model.on( 'deleteContent', spy );
 			setData( model, '<paragraph>[foobar]</paragraph>' );
 			setData( model, '<paragraph>[foobar]</paragraph>' );
 
 
 			editor.execute( 'delete' );
 			editor.execute( 'delete' );