mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Lazy loading fix for example-diagram and mindmaps
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* Detector function that will be called by mermaid to determine if the diagram is this type of digram.
|
||||
*
|
||||
* @param txt The diagram text will be passed to the detector
|
||||
* @returns True if the diagram text matches a diagram of this type
|
||||
*/
|
||||
|
||||
export const detector = (txt: string) => {
|
||||
return txt.match(/^\s*example-diagram/) !== null;
|
||||
};
|
||||
|
@@ -13,21 +13,29 @@ export const getMessage = () => {
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the info flag
|
||||
*
|
||||
* @param {boolean} inf
|
||||
*/
|
||||
export const setInfo = (inf) => {
|
||||
info = inf;
|
||||
};
|
||||
|
||||
/** @returns Returns the info flag */
|
||||
export const getInfo = () => {
|
||||
return info;
|
||||
};
|
||||
|
||||
export const clear = () => {
|
||||
message = '';
|
||||
info = false;
|
||||
};
|
||||
|
||||
export default {
|
||||
setMessage,
|
||||
getMessage,
|
||||
setInfo,
|
||||
getInfo,
|
||||
clear: () => {
|
||||
message = '';
|
||||
info = false;
|
||||
},
|
||||
clear,
|
||||
};
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
%%
|
||||
|
||||
"info" return 'info' ;
|
||||
"example-diagram" return 'example-diagram' ;
|
||||
[\s\n\r]+ return 'NL' ;
|
||||
[\s]+ return 'space';
|
||||
"showInfo" return 'showInfo';
|
||||
@@ -22,8 +22,8 @@
|
||||
%% /* language grammar */
|
||||
|
||||
start
|
||||
// %{ : info document 'EOF' { return yy; } }
|
||||
: info document 'EOF' { return yy; }
|
||||
// %{ : example-diagram document 'EOF' { return yy; } }
|
||||
: example-diagram document 'EOF' { return yy; }
|
||||
;
|
||||
|
||||
document
|
||||
|
Reference in New Issue
Block a user