mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Load mermaid without script-loader
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
bd62e79f7d
commit
a98d184f2c
2 changed files with 5 additions and 7 deletions
|
@ -17,6 +17,8 @@ import markdownitContainer from 'markdown-it-container'
|
|||
/* Defined regex markdown it plugins */
|
||||
import Plugin from 'markdown-it-regexp'
|
||||
|
||||
import mermaid from 'mermaid'
|
||||
|
||||
require('prismjs/themes/prism.css')
|
||||
require('prismjs/components/prism-wiki')
|
||||
require('prismjs/components/prism-haskell')
|
||||
|
@ -248,7 +250,7 @@ function replaceExtraTags (html) {
|
|||
return html
|
||||
}
|
||||
|
||||
if (typeof window.mermaid !== 'undefined' && window.mermaid) window.mermaid.startOnLoad = false
|
||||
mermaid.startOnLoad = false
|
||||
|
||||
// dynamic event or object binding here
|
||||
export function finishView (view) {
|
||||
|
@ -388,10 +390,10 @@ export function finishView (view) {
|
|||
$value = $(value)
|
||||
const $ele = $(value).closest('pre')
|
||||
|
||||
window.mermaid.mermaidAPI.parse($value.text())
|
||||
mermaid.mermaidAPI.parse($value.text())
|
||||
$ele.addClass('mermaid')
|
||||
$ele.text($value.text())
|
||||
window.mermaid.init(undefined, $ele)
|
||||
mermaid.init(undefined, $ele)
|
||||
} catch (err) {
|
||||
let errormessage = err
|
||||
if (err.str) {
|
||||
|
|
|
@ -248,7 +248,6 @@ module.exports = {
|
|||
'babel-polyfill',
|
||||
'bootstrap-validator',
|
||||
'expose-loader?exposes=jsyaml!js-yaml',
|
||||
'script-loader!mermaid',
|
||||
'expose-loader?exposes=moment!moment',
|
||||
'script-loader!handlebars',
|
||||
'expose-loader?exposes=hljs!highlight.js',
|
||||
|
@ -284,7 +283,6 @@ module.exports = {
|
|||
'pretty-pack': [
|
||||
'babel-polyfill',
|
||||
'expose-loader?exposes=jsyaml!js-yaml',
|
||||
'script-loader!mermaid',
|
||||
'expose-loader?exposes=moment!moment',
|
||||
'script-loader!handlebars',
|
||||
'expose-loader?exposes=hljs!highlight.js',
|
||||
|
@ -322,7 +320,6 @@ module.exports = {
|
|||
'imports-loader?imports=default|jquery|$!jquery-mousewheel',
|
||||
'bootstrap-tooltip',
|
||||
'expose-loader?exposes=jsyaml!js-yaml',
|
||||
'script-loader!mermaid',
|
||||
'expose-loader?exposes=moment!moment',
|
||||
'script-loader!handlebars',
|
||||
'expose-loader?exposes=hljs!highlight.js',
|
||||
|
@ -348,7 +345,6 @@ module.exports = {
|
|||
modules: ['node_modules'],
|
||||
extensions: ['.js'],
|
||||
alias: {
|
||||
mermaid: path.join(__dirname, 'node_modules/mermaid/dist/mermaid.min.js'),
|
||||
handlebars: path.join(__dirname, 'node_modules/handlebars/dist/handlebars.min.js'),
|
||||
'gist-embed': path.join(__dirname, 'node_modules/gist-embed/gist-embed.min.js'),
|
||||
'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
|
||||
|
|
Loading…
Reference in a new issue