Skip to content

Commit c2315ee

Browse files
committed
Issues-336: clear input file
1 parent 7f1ad74 commit c2315ee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

js/topcodereditor.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,27 @@
129129
return CodeMirror.Pass;
130130
}
131131

132+
function clearInputFile(editor){
133+
var imageInput = editor.gui.toolbar.getElementsByClassName('imageInput')[0];
134+
imageInput.value ='';
135+
}
136+
132137
function customUploadImage(file, onSuccess, onError) {
133138
var self = this;
134139
var position = {};
135140

136141
onSuccess = function onSuccess(jsonData) {
137142
updateMediaIDs(self, jsonData);
138143
afterFileUploaded(self, jsonData, position);
144+
clearInputFile(self);
139145
};
140146

141147
onError = function onError(errorMessage) {
142-
showErrorMessage(self,errorMessage)
148+
showErrorMessage(self,errorMessage);
143149
if(position && position.start && position.end) {
144150
self.codemirror.replaceRange("", position.start, position.end);
145151
}
152+
clearInputFile(self);
146153
}
147154

148155
function onErrorSup(errorMessage) {

0 commit comments

Comments
 (0)