Commit 37d9c377 authored by yann300's avatar yann300

ensure alert has a title

parent 1c7507d3
...@@ -240,20 +240,21 @@ export class LandingPage extends ViewPlugin { ...@@ -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>e.g ${examples.map((url) => { return yo`<div class="p-1"><a>${url}</a></div>` })}</div>
</div>` </div>`
modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { const title = `Import from ${service}`
modalDialogCustom.prompt(title, msg, null, (target) => {
if (target !== '') { if (target !== '') {
compilerImport.import( compilerImport.import(
target, target,
(loadingMsg) => { tooltip(loadingMsg) }, (loadingMsg) => { tooltip(loadingMsg) },
(error, content, cleanUrl, type, url) => { (error, content, cleanUrl, type, url) => {
if (error) { if (error) {
modalDialogCustom.alert(error.message || error) modalDialogCustom.alert(title, error.message || error)
} else { } else {
try { try {
fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url)
this.verticalIcons.select('fileExplorers') this.verticalIcons.select('fileExplorers')
} catch (e) { } catch (e) {
modalDialogCustom.alert(e.message) modalDialogCustom.alert(title, e.message)
} }
} }
} }
......
...@@ -5,7 +5,7 @@ var css = require('./styles/modal-dialog-custom-styles') ...@@ -5,7 +5,7 @@ var css = require('./styles/modal-dialog-custom-styles')
module.exports = { module.exports = {
alert: function (title, text) { alert: function (title, text) {
if (text) return modal(title, yo`<div>${text}</div>`, null, { label: null }) 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) { prompt: function (title, text, inputValue, ok, cancel, focus) {
return prompt(title, text, false, inputValue, ok, cancel, focus) return prompt(title, text, false, inputValue, ok, cancel, focus)
......
...@@ -20,7 +20,7 @@ function GistHandler (_window) { ...@@ -20,7 +20,7 @@ function GistHandler (_window) {
if (gistId) { if (gistId) {
cb(gistId) cb(gistId)
} else { } 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) { ...@@ -49,7 +49,7 @@ function GistHandler (_window) {
json: true json: true
}, async (error, response, data = {}) => { }, async (error, response, data = {}) => {
if (error || !data.files) { if (error || !data.files) {
modalDialogCustom.alert(`Gist load error: ${error || data.message}`) modalDialogCustom.alert('Gist load error', error || data.message)
return return
} }
const obj = {} const obj = {}
...@@ -61,7 +61,7 @@ function GistHandler (_window) { ...@@ -61,7 +61,7 @@ function GistHandler (_window) {
const provider = fileManager.getProvider('workspace') const provider = fileManager.getProvider('workspace')
provider.lastLoadedGistId = gistId provider.lastLoadedGistId = gistId
} else { } 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