From c56ac92135732c9e8d67983fb2bb7be7ee934447 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 2 Apr 2020 19:37:10 +0200 Subject: [PATCH 1/3] better UI for gistID --- src/app/tabs/settings-tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index 3ae08fe46d..8b168bac45 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -69,11 +69,11 @@ module.exports = class SettingsTab extends ViewPlugin { // Gist settings const token = this.config.get('settings/gist-access-token') - const gistAccessToken = yo`` + const gistAccessToken = yo`` if (token) gistAccessToken.value = token const removeToken = () => { self.config.set('settings/gist-access-token', ''); gistAccessToken.value = ''; tooltip('Access token removed') } const saveToken = () => { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') } - const gistAddToken = yo` saveToken()} value="Save" type="button">` + const gistAddToken = yo` saveToken()} value="Save" type="button">` const gistRemoveToken = yo` removeToken()}" type="button">` this._view.gistToken = yo`
${gistAccessToken}${gistAddToken}${copyToClipboard(() => gistAccessToken.value)}${gistRemoveToken}
` this._view.optionVM = yo`` From b1aa0deb6fa04d4e55560b21685e06391c232818 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 3 Apr 2020 12:57:22 +0200 Subject: [PATCH 2/3] fixing Publish to gist --- src/app/files/file-explorer.js | 22 +++++++++++++--------- src/app/files/fileProvider.js | 4 ++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 96e7c3e51d..26ebc4d143 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -488,7 +488,7 @@ fileExplorer.prototype.toGist = function (id) { this.packageFiles(this.files, folder, (error, packaged) => { if (error) { console.log(error) - modalDialogCustom.alert('Failed to create gist: ' + error) + modalDialogCustom.alert('Failed to create gist: ' + error.message) } else { // check for token var tokenAccess = this._deps.config.get('settings/gist-access-token') @@ -550,19 +550,23 @@ fileExplorer.prototype.toGist = function (id) { // return all the files, except the temporary/readonly ones.. fileExplorer.prototype.packageFiles = function (filesProvider, directory, callback) { - var ret = {} + let ret = {} filesProvider.resolveDirectory(directory, (error, files) => { if (error) callback(error) else { async.eachSeries(Object.keys(files), (path, cb) => { - filesProvider.get(path, (error, content) => { - if (error) return cb(error) - if (/^\s+$/.test(content) || !content.length) { - content = '// this line is added to create a gist. Empty file is not allowed.' - } - ret[path] = { content } + if (filesProvider.isDirectory(path)) { cb() - }) + } else { + filesProvider.get(path, (error, content) => { + if (error) return cb(error) + if (/^\s+$/.test(content) || !content.length) { + content = '// this line is added to create a gist. Empty file is not allowed.' + } + ret[path] = { content } + cb() + }) + } }, (error) => { callback(error, ret) }) diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index ce1605c142..a1ae587f0c 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -133,6 +133,10 @@ class FileProvider { return false } + isDirectory(path) { + return window.remixFileSystem.statSync(path).isDirectory() + } + /** * Removes the folder recursively * @param {*} path is the folder to be removed From bbb29e8fe8fd2c85dadd9e3cf14f0d27de32dd83 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 3 Apr 2020 13:05:37 +0200 Subject: [PATCH 3/3] fixed the style of Upload File --- src/app/files/file-explorer.js | 9 +++++++-- src/app/files/fileProvider.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 26ebc4d143..db6f14515b 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -621,12 +621,17 @@ fileExplorer.prototype.renderMenuItems = function () { items = this.menuItems.map(({action, title, icon}) => { if (action === 'uploadFile') { return yo` - + ` } else { return yo` diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index a1ae587f0c..f5e03197e2 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -133,7 +133,7 @@ class FileProvider { return false } - isDirectory(path) { + isDirectory (path) { return window.remixFileSystem.statSync(path).isDirectory() }