diff --git a/src/diagrams/common/common.js b/src/diagrams/common/common.js
index 5f17d9bbf..6fcec11e6 100644
--- a/src/diagrams/common/common.js
+++ b/src/diagrams/common/common.js
@@ -65,7 +65,9 @@ const sanitizeMore = (text, config) => {
};
export const sanitizeText = (text, config) => {
- if(!text) return text;
+ const level = config.securityLevel;
+ console.log('security level', level);
+ if (!text) return text;
const txt = DOMPurify.sanitize(sanitizeMore(text, config));
return txt;
};
diff --git a/src/diagrams/flowchart/parser/flow-singlenode.spec.js b/src/diagrams/flowchart/parser/flow-singlenode.spec.js
index 15f7cc169..5dc3c884f 100644
--- a/src/diagrams/flowchart/parser/flow-singlenode.spec.js
+++ b/src/diagrams/flowchart/parser/flow-singlenode.spec.js
@@ -112,7 +112,7 @@ describe('[Singlenodes] when parsing', () => {
expect(vert['a'].type).toBe('diamond');
});
- it('should handle a single diamond node with html in it', function() {
+ it('should handle a single diamond node with html in it (SN3)', function() {
// Silly but syntactically correct
const res = flow.parser.parse('graph TD;a{A
end};');
@@ -121,7 +121,7 @@ describe('[Singlenodes] when parsing', () => {
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('diamond');
- expect(vert['a'].text).toBe('A
end');
+ expect(vert['a'].text).toBe('A
end');
});
it('should handle a single hexagon node', function() {
@@ -144,7 +144,7 @@ describe('[Singlenodes] when parsing', () => {
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('hexagon');
- expect(vert['a'].text).toBe('A
end');
+ expect(vert['a'].text).toBe('A
end');
});
it('should handle a single round node with html in it', function() {
@@ -156,7 +156,7 @@ describe('[Singlenodes] when parsing', () => {
expect(edges.length).toBe(0);
expect(vert['a'].type).toBe('round');
- expect(vert['a'].text).toBe('A
end');
+ expect(vert['a'].text).toBe('A
end');
});
it('should handle a single node with alphanumerics starting on a char', function() {
diff --git a/src/diagrams/flowchart/parser/flow-text.spec.js b/src/diagrams/flowchart/parser/flow-text.spec.js
index 61703000a..b5c8a6eab 100644
--- a/src/diagrams/flowchart/parser/flow-text.spec.js
+++ b/src/diagrams/flowchart/parser/flow-text.spec.js
@@ -328,7 +328,7 @@ describe('[Text] when parsing', () => {
const edges = flow.parser.yy.getEdges();
expect(vert['C'].type).toBe('round');
- expect(vert['C'].text).toBe('Chimpansen hoppar åäö
- ÅÄÖ');
+ expect(vert['C'].text).toBe('Chimpansen hoppar åäö
- ÅÄÖ');
});
// xit('it should handle åäö, minus and space and br',function(){
// const res = flow.parser.parse('graph TD; A[Object(foo,bar)]-->B(Thing);');
diff --git a/src/diagrams/state/stateDb.js b/src/diagrams/state/stateDb.js
index 2e65bbe82..1b83d7bda 100644
--- a/src/diagrams/state/stateDb.js
+++ b/src/diagrams/state/stateDb.js
@@ -195,7 +195,11 @@ export const addRelation = function (_id1, _id2, title) {
}
addState(id1, type1);
addState(id2, type2);
- currentDocument.relations.push({ id1, id2, title: common.sanitizeText(title, configApi.getConfig()) });
+ currentDocument.relations.push({
+ id1,
+ id2,
+ title: common.sanitizeText(title, configApi.getConfig()),
+ });
};
const addDescription = function (id, _descr) {
@@ -204,7 +208,7 @@ const addDescription = function (id, _descr) {
if (descr[0] === ':') {
descr = descr.substr(1).trim();
}
- theState.descriptions.push(common.sanitizeText(descr, config));
+ theState.descriptions.push(common.sanitizeText(descr, configApi.getConfig()));
};
export const cleanupLabel = function (label) {
diff --git a/src/diagrams/state/stateRenderer-v2.js b/src/diagrams/state/stateRenderer-v2.js
index 31da0e184..dd1ff0a55 100644
--- a/src/diagrams/state/stateRenderer-v2.js
+++ b/src/diagrams/state/stateRenderer-v2.js
@@ -16,7 +16,6 @@ export const setConf = function (cnf) {
conf[keys[i]] = cnf[keys[i]];
}
};
-let mainConfig = getConfig();
let nodeDb = {};