From 9bc06c2ab72af65a4028b890f2a00d74469bdd37 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 19 Nov 2020 10:02:31 +0100 Subject: [PATCH 1/2] emit fileSaved and fileAdded --- apps/remix-ide/src/app/files/fileManager.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 455c6624c2..c08ab0f267 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -158,7 +158,9 @@ class FileManager extends Plugin { await this._handleIsFile(path, `Cannot write file ${path}`) return await this.setFileContent(path, data) } else { - return await this.setFileContent(path, data) + const ret = this.setFileContent(path, data) + this.emit('fileAdded', path) + return ret } } @@ -396,6 +398,7 @@ class FileManager extends Plugin { provider.set(path, content, (error) => { if (error) reject(error) this.syncEditor(path) + this.emit('fileSaved', path) resolve(true) }) }) @@ -528,6 +531,7 @@ class FileManager extends Plugin { var provider = this.fileProviderOf(currentFile) if (provider) { provider.set(currentFile, input) + this.emit('fileSaved', currentFile) } else { console.log('cannot save ' + currentFile + '. Does not belong to any explorer') } From 5b2dc6c167684f3e9489fc20dd21e90042032e79 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 23 Nov 2020 13:38:25 +0100 Subject: [PATCH 2/2] add missing await --- apps/remix-ide/src/app/files/fileManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index c08ab0f267..985ff3ad81 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -158,7 +158,7 @@ class FileManager extends Plugin { await this._handleIsFile(path, `Cannot write file ${path}`) return await this.setFileContent(path, data) } else { - const ret = this.setFileContent(path, data) + const ret = await this.setFileContent(path, data) this.emit('fileAdded', path) return ret }