Commit 37d9c377 authored by yann300's avatar yann300

ensure alert has a title

parent 1c7507d3
......@@ -240,20 +240,21 @@ export class LandingPage extends ViewPlugin {
<div>e.g ${examples.map((url) => { return yo`<div class="p-1"><a>${url}</a></div>` })}</div>
</div>`
modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => {
const title = `Import from ${service}`
modalDialogCustom.prompt(title, msg, null, (target) => {
if (target !== '') {
compilerImport.import(
target,
(loadingMsg) => { tooltip(loadingMsg) },
(error, content, cleanUrl, type, url) => {
if (error) {
modalDialogCustom.alert(error.message || error)
modalDialogCustom.alert(title, error.message || error)
} else {
try {
fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url)
this.verticalIcons.select('fileExplorers')
} catch (e) {
modalDialogCustom.alert(e.message)
modalDialogCustom.alert(title, e.message)
}
}
}
......
......@@ -5,7 +5,7 @@ var css = require('./styles/modal-dialog-custom-styles')
module.exports = {
alert: function (title, text) {
if (text) return modal(title, yo`<div>${text}</div>`, null, { label: null })
return modal('', yo`<div>${title}</div>`, null, { label: null })
return modal('alert', yo`<div>${title}</div>`, null, { label: null })
},
prompt: function (title, text, inputValue, ok, cancel, focus) {
return prompt(title, text, false, inputValue, ok, cancel, focus)
......
......@@ -20,7 +20,7 @@ function GistHandler (_window) {
if (gistId) {
cb(gistId)
} else {
modalDialogCustom.alert('Error while loading gist. Please provide a valid Gist ID or URL.')
modalDialogCustom.alert('Gist load error', 'Error while loading gist. Please provide a valid Gist ID or URL.')
}
}
})
......@@ -49,7 +49,7 @@ function GistHandler (_window) {
json: true
}, async (error, response, data = {}) => {
if (error || !data.files) {
modalDialogCustom.alert(`Gist load error: ${error || data.message}`)
modalDialogCustom.alert('Gist load error', error || data.message)
return
}
const obj = {}
......@@ -61,7 +61,7 @@ function GistHandler (_window) {
const provider = fileManager.getProvider('workspace')
provider.lastLoadedGistId = gistId
} else {
modalDialogCustom.alert(errorLoadingFile.message || errorLoadingFile)
modalDialogCustom.alert('Gist load error', errorLoadingFile.message || errorLoadingFile)
}
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment