Merge pull request #2916 from gwincr11/cg-sanitize

feat: add sanitization consistently
This commit is contained in:
Knut Sveidqvist 2022-04-12 07:20:39 +02:00 committed by GitHub
commit c13f6f789f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import { log } from '../../logger'; import { log } from '../../logger';
import mermaidAPI from '../../mermaidAPI'; import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config'; import * as configApi from '../../config';
import common from '../common/common';
let entities = {}; let entities = {};
let relationships = []; let relationships = [];
@ -69,7 +70,8 @@ const getRelationships = () => relationships;
// Keep this - TODO: revisit...allow the diagram to have a title // Keep this - TODO: revisit...allow the diagram to have a title
const setTitle = function (txt) { const setTitle = function (txt) {
title = txt; let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
title = sanitizedText;
}; };
const getTitle = function () { const getTitle = function () {
@ -77,7 +79,8 @@ const getTitle = function () {
}; };
const setAccDescription = function (txt) { const setAccDescription = function (txt) {
description = txt; let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
description = sanitizedText;
}; };
const getAccDescription = function () { const getAccDescription = function () {

View File

@ -2,7 +2,6 @@ import { log } from '../../logger';
import mermaidAPI from '../../mermaidAPI'; import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config'; import * as configApi from '../../config';
import common from '../common/common'; import common from '../common/common';
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
let sections = {}; let sections = {};
let title = ''; let title = '';

View File

@ -1,5 +1,6 @@
import mermaidAPI from '../../mermaidAPI'; import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config'; import * as configApi from '../../config';
import common from '../common/common';
let title = ''; let title = '';
let currentSection = ''; let currentSection = '';
@ -21,7 +22,9 @@ export const clear = function () {
}; };
export const setTitle = function (txt) { export const setTitle = function (txt) {
title = txt; let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
title = sanitizedText;
}; };
export const getTitle = function () { export const getTitle = function () {