Browse Source

Add early return for text attribute change in automatic element refreshing.

Maciej Gołaszewski 5 years ago
parent
commit
7e50748516
1 changed files with 6 additions and 2 deletions
  1. 6 2
      packages/ckeditor5-engine/src/conversion/downcastdispatcher.js

+ 6 - 2
packages/ckeditor5-engine/src/conversion/downcastdispatcher.js

@@ -599,11 +599,15 @@ export default class DowncastDispatcher {
 			.filter( ( { type } ) => type === 'attribute' || type === 'insert' || type === 'remove' )
 			.map( entry => {
 				const element = getElementFromChange( entry );
-
 				let eventName;
 
 				if ( entry.type === 'attribute' ) {
-					eventName = `attribute:${ entry.attributeKey }:${ element && element.name }`;
+					if ( !element ) {
+						// Refreshing is done only on elements so skip text attribute changes.
+						return;
+					}
+
+					eventName = `attribute:${ entry.attributeKey }:${ element.name }`;
 				} else {
 					eventName = `${ entry.type }:${ entry.name }`;
 				}