pull/3094/head
LianaHus 5 years ago
parent 29d7fd349b
commit 26a652dc35
  1. 78
      src/app/files/fileManager.js
  2. 2
      src/app/ui/tooltip.js

@ -138,44 +138,46 @@ class FileManager extends FileSystemApi {
if (this.currentRequest) {
let reject = false
let saveAsCopy = false
let actions = (toaster) => { return yo`
<div class="container ml-1">
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
reject = false;
e.target.innerHTML = 'Accepted';
toaster.hide();
toaster.forceResolve()
}}>
Accept
</button>
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
reject = true;
e.target.innerHTML = 'Canceled';
toaster.hide()
}}>
Cancel
</button>
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
if (saveAsCopy) return
const fileProvider = this.fileProviderOf(path)
if (fileProvider) {
helper.createNonClashingNameWithPrefix(path, fileProvider, '', (error, copyName) => {
if (error) {
console.log('createNonClashingNameWithPrefix', error)
copyName = path + '.' + this.currentRequest.from
}
this._setFileInternal(copyName, content)
this.switchFile(copyName)
})
}
e.target.innerHTML = 'Saved'
saveAsCopy = true
toaster.hide()
}}>
Save As Copy
</button>
</div>
`}
let actions = (toaster) => {
return yo`
<div class="container ml-1">
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
reject = false
e.target.innerHTML = 'Accepted'
toaster.hide()
toaster.forceResolve()
}}>
Accept
</button>
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
reject = true
e.target.innerHTML = 'Canceled'
toaster.hide()
}}>
Cancel
</button>
<button class="btn btn-primary btn-sm m-1" onclick=${(e) => {
if (saveAsCopy) return
const fileProvider = this.fileProviderOf(path)
if (fileProvider) {
helper.createNonClashingNameWithPrefix(path, fileProvider, '', (error, copyName) => {
if (error) {
console.log('createNonClashingNameWithPrefix', error)
copyName = path + '.' + this.currentRequest.from
}
this._setFileInternal(copyName, content)
this.switchFile(copyName)
})
}
e.target.innerHTML = 'Saved'
saveAsCopy = true
toaster.hide()
}}>
Save As Copy
</button>
</div>
`
}
await toaster(yo`
<div>
<i class="fas fa-exclamation-triangle text-danger mr-1"></i>

@ -24,7 +24,7 @@ class Toaster {
animation(this.tooltip, css.animateTop.className)
}
forceResolve () {
forceResolve () {
if (this.id) clearTimeout(this.id)
if (this.resolveFn) this.resolveFn()
}

Loading…
Cancel
Save