소스 검색

Removing image on abort and error if not already removed.

Szymon Kupś 8 년 전
부모
커밋
b139869ef6
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      packages/ckeditor5-upload/src/imageuploadengine.js

+ 8 - 0
packages/ckeditor5-upload/src/imageuploadengine.js

@@ -130,6 +130,14 @@ export default class ImageUploadEngine extends Plugin {
 					notification.showWarning( msg, { namespace: 'upload' } );
 				}
 
+				// Remove Image if not in graveyard already.
+				// Abort is called on image removal too so prevent from removing image twice.
+				if ( imageElement.root.rootName !== '$graveyard' ) {
+					doc.enqueueChanges( () => {
+						batch.remove( imageElement );
+					} );
+				}
+
 				clean();
 			} );