mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -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 */
|
/* Defined regex markdown it plugins */
|
||||||
import Plugin from 'markdown-it-regexp'
|
import Plugin from 'markdown-it-regexp'
|
||||||
|
|
||||||
|
import mermaid from 'mermaid'
|
||||||
|
|
||||||
require('prismjs/themes/prism.css')
|
require('prismjs/themes/prism.css')
|
||||||
require('prismjs/components/prism-wiki')
|
require('prismjs/components/prism-wiki')
|
||||||
require('prismjs/components/prism-haskell')
|
require('prismjs/components/prism-haskell')
|
||||||
|
@ -248,7 +250,7 @@ function replaceExtraTags (html) {
|
||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof window.mermaid !== 'undefined' && window.mermaid) window.mermaid.startOnLoad = false
|
mermaid.startOnLoad = false
|
||||||
|
|
||||||
// dynamic event or object binding here
|
// dynamic event or object binding here
|
||||||
export function finishView (view) {
|
export function finishView (view) {
|
||||||
|
@ -388,10 +390,10 @@ export function finishView (view) {
|
||||||
$value = $(value)
|
$value = $(value)
|
||||||
const $ele = $(value).closest('pre')
|
const $ele = $(value).closest('pre')
|
||||||
|
|
||||||
window.mermaid.mermaidAPI.parse($value.text())
|
mermaid.mermaidAPI.parse($value.text())
|
||||||
$ele.addClass('mermaid')
|
$ele.addClass('mermaid')
|
||||||
$ele.text($value.text())
|
$ele.text($value.text())
|
||||||
window.mermaid.init(undefined, $ele)
|
mermaid.init(undefined, $ele)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
let errormessage = err
|
let errormessage = err
|
||||||
if (err.str) {
|
if (err.str) {
|
||||||
|
|
|
@ -248,7 +248,6 @@ module.exports = {
|
||||||
'babel-polyfill',
|
'babel-polyfill',
|
||||||
'bootstrap-validator',
|
'bootstrap-validator',
|
||||||
'expose-loader?exposes=jsyaml!js-yaml',
|
'expose-loader?exposes=jsyaml!js-yaml',
|
||||||
'script-loader!mermaid',
|
|
||||||
'expose-loader?exposes=moment!moment',
|
'expose-loader?exposes=moment!moment',
|
||||||
'script-loader!handlebars',
|
'script-loader!handlebars',
|
||||||
'expose-loader?exposes=hljs!highlight.js',
|
'expose-loader?exposes=hljs!highlight.js',
|
||||||
|
@ -284,7 +283,6 @@ module.exports = {
|
||||||
'pretty-pack': [
|
'pretty-pack': [
|
||||||
'babel-polyfill',
|
'babel-polyfill',
|
||||||
'expose-loader?exposes=jsyaml!js-yaml',
|
'expose-loader?exposes=jsyaml!js-yaml',
|
||||||
'script-loader!mermaid',
|
|
||||||
'expose-loader?exposes=moment!moment',
|
'expose-loader?exposes=moment!moment',
|
||||||
'script-loader!handlebars',
|
'script-loader!handlebars',
|
||||||
'expose-loader?exposes=hljs!highlight.js',
|
'expose-loader?exposes=hljs!highlight.js',
|
||||||
|
@ -322,7 +320,6 @@ module.exports = {
|
||||||
'imports-loader?imports=default|jquery|$!jquery-mousewheel',
|
'imports-loader?imports=default|jquery|$!jquery-mousewheel',
|
||||||
'bootstrap-tooltip',
|
'bootstrap-tooltip',
|
||||||
'expose-loader?exposes=jsyaml!js-yaml',
|
'expose-loader?exposes=jsyaml!js-yaml',
|
||||||
'script-loader!mermaid',
|
|
||||||
'expose-loader?exposes=moment!moment',
|
'expose-loader?exposes=moment!moment',
|
||||||
'script-loader!handlebars',
|
'script-loader!handlebars',
|
||||||
'expose-loader?exposes=hljs!highlight.js',
|
'expose-loader?exposes=hljs!highlight.js',
|
||||||
|
@ -348,7 +345,6 @@ module.exports = {
|
||||||
modules: ['node_modules'],
|
modules: ['node_modules'],
|
||||||
extensions: ['.js'],
|
extensions: ['.js'],
|
||||||
alias: {
|
alias: {
|
||||||
mermaid: path.join(__dirname, 'node_modules/mermaid/dist/mermaid.min.js'),
|
|
||||||
handlebars: path.join(__dirname, 'node_modules/handlebars/dist/handlebars.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'),
|
'gist-embed': path.join(__dirname, 'node_modules/gist-embed/gist-embed.min.js'),
|
||||||
'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
|
'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
|
||||||
|
|
Loading…
Reference in a new issue