Setting default securityLevel to strict, updated docs in mermaidAPI

This commit is contained in:
Knut Sveidqvist
2019-07-14 06:07:27 -07:00
parent 9753578903
commit c818dbb5a0
9 changed files with 2086 additions and 161 deletions

View File

@@ -18,10 +18,13 @@ let funs = []
const sanitize = text => {
let txt = text
txt = txt.replace(/<br>/g, '#br#')
txt = txt.replace(/<br\S*\/>/g, '#br#')
txt = txt.replace(/</g, '&lt;').replace(/>/g, '&gt;')
txt = txt.replace(/#br#/g, '<br/>')
if (config.securityLevel === 'strict') {
txt = txt.replace(/<br>/g, '#br#')
txt = txt.replace(/<br\S*\/>/g, '#br#')
txt = txt.replace(/</g, '&lt;').replace(/>/g, '&gt;')
txt = txt.replace(/#br#/g, '<br/>')
}
return txt
}
@@ -184,7 +187,7 @@ const setTooltip = function (ids, tooltip) {
}
const setClickFun = function (id, functionName) {
if (config.strictSecurity) {
if (config.securityLevel === 'strict') {
return
}
if (typeof functionName === 'undefined') {

View File

@@ -1,5 +1,10 @@
import flowDb from '../flowDb'
import flow from './flow'
import { setConfig } from '../../../config'
setConfig({
securityLevel: 'strict',
})
describe('when parsing ', function () {
beforeEach(function () {