mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-18 03:34:12 +01:00
add title getters and setters, add spec for stateDiagram-v2
This commit is contained in:
@@ -4,6 +4,8 @@ import mermaidAPI from '../../mermaidAPI';
|
||||
import common from '../common/common';
|
||||
import * as configApi from '../../config';
|
||||
|
||||
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
|
||||
|
||||
const clone = (o) => JSON.parse(JSON.stringify(o));
|
||||
let rootDoc = [];
|
||||
|
||||
@@ -115,10 +117,19 @@ let startCnt = 0;
|
||||
let endCnt = 0; // eslint-disable-line
|
||||
// let stateCnt = 0;
|
||||
|
||||
let title = 'State diagram';
|
||||
let description = '';
|
||||
|
||||
const setTitle = function (txt) {
|
||||
title = sanitizeText(txt);
|
||||
};
|
||||
|
||||
const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
|
||||
const setAccDescription = function (txt) {
|
||||
description = txt;
|
||||
description = sanitizeText(txt);
|
||||
};
|
||||
|
||||
const getAccDescription = function () {
|
||||
@@ -290,6 +301,8 @@ export default {
|
||||
getRootDocV2,
|
||||
extract,
|
||||
trimColon,
|
||||
getTitle,
|
||||
setTitle,
|
||||
getAccDescription,
|
||||
setAccDescription,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user