mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 17:56:43 +02:00
Merge branch '5237-unified-layout-common-renderer' of github.com:mermaid-js/mermaid into 5237-unified-layout-common-renderer
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
getDiagramTitle,
|
getDiagramTitle,
|
||||||
} from '../common/commonDb.js';
|
} from '../common/commonDb.js';
|
||||||
import { dataFetcher, reset as resetDataFetching } from './dataFetcher.js';
|
import { dataFetcher, reset as resetDataFetching } from './dataFetcher.js';
|
||||||
|
import { getDir } from './stateRenderer-v3-unified.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_DIAGRAM_DIRECTION,
|
DEFAULT_DIAGRAM_DIRECTION,
|
||||||
@@ -588,7 +589,7 @@ const trimColon = (str) => (str && str[0] === ':' ? str.substr(1).trim() : str.t
|
|||||||
|
|
||||||
export const getData = () => {
|
export const getData = () => {
|
||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
return { nodes, edges, other: {}, config };
|
return { nodes, edges, other: {}, config, direction: getDir(getRootDocV2()) };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@@ -16,7 +16,7 @@ import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
|
|||||||
* @param defaultDir - the direction to use if none is found
|
* @param defaultDir - the direction to use if none is found
|
||||||
* @returns The direction to use
|
* @returns The direction to use
|
||||||
*/
|
*/
|
||||||
const getDir = (parsedItem: any, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
|
export const getDir = (parsedItem: any, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
|
||||||
let dir = defaultDir;
|
let dir = defaultDir;
|
||||||
if (parsedItem.doc) {
|
if (parsedItem.doc) {
|
||||||
for (const parsedItemDoc of parsedItem.doc) {
|
for (const parsedItemDoc of parsedItem.doc) {
|
||||||
@@ -44,7 +44,7 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
// Not related to the refactoring, but this is the first step in the rendering process
|
// Not related to the refactoring, but this is the first step in the rendering process
|
||||||
diag.db.extract(diag.db.getRootDocV2());
|
diag.db.extract(diag.db.getRootDocV2());
|
||||||
|
|
||||||
const DIR = getDir(diag.db.getRootDocV2());
|
//const DIR = getDir(diag.db.getRootDocV2());
|
||||||
|
|
||||||
// The getData method provided in all supported diagrams is used to extract the data from the parsed structure
|
// The getData method provided in all supported diagrams is used to extract the data from the parsed structure
|
||||||
// into the Layout data format
|
// into the Layout data format
|
||||||
@@ -66,7 +66,6 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
|
|
||||||
data4Layout.type = diag.type;
|
data4Layout.type = diag.type;
|
||||||
data4Layout.layoutAlgorithm = layout;
|
data4Layout.layoutAlgorithm = layout;
|
||||||
data4Layout.direction = DIR;
|
|
||||||
|
|
||||||
// TODO: Should we move these two to baseConfig? These types are not there in StateConfig.
|
// TODO: Should we move these two to baseConfig? These types are not there in StateConfig.
|
||||||
|
|
||||||
@@ -89,4 +88,5 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
export default {
|
export default {
|
||||||
getClasses,
|
getClasses,
|
||||||
draw,
|
draw,
|
||||||
|
getDir,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user