mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Fix composite state with label
This commit is contained in:
parent
fc78ee0fc5
commit
a46f993e3e
@ -301,8 +301,13 @@ export const dataFetcher = (
|
|||||||
|
|
||||||
// If there's only 1 description entry, just use a regular state shape
|
// If there's only 1 description entry, just use a regular state shape
|
||||||
if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
|
if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
|
||||||
|
if (newNode.type === 'group') {
|
||||||
|
newNode.shape = SHAPE_GROUP;
|
||||||
|
} else {
|
||||||
newNode.shape = SHAPE_STATE;
|
newNode.shape = SHAPE_STATE;
|
||||||
}
|
}
|
||||||
|
//newNode.shape = SHAPE_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
// group
|
// group
|
||||||
if (!newNode.type && parsedItem.doc) {
|
if (!newNode.type && parsedItem.doc) {
|
||||||
|
@ -225,6 +225,13 @@ const extract = (_doc) => {
|
|||||||
if (Array.isArray(node.label)) {
|
if (Array.isArray(node.label)) {
|
||||||
// add the rest as description
|
// add the rest as description
|
||||||
node.description = node.label.slice(1);
|
node.description = node.label.slice(1);
|
||||||
|
if (node.isGroup && node.description.length > 0) {
|
||||||
|
throw new Error(
|
||||||
|
'Group nodes can only have label. Remove the additional description for node [' +
|
||||||
|
node.id +
|
||||||
|
']'
|
||||||
|
);
|
||||||
|
}
|
||||||
// add first description as label
|
// add first description as label
|
||||||
node.label = node.label[0];
|
node.label = node.label[0];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user