2022-10-05 13:14:05 +02:00
|
|
|
export const id = 'mindmap';
|
2022-09-21 12:35:25 +02:00
|
|
|
|
2022-10-05 13:14:05 +02:00
|
|
|
const detectorFunction = (txt: string) => {
|
|
|
|
return txt.match(/^\s*mindmap/) !== null;
|
|
|
|
};
|
2022-09-26 14:22:21 +02:00
|
|
|
|
2022-10-05 13:14:05 +02:00
|
|
|
export const loadDiagram = async () => {
|
|
|
|
const diagram = await import('./add-diagram');
|
|
|
|
return { id, detector, diagram };
|
|
|
|
};
|
|
|
|
export const detector = async (txt: string) => {
|
|
|
|
if (detectorFunction(txt)) {
|
|
|
|
const diagram = await import('./add-diagram');
|
|
|
|
return { id, diagram };
|
2022-09-26 08:01:23 +02:00
|
|
|
} else {
|
2022-10-05 13:14:05 +02:00
|
|
|
return false;
|
2022-09-26 08:01:23 +02:00
|
|
|
}
|
2022-10-05 13:14:05 +02:00
|
|
|
};
|
2022-09-21 12:35:25 +02:00
|
|
|
|
2022-10-05 13:14:05 +02:00
|
|
|
export const id = 'mindmap';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
id,
|
|
|
|
detector,
|
|
|
|
loadDiagram,
|
|
|
|
};
|