27 lines
530 B
TypeScript
Raw Normal View History

2022-10-05 13:14:05 +02:00
export const id = 'mindmap';
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 };
} else {
2022-10-05 13:14:05 +02:00
return false;
}
2022-10-05 13:14:05 +02:00
};
2022-10-05 13:14:05 +02:00
export const id = 'mindmap';
export default {
id,
detector,
loadDiagram,
};