浏览代码

Aligned code with engine changes.

Oskar Wróbel 8 年之前
父节点
当前提交
851598b970

+ 5 - 5
packages/ckeditor5-typing/src/changebuffer.js

@@ -35,14 +35,14 @@ export default class ChangeBuffer {
 	 * @param {module:engine/model/document~Document} document
 	 * @param {Number} [limit=20] The maximum number of atomic changes which can be contained in one batch.
 	 */
-	constructor( doc, limit = 20 ) {
+	constructor( document, limit = 20 ) {
 		/**
 		 * The document instance.
 		 *
 		 * @readonly
 		 * @member {module:engine/model/document~Document} #document
 		 */
-		this.document = doc;
+		this.document = document;
 
 		/**
 		 * The number of atomic changes in the buffer. Once it exceeds the {@link #limit},
@@ -77,11 +77,11 @@ export default class ChangeBuffer {
 			this._reset();
 		};
 
-		doc.on( 'change', this._changeCallback );
+		document.on( 'change', this._changeCallback );
 
-		doc.selection.on( 'change:range', this._selectionChangeCallback );
+		document.selection.on( 'change:range', this._selectionChangeCallback );
 
-		doc.selection.on( 'change:attribute', this._selectionChangeCallback );
+		document.selection.on( 'change:attribute', this._selectionChangeCallback );
 
 		/**
 		 * The current batch instance.

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

@@ -47,7 +47,7 @@ export default class DeleteCommand extends Command {
 		 * @private
 		 * @member {typing.ChangeBuffer} #buffer
 		 */
-		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'typing.undoStep' ) );
+		this._buffer = new ChangeBuffer( editor.model.document, editor.config.get( 'typing.undoStep' ) );
 	}
 
 	/**

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

@@ -69,7 +69,7 @@ export default class Input extends Plugin {
 	 */
 	_handleKeydown( evtData, inputCommand ) {
 		const model = this.editor.model;
-		const doc = this.model.document;
+		const doc = model.document;
 		const buffer = inputCommand.buffer;
 
 		// By relying on the state of the input command we allow disabling the entire input easily

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

@@ -70,7 +70,7 @@ export default class InputCommand extends Command {
 	 */
 	execute( options = {} ) {
 		const model = this.editor.model;
-		const doc = this.model.document;
+		const doc = model.document;
 		const text = options.text || '';
 		const textInsertions = text.length;
 		const range = options.range || doc.selection.getFirstRange();
@@ -90,10 +90,10 @@ export default class InputCommand extends Command {
 			}
 
 			if ( resultRange ) {
-				this.editor.data.model.selection.setRanges( [ resultRange ] );
+				doc.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.setCollapsedAt( range.start.getShiftedBy( textInsertions ) );
+				doc.selection.setCollapsedAt( range.start.getShiftedBy( textInsertions ) );
 			}
 
 			this._buffer.unlock();