Преглед изворни кода

Lock buffer on input and delete.

Krzysztof Krztoń пре 9 година
родитељ
комит
8d4ad4a8cd
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 4 0
      packages/ckeditor5-typing/src/deletecommand.js
  2. 4 0
      packages/ckeditor5-typing/src/input.js

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

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