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-';
|
||||
|
||||
let config = configApi.getConfig();
|
||||
let relations = [];
|
||||
let classes = {};
|
||||
let classCounter = 0;
|
||||
|
@ -173,7 +174,6 @@ export const setCssClass = function(ids, className) {
|
|||
* @param linkStr URL to create a link for
|
||||
*/
|
||||
export const setLink = function(ids, linkStr) {
|
||||
const config = configApi.getConfig();
|
||||
ids.split(',').forEach(function(_id) {
|
||||
let id = _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 config = configApi.getConfig();
|
||||
let id = domId;
|
||||
let elemId = lookUpDomId(id);
|
||||
|
||||
|
@ -299,7 +298,7 @@ funs.push(setupToolTips);
|
|||
|
||||
export default {
|
||||
parseDirective,
|
||||
getConfig: () => configApi.getConfig().class,
|
||||
getConfig: () => config.class,
|
||||
addClass,
|
||||
bindFunctions,
|
||||
clear,
|
||||
|
|
|
@ -72,7 +72,6 @@ export const addVertex = function(_id, text, type, style, classes) {
|
|||
}
|
||||
vertexCounter++;
|
||||
if (typeof text !== 'undefined') {
|
||||
config = configApi.getConfig();
|
||||
txt = common.sanitizeText(text.trim(), config);
|
||||
|
||||
// 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) {
|
||||
let domId = lookUpDomId(id);
|
||||
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
||||
if (config.securityLevel !== 'loose') {
|
||||
return;
|
||||
}
|
||||
if (typeof functionName === 'undefined') {
|
||||
|
|
Loading…
Reference in New Issue