mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-26 01:51:13 +00:00
Use mermaidAPI in mermaid scope
Introduced bya5b7145527 (diff-67ae90c5144c55348a3cbdb078240454L532)
Fixes #600 Parse only throws error:167368d508 (diff-67ae90c5144c55348a3cbdb078240454)
This commit is contained in:
parent
f1475535a2
commit
09d2ba41cf
1 changed files with 4 additions and 12 deletions
|
@ -373,18 +373,10 @@ export function finishView (view) {
|
|||
var $value = $(value)
|
||||
const $ele = $(value).closest('pre')
|
||||
|
||||
let mermaidError = null
|
||||
window.mermaid.parseError = (err, hash) => {
|
||||
mermaidError = err
|
||||
}
|
||||
|
||||
if (window.mermaidAPI.parse($value.text())) {
|
||||
$ele.addClass('mermaid')
|
||||
$ele.html($value.text())
|
||||
window.mermaid.init(undefined, $ele)
|
||||
} else {
|
||||
throw new Error(mermaidError)
|
||||
}
|
||||
window.mermaid.mermaidAPI.parse($value.text())
|
||||
$ele.addClass('mermaid')
|
||||
$ele.html($value.text())
|
||||
window.mermaid.init(undefined, $ele)
|
||||
} catch (err) {
|
||||
$value.unwrap()
|
||||
$value.parent().append('<div class="alert alert-warning">' + err + '</div>')
|
||||
|
|
Loading…
Reference in a new issue