config factorization
This commit is contained in:
parent
1940b63237
commit
b1bb2dce16
|
@ -7,6 +7,7 @@ import mermaidAPI from '../../mermaidAPI';
|
||||||
|
|
||||||
const MERMAID_DOM_ID_PREFIX = 'classid-';
|
const MERMAID_DOM_ID_PREFIX = 'classid-';
|
||||||
|
|
||||||
|
let config = configApi.getConfig();
|
||||||
let relations = [];
|
let relations = [];
|
||||||
let classes = {};
|
let classes = {};
|
||||||
let classCounter = 0;
|
let classCounter = 0;
|
||||||
|
@ -173,7 +174,6 @@ export const setCssClass = function(ids, className) {
|
||||||
* @param linkStr URL to create a link for
|
* @param linkStr URL to create a link for
|
||||||
*/
|
*/
|
||||||
export const setLink = function(ids, linkStr) {
|
export const setLink = function(ids, linkStr) {
|
||||||
const config = configApi.getConfig();
|
|
||||||
ids.split(',').forEach(function(_id) {
|
ids.split(',').forEach(function(_id) {
|
||||||
let id = _id;
|
let id = _id;
|
||||||
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||||
|
@ -210,7 +210,6 @@ export const setTooltip = function(ids, tooltip) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const setClickFunc = function(domId, functionName) {
|
const setClickFunc = function(domId, functionName) {
|
||||||
const config = configApi.getConfig();
|
|
||||||
let id = domId;
|
let id = domId;
|
||||||
let elemId = lookUpDomId(id);
|
let elemId = lookUpDomId(id);
|
||||||
|
|
||||||
|
@ -299,7 +298,7 @@ funs.push(setupToolTips);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
parseDirective,
|
parseDirective,
|
||||||
getConfig: () => configApi.getConfig().class,
|
getConfig: () => config.class,
|
||||||
addClass,
|
addClass,
|
||||||
bindFunctions,
|
bindFunctions,
|
||||||
clear,
|
clear,
|
||||||
|
|
|
@ -72,7 +72,6 @@ export const addVertex = function(_id, text, type, style, classes) {
|
||||||
}
|
}
|
||||||
vertexCounter++;
|
vertexCounter++;
|
||||||
if (typeof text !== 'undefined') {
|
if (typeof text !== 'undefined') {
|
||||||
config = configApi.getConfig();
|
|
||||||
txt = common.sanitizeText(text.trim(), config);
|
txt = common.sanitizeText(text.trim(), config);
|
||||||
|
|
||||||
// strip quotes if string starts and ends with a quote
|
// strip quotes if string starts and ends with a quote
|
||||||
|
@ -250,7 +249,7 @@ const setTooltip = function(ids, tooltip) {
|
||||||
const setClickFun = function(id, functionName, functionArgs) {
|
const setClickFun = function(id, functionName, functionArgs) {
|
||||||
let domId = lookUpDomId(id);
|
let domId = lookUpDomId(id);
|
||||||
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
if (config.securityLevel !== 'loose') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof functionName === 'undefined') {
|
if (typeof functionName === 'undefined') {
|
||||||
|
|
Loading…
Reference in New Issue