Feature/browserstack (#902)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2021-01-06 13:09:33 +01:00 committed by GitHub
parent 900affeac2
commit 887c3b9dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 404 additions and 86 deletions

View file

@ -46,11 +46,15 @@ export const MarkmapFrame: React.FC<MarkmapFrameProps> = ({ code }) => {
}
const actualContainer = diagramContainer.current
import('./markmap-loader').then(({ markmapLoader }) => {
const svg: SVGSVGElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svg.setAttribute('width', '100%')
actualContainer.querySelectorAll('svg').forEach(child => child.remove())
actualContainer.appendChild(svg)
markmapLoader(svg, code)
try {
const svg: SVGSVGElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svg.setAttribute('width', '100%')
actualContainer.querySelectorAll('svg').forEach(child => child.remove())
actualContainer.appendChild(svg)
markmapLoader(svg, code)
} catch(error) {
console.error(error)
}
}).catch(() => {
console.error('error while loading markmap')
})