From 9d1adbf077765d0eeebfea2b453808540eeb7f8c Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 21 May 2019 11:30:06 +0200 Subject: [PATCH] fix toaster --- src/app/files/fileManager.js | 11 ++++++----- src/app/ui/tooltip.js | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 9031a418d9..41da3187bb 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -135,9 +135,9 @@ class FileManager extends FileSystemApi { if (this.currentRequest) { let reject = false let savedAsAnotherFile = false - let warnToaster - const actions = yo`
- + let actions = (toaster) => { + return yo`
+
` - warnToaster = await toaster(yo`
${this.currentRequest.from} is modyfing ${path}
`, actions, { time: 4000 }) + } + await toaster(yo`
${this.currentRequest.from} is modyfing ${path}
`, actions, { time: 4000 }) if (reject) throw new Error(`set file operation on ${path} aborted by user.`) if (savedAsAnotherFile) return } diff --git a/src/app/ui/tooltip.js b/src/app/ui/tooltip.js index 4632193c8f..8c44f905e8 100644 --- a/src/app/ui/tooltip.js +++ b/src/app/ui/tooltip.js @@ -5,11 +5,11 @@ var modal = require('./modal-dialog-custom') /** * Open a tooltip * @param {string} tooltipText The text shown by the tooltip - * @param {HTMLElement} [action] An HTMLElement to display for action + * @param {function} [action] Returns An HTMLElement to display for action */ module.exports = function addTooltip (tooltipText, action, opts) { let t = new Toaster() - return t.render(tooltipText, action, opts) + return t.render(tooltipText, action(t), opts) } class Toaster {