Skip to content

Commit

Permalink
#5237 add support for diagram title
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishjain0512 committed Apr 29, 2024
1 parent 2118522 commit 7e837df
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
DIVIDER_TYPE,
CSS_DIAGRAM,
} from './stateCommon.js';
import utils from '../../utils.js';

// Configuration
const conf: Record<string, any> = {};
Expand Down Expand Up @@ -86,8 +87,8 @@ export const draw = async function (text: string, id: string, _version: string,
// performRender(data4Rendering);

data4Layout.type = diag.type;

Check failure on line 89 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'type' does not exist on type 'LayoutData'.
// data4Layout.layoutAlgorithm = 'dagre-wrapper';
data4Layout.layoutAlgorithm = 'elk';
data4Layout.layoutAlgorithm = 'dagre-wrapper';

Check failure on line 90 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'layoutAlgorithm' does not exist on type 'LayoutData'.
//data4Layout.layoutAlgorithm = 'elk';
data4Layout.skin = 'roughjs';

Check failure on line 92 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'skin' does not exist on type 'LayoutData'.
data4Layout.direction = DIR;

Check failure on line 93 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'direction' does not exist on type 'LayoutData'.
data4Layout.nodeSpacing = conf.nodeSpacing || 50;

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'nodeSpacing' does not exist on type 'LayoutData'.

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

'conf' is possibly 'undefined'.

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'nodeSpacing' does not exist on type 'StateDiagramConfig'.
Expand All @@ -97,6 +98,12 @@ export const draw = async function (text: string, id: string, _version: string,
console.log('REF1:', data4Layout);
await render(data4Layout, svg, element);
const padding = 8;
utils.insertTitle(
element,
'statediagramTitleText',
conf.titleTopMargin,
diag.db.getDiagramTitle()
);
setupViewPortForSVG(svg, padding, CSS_DIAGRAM, conf.useMaxWidth);
};

Expand Down

0 comments on commit 7e837df

Please sign in to comment.