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

Prevent processing the same event data many times.

Krzysztof Krztoń 7 лет назад
Родитель
Сommit
79555ac0b8
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      packages/ckeditor5-paste-from-office/src/pastefromoffice.js

+ 4 - 1
packages/ckeditor5-paste-from-office/src/pastefromoffice.js

@@ -41,8 +41,11 @@ export default class PasteFromOffice extends Plugin {
 		this.listenTo( editor.plugins.get( Clipboard ), 'inputTransformation', ( evt, data ) => {
 		this.listenTo( editor.plugins.get( Clipboard ), 'inputTransformation', ( evt, data ) => {
 			const html = data.dataTransfer.getData( 'text/html' );
 			const html = data.dataTransfer.getData( 'text/html' );
 
 
-			if ( isWordInput( html ) ) {
+			if ( data.pasteFromOfficeProcessed !== true && isWordInput( html ) ) {
 				data.content = this._normalizeWordInput( html, data.dataTransfer );
 				data.content = this._normalizeWordInput( html, data.dataTransfer );
+
+				// Set the flag so if `inputTransformation` is re-fired, PFO will not process it again (#44).
+				data.pasteFromOfficeProcessed = true;
 			}
 			}
 		}, { priority: 'high' } );
 		}, { priority: 'high' } );
 	}
 	}