diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html
index fd35eae36..91a3bbaad 100644
--- a/cypress/platform/knsv2.html
+++ b/cypress/platform/knsv2.html
@@ -100,7 +100,7 @@ mindmap
logLevel: 0,
// basePath: './packages/',
// themeVariables: { darkMode: true },
- extraDiagrams: ['./mermaid-mindmap-detector.js'],
+ extraDiagrams: ['./mermaid-mindmap-detector.core.mjs'],
// extraDiagrams: ['../../mermaid-mindmap/registry.ts'],
});
function callback() {
diff --git a/packages/mermaid-mindmap/src/registry.ts b/packages/mermaid-mindmap/src/registry.ts
index c8213437e..a76a3627f 100644
--- a/packages/mermaid-mindmap/src/registry.ts
+++ b/packages/mermaid-mindmap/src/registry.ts
@@ -1,6 +1,6 @@
export const id = 'mindmap';
-const detector = (txt: string) => {
+export const detector = (txt: string) => {
return txt.match(/^\s*mindmap/) !== null;
};
@@ -8,9 +8,3 @@ export const loadDiagram = async () => {
const { mindmap } = await import('./add-diagram');
return { id, diagram: mindmap };
};
-
-export default {
- id,
- detector,
- loadDiagram,
-};
diff --git a/packages/mermaid/src/diagram-api/detectType.ts b/packages/mermaid/src/diagram-api/detectType.ts
index 340cbfbae..6a31dd1a9 100644
--- a/packages/mermaid/src/diagram-api/detectType.ts
+++ b/packages/mermaid/src/diagram-api/detectType.ts
@@ -54,6 +54,9 @@ export const addDetector = (
loader: DiagramLoader | null
) => {
detectors[key] = { detector, loader };
+ // TODO: Remove
+ // eslint-disable-next-line no-console
+ console.log(detectors);
};
export const getDiagramLoader = (key: string) => detectors[key].loader;
diff --git a/packages/mermaid/src/mermaid.ts b/packages/mermaid/src/mermaid.ts
index 81b7a69d0..d59c43ec7 100644
--- a/packages/mermaid/src/mermaid.ts
+++ b/packages/mermaid/src/mermaid.ts
@@ -57,15 +57,11 @@ const init = async function (
const conf = mermaidAPI.getConfig();
if (typeof conf.extraDiagrams !== 'undefined' && conf.extraDiagrams.length > 0) {
// config.extraDiagrams.forEach(async (diagram: string) => {
- const apa = await import(conf.extraDiagrams[0]);
- // Todo figure out how to get the diagram properly
- //@ts-ignore temporary code
- const did = window['mermaid-mindmap-detector'].default.id; //eslint-disable-line
- //@ts-ignore temporary code
- const detector = window['mermaid-mindmap-detector'].default.detector; //eslint-disable-line
- //@ts-ignore temporary code
- const loader = window['mermaid-mindmap-detector'].default.loadDiagram; //eslint-disable-line
- addDetector(did, detector, loader);
+ const { id, detector, loadDiagram } = await import(conf.extraDiagrams[0]);
+ // TODO: Remove
+ // eslint-disable-next-line no-console
+ console.log(id, detector, loadDiagram);
+ addDetector(id, detector, loadDiagram);
// });
}
mermaid.detectors.forEach(({ id, detector, path }) => {