mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-12 02:29:37 +02:00
Adding sanitization to input fields for Pie chart
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
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';
|
||||||
|
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
|
||||||
|
|
||||||
let sections = {};
|
let sections = {};
|
||||||
let title = '';
|
let title = '';
|
||||||
@@ -12,6 +14,7 @@ export const parseDirective = function (statement, context, type) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const addSection = function (id, value) {
|
const addSection = function (id, value) {
|
||||||
|
id = common.sanitizeText(id, configApi.getConfig());
|
||||||
if (typeof sections[id] === 'undefined') {
|
if (typeof sections[id] === 'undefined') {
|
||||||
sections[id] = value;
|
sections[id] = value;
|
||||||
log.debug('Added new section :', id);
|
log.debug('Added new section :', id);
|
||||||
@@ -20,7 +23,7 @@ const addSection = function (id, value) {
|
|||||||
const getSections = () => sections;
|
const getSections = () => sections;
|
||||||
|
|
||||||
const setTitle = function (txt) {
|
const setTitle = function (txt) {
|
||||||
title = txt;
|
title = common.sanitizeText(txt, configApi.getConfig());
|
||||||
};
|
};
|
||||||
|
|
||||||
const setShowData = function (toggle) {
|
const setShowData = function (toggle) {
|
||||||
@@ -36,7 +39,7 @@ const getTitle = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setAccDescription = function (txt) {
|
const setAccDescription = function (txt) {
|
||||||
description = txt;
|
description = common.sanitizeText(txt, configApi.getConfig());
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAccDescription = function () {
|
const getAccDescription = function () {
|
||||||
|
Reference in New Issue
Block a user