浏览代码

Merge pull request #2171 from ellisonbg/file-upload-delete

Get upload/delete/upload to work.
Steven Silvester 8 年之前
父节点
当前提交
6ad6fd0e98
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      packages/filebrowser/src/buttons.ts

+ 10 - 0
packages/filebrowser/src/buttons.ts

@@ -122,6 +122,7 @@ class FileButtons extends Widget {
     this._buttons.upload.onclick = this._onUploadButtonClicked.bind(this);
     this._buttons.refresh.onclick = this._onRefreshButtonClicked.bind(this);
     this._input.onchange = this._onInputChanged.bind(this);
+    this._input.onclick = this._onInputClicked.bind(this);
 
     this.node.appendChild(this._buttons.create);
     this.node.appendChild(this._buttons.upload);
@@ -281,6 +282,15 @@ class FileButtons extends Widget {
     Private.uploadFiles(this, files as File[]);
   }
 
+  /**
+   * The 'click' handler for the input field.
+  */
+  private _onInputClicked(): void {
+    // In order to allow repeated uploads of the same file (with delete in between),
+    // we need to null out the input value to trigger a change event.
+    this._input.value = null;
+  }
+
   private _buttons = Private.createButtons();
   private _commands: CommandRegistry = null;
   private _input = Private.createUploadInput();