mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
#5237 Make getData to use global nodes and edges
This commit is contained in:
@@ -71,6 +71,9 @@ function newClassesList() {
|
|||||||
return new Map();
|
return new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nodes = [];
|
||||||
|
let edges = [];
|
||||||
|
|
||||||
let direction = DEFAULT_DIAGRAM_DIRECTION;
|
let direction = DEFAULT_DIAGRAM_DIRECTION;
|
||||||
let rootDoc = [];
|
let rootDoc = [];
|
||||||
let classes = newClassesList(); // style classes defined by a classDef
|
let classes = newClassesList(); // style classes defined by a classDef
|
||||||
@@ -222,6 +225,13 @@ const extract = (_doc) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const diagramStates = getStates();
|
||||||
|
const config = getConfig();
|
||||||
|
const useRough = config.look === 'handdrawn';
|
||||||
|
const look = config.look;
|
||||||
|
resetDataFetching();
|
||||||
|
dataFetcher(undefined, getRootDocV2(), diagramStates, nodes, edges, true, useRough, look);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,6 +316,8 @@ export const addState = function (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const clear = function (saveCommon) {
|
export const clear = function (saveCommon) {
|
||||||
|
nodes = [];
|
||||||
|
edges = [];
|
||||||
documents = {
|
documents = {
|
||||||
root: newDoc(),
|
root: newDoc(),
|
||||||
};
|
};
|
||||||
@@ -571,20 +583,7 @@ const setDirection = (dir) => {
|
|||||||
const trimColon = (str) => (str && str[0] === ':' ? str.substr(1).trim() : str.trim());
|
const trimColon = (str) => (str && str[0] === ':' ? str.substr(1).trim() : str.trim());
|
||||||
|
|
||||||
export const getData = () => {
|
export const getData = () => {
|
||||||
const nodes = [];
|
|
||||||
const edges = [];
|
|
||||||
|
|
||||||
// for (const key in currentDocument.states) {
|
|
||||||
// if (currentDocument.states.hasOwnProperty(key)) {
|
|
||||||
// nodes.push({...currentDocument.states[key]});
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
const diagramStates = getStates();
|
|
||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
const useRough = config.look === 'handdrawn';
|
|
||||||
const look = config.look;
|
|
||||||
resetDataFetching();
|
|
||||||
dataFetcher(undefined, getRootDocV2(), diagramStates, nodes, edges, true, useRough, look);
|
|
||||||
return { nodes, edges, other: {}, config };
|
return { nodes, edges, other: {}, config };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user