mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-03-08 11:44:19 +00:00
Set wasmfolder (#619)
This commit is contained in:
parent
5381f8ed90
commit
2b6ba82b4b
1 changed files with 18 additions and 10 deletions
|
@ -25,16 +25,24 @@ export const GraphvizFrame: React.FC<GraphvizFrameProps> = ({ code }) => {
|
|||
}
|
||||
const actualContainer = container.current
|
||||
|
||||
Promise.all([import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'), import('@hpcc-js/wasm')]).then(([imp]) => {
|
||||
try {
|
||||
setError(undefined)
|
||||
imp.graphviz(actualContainer, { useWorker: false, zoom: false })
|
||||
.onerror(showError)
|
||||
.renderDot(code)
|
||||
} catch (error) {
|
||||
showError(error)
|
||||
}
|
||||
}).catch(() => { console.error('error while loading graphviz') })
|
||||
import('@hpcc-js/wasm')
|
||||
.then((wasmPlugin) => {
|
||||
wasmPlugin.wasmFolder('/static/js')
|
||||
})
|
||||
.then(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'))
|
||||
.then((graphvizImport) => {
|
||||
try {
|
||||
setError(undefined)
|
||||
graphvizImport.graphviz(actualContainer, {
|
||||
useWorker: false,
|
||||
zoom: false
|
||||
})
|
||||
.onerror(showError)
|
||||
.renderDot(code)
|
||||
} catch (error) {
|
||||
showError(error)
|
||||
}
|
||||
}).catch(() => { console.error('error while loading graphviz') })
|
||||
}, [code, error, showError])
|
||||
|
||||
return <Fragment>
|
||||
|
|
Loading…
Reference in a new issue