diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/extra.js | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index d36592d9..13b8924c 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -373,22 +373,19 @@ export function finishView (view) { var $value = $(value) const $ele = $(value).closest('pre') - let mermaidError = null - window.mermaid.parseError = (err, hash) => { - mermaidError = err + window.mermaid.mermaidAPI.parse($value.text()) + $ele.addClass('mermaid') + $ele.html($value.text()) + window.mermaid.init(undefined, $ele) + } catch (err) { + var errormessage = err + if (err.str) { + errormessage = err.str } - 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) { $value.unwrap() - $value.parent().append('<div class="alert alert-warning">' + err + '</div>') - console.warn(err) + $value.parent().append('<div class="alert alert-warning">' + errormessage + '</div>') + console.warn(errormessage) } }) // abc.js |