mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-10-18 21:30:15 -04: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
|
const actualContainer = container.current
|
||||||
|
|
||||||
Promise.all([import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'), import('@hpcc-js/wasm')]).then(([imp]) => {
|
import('@hpcc-js/wasm')
|
||||||
try {
|
.then((wasmPlugin) => {
|
||||||
setError(undefined)
|
wasmPlugin.wasmFolder('/static/js')
|
||||||
imp.graphviz(actualContainer, { useWorker: false, zoom: false })
|
})
|
||||||
.onerror(showError)
|
.then(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'))
|
||||||
.renderDot(code)
|
.then((graphvizImport) => {
|
||||||
} catch (error) {
|
try {
|
||||||
showError(error)
|
setError(undefined)
|
||||||
}
|
graphvizImport.graphviz(actualContainer, {
|
||||||
}).catch(() => { console.error('error while loading graphviz') })
|
useWorker: false,
|
||||||
|
zoom: false
|
||||||
|
})
|
||||||
|
.onerror(showError)
|
||||||
|
.renderDot(code)
|
||||||
|
} catch (error) {
|
||||||
|
showError(error)
|
||||||
|
}
|
||||||
|
}).catch(() => { console.error('error while loading graphviz') })
|
||||||
}, [code, error, showError])
|
}, [code, error, showError])
|
||||||
|
|
||||||
return <Fragment>
|
return <Fragment>
|
||||||
|
|
Loading…
Reference in a new issue