8
0
Просмотр исходного кода

Lock buffer on input and delete.

Krzysztof Krztoń 9 лет назад
Родитель
Сommit
8d4ad4a8cd

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

@@ -61,6 +61,8 @@ export default class DeleteCommand extends Command {
 		const dataController = this.editor.data;
 
 		doc.enqueueChanges( () => {
+			this._buffer.lock();
+
 			const selection = Selection.createFromSelection( doc.selection );
 
 			// Try to extend the selection in the specified direction.
@@ -85,6 +87,8 @@ export default class DeleteCommand extends Command {
 			this._buffer.input( changeCount );
 
 			doc.selection.setRanges( selection.getRanges(), selection.isBackward );
+
+			this._buffer.unlock();
 		} );
 	}
 }

+ 4 - 0
packages/ckeditor5-typing/src/input.js

@@ -66,9 +66,13 @@ export default class Input extends Plugin {
 			return;
 		}
 
+		this._buffer.lock();
+
 		doc.enqueueChanges( () => {
 			this.editor.data.deleteContent( doc.selection, buffer.batch );
 		} );
+
+		this._buffer.unlock();
 	}
 
 	/**