mirror of https://github.com/status-im/codimd.git
Merge pull request #1419 from hackmdio/bugfix/fix-graphviz-error-render
fix: catch viz.js render async error and recreate Viz instance
This commit is contained in:
commit
90898e700f
|
@ -31,7 +31,7 @@ require('prismjs/components/prism-gherkin')
|
||||||
|
|
||||||
require('./lib/common/login')
|
require('./lib/common/login')
|
||||||
require('../vendor/md-toc')
|
require('../vendor/md-toc')
|
||||||
const viz = new window.Viz()
|
let viz = new window.Viz()
|
||||||
const plantumlEncoder = require('plantuml-encoder')
|
const plantumlEncoder = require('plantuml-encoder')
|
||||||
|
|
||||||
const ui = getUIElements()
|
const ui = getUIElements()
|
||||||
|
@ -379,8 +379,13 @@ export function finishView (view) {
|
||||||
$ele.addClass('graphviz')
|
$ele.addClass('graphviz')
|
||||||
$value.children().unwrap()
|
$value.children().unwrap()
|
||||||
})
|
})
|
||||||
|
.catch(err => {
|
||||||
|
viz = new window.Viz()
|
||||||
|
$value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
|
||||||
|
console.warn(err)
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
$value.unwrap()
|
viz = new window.Viz()
|
||||||
$value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
|
$value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
|
||||||
console.warn(err)
|
console.warn(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue