Selaa lähdekoodia

Changed: In `view.Renderer` moved logging warn about selection render skip to `_domSelectionNeedsUpdate`.

Szymon Cofalik 8 vuotta sitten
vanhempi
commit
53170244d4
1 muutettua tiedostoa jossa 13 lisäystä ja 14 poistoa
  1. 13 14
      packages/ckeditor5-engine/src/view/renderer.js

+ 13 - 14
packages/ckeditor5-engine/src/view/renderer.js

@@ -604,16 +604,6 @@ export default class Renderer {
 
 		// Let's check whether DOM selection needs updating at all.
 		if ( !this._domSelectionNeedsUpdate( domSelection ) ) {
-			const data = {
-				oldSelection: this.domConverter.domSelectionToView( domSelection ),
-				currentSelection: this.selection
-			};
-
-			log.warn(
-				'renderer-skipped-selection-rendering: The selection was not rendered due to its similarity to the current one.',
-				data
-			);
-
 			return;
 		}
 
@@ -642,15 +632,24 @@ export default class Renderer {
 			return true;
 		}
 
-		const viewSelectionFromDom = this.domConverter.domSelectionToView( domSelection );
+		const oldViewSelection = domSelection && this.domConverter.domSelectionToView( domSelection );
 
-		// If selection is collapsed, it does not need to be updated only if selection from view is equal.
-		if ( this.selection.isCollapsed && this.selection.isEqual( viewSelectionFromDom ) ) {
+		if ( oldViewSelection && this.selection.isEqual( oldViewSelection ) ) {
 			return false;
 		}
 
 		// If selection is not collapsed, it does not need to be updated if it is similar.
-		if ( !this.selection.isCollapsed && this.selection.isSimilar( viewSelectionFromDom ) ) {
+		if ( !this.selection.isCollapsed && this.selection.isSimilar( oldViewSelection ) ) {
+			const data = {
+				oldSelection: oldViewSelection,
+				currentSelection: this.selection
+			};
+
+			log.warn(
+				'renderer-skipped-selection-rendering: The selection was not rendered due to its similarity to the current one.',
+				data
+			);
+
 			// Selection did not changed and is correct, do not update.
 			return false;
 		}