Explorar o código

Fixed: LiveRange throwing after executing RenameOperation.

Szymon Cofalik %!s(int64=9) %!d(string=hai) anos
pai
achega
338196d879
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      packages/ckeditor5-engine/src/model/liveposition.js

+ 5 - 1
packages/ckeditor5-engine/src/model/liveposition.js

@@ -123,12 +123,16 @@ export default class LivePosition extends Position {
  */
 function bindWithDocument() {
 	/*jshint validthis: true */
+	// Operation types handled by LivePosition (these are operations that change model tree structure).
+	const supportedTypes = new Set( [ 'insert', 'move', 'remove', 'reinsert' ] );
 
 	this.listenTo(
 		this.root.document,
 		'change',
 		( event, type, changes ) => {
-			transform.call( this, type, changes.range, changes.sourcePosition );
+			if ( supportedTypes.has( type ) ) {
+				transform.call( this, type, changes.range, changes.sourcePosition );
+			}
 		}
 	);
 }