Use mermaidAPI in mermaid scope

Introduced by a5b7145527 (diff-67ae90c5144c55348a3cbdb078240454L532)

Fixes #600

Parse only throws error: 167368d508 (diff-67ae90c5144c55348a3cbdb078240454)
This commit is contained in:
Sheogorath 2017-10-28 16:56:25 +02:00
parent f1475535a2
commit 09d2ba41cf
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

View file

@ -373,18 +373,10 @@ export function finishView (view) {
var $value = $(value) var $value = $(value)
const $ele = $(value).closest('pre') const $ele = $(value).closest('pre')
let mermaidError = null window.mermaid.mermaidAPI.parse($value.text())
window.mermaid.parseError = (err, hash) => { $ele.addClass('mermaid')
mermaidError = err $ele.html($value.text())
} window.mermaid.init(undefined, $ele)
if (window.mermaidAPI.parse($value.text())) {
$ele.addClass('mermaid')
$ele.html($value.text())
window.mermaid.init(undefined, $ele)
} else {
throw new Error(mermaidError)
}
} catch (err) { } catch (err) {
$value.unwrap() $value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>') $value.parent().append('<div class="alert alert-warning">' + err + '</div>')