add title getters and setters, add spec for stateDiagram-v2

This commit is contained in:
Tali Herzka
2022-04-08 18:44:22 +00:00
committed by GitHub
parent 9eb18e78c3
commit 897c4259ed
3 changed files with 404 additions and 3 deletions

View File

@@ -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,
};