2022-09-21 11:03:33 +02:00
|
|
|
// @ts-ignore: TODO Fix ts errors
|
|
|
|
import { mindmapDetector } from './mindmapDetector';
|
2022-09-21 12:35:25 +02:00
|
|
|
|
2022-09-26 08:01:23 +02:00
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
if (window.mermaid && typeof window.mermaid.detectors === 'object') {
|
|
|
|
window.mermaid.detectors.push({ id: 'mindmap', detector: mindmapDetector });
|
|
|
|
} else {
|
2022-09-26 10:44:18 +02:00
|
|
|
// console.error('window.mermaid.detectors was not found!'); // eslint-disable-line no-console
|
2022-09-26 08:01:23 +02:00
|
|
|
window.mermaid = {};
|
|
|
|
window.mermaid.detectors = [{ id: 'mindmap', detector: mindmapDetector }];
|
2022-09-26 10:44:18 +02:00
|
|
|
// console.error('Detectors now:', window.mermaid.detectors); // eslint-disable-line no-console
|
2022-09-26 08:01:23 +02:00
|
|
|
}
|
2022-09-21 12:35:25 +02:00
|
|
|
|
2022-09-26 08:01:23 +02:00
|
|
|
/*!
|
|
|
|
* Wait for document loaded before starting the execution.
|
|
|
|
*/
|
|
|
|
window.addEventListener(
|
|
|
|
'load',
|
|
|
|
() => {
|
|
|
|
if (window.mermaid && typeof window.mermaid.detectors === 'object') {
|
|
|
|
window.mermaid.detectors.push({ id: 'mindmap', detector: mindmapDetector });
|
|
|
|
// console.error(window.mermaid.detectors); // eslint-disable-line no-console
|
|
|
|
}
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
|
|
|
}
|