From b17430f2a8b831d5b06ebd265a9a975ee85f30b3 Mon Sep 17 00:00:00 2001 From: Maksim Makarevich Date: Wed, 27 Sep 2017 13:00:23 +0200 Subject: [PATCH] Fix: Uploading should be aborded if editor is already destroyed --- plugins/uploadwidget/plugin.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/uploadwidget/plugin.js b/plugins/uploadwidget/plugin.js index 19f343677f7..4434cf66c25 100644 --- a/plugins/uploadwidget/plugin.js +++ b/plugins/uploadwidget/plugin.js @@ -251,8 +251,9 @@ loader.on( 'update', function( evt ) { // Abort if widget was removed. - if ( !widget.wrapper || !widget.wrapper.getParent() ) { - if ( !editor.editable().find( '[data-cke-upload-id="' + id + '"]' ).count() ) { + if (!widget.wrapper || !widget.wrapper.getParent()) { + //Uploading should be aborded if editor is already destroyed + if (!CKEDITOR.instances[editor.name] || !editor.editable().find( '[data-cke-upload-id="' + id + '"]' ).count() ) { loader.abort(); } evt.removeListener(); @@ -496,7 +497,10 @@ loader.on( 'abort', function() { task && task.cancel(); - editor.showNotification( editor.lang.uploadwidget.abort, 'info' ); + //Uploading should be aborded if editor is already destroyed + if (CKEDITOR.instances[editor.name]) { + editor.showNotification(editor.lang.uploadwidget.abort, 'info'); + } } ); function createAggregator() {