mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 01:34:19 +01:00
making consitent config imports from diagramAPI
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Selection } from 'd3';
|
||||
import { select } from 'd3';
|
||||
import { log } from '../../logger.js';
|
||||
import * as configApi from '../../config.js';
|
||||
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||
import common from '../common/common.js';
|
||||
import utils from '../../utils.js';
|
||||
import {
|
||||
@@ -34,7 +34,7 @@ let namespaceCounter = 0;
|
||||
|
||||
let functions: any[] = [];
|
||||
|
||||
const sanitizeText = (txt: string) => common.sanitizeText(txt, configApi.getConfig());
|
||||
const sanitizeText = (txt: string) => common.sanitizeText(txt, getConfig());
|
||||
|
||||
const splitClassNameAndType = function (_id: string) {
|
||||
const id = common.sanitizeText(_id, configApi.getConfig());
|
||||
@@ -139,15 +139,9 @@ export const addRelation = function (relation: ClassRelation) {
|
||||
relation.id1 = splitClassNameAndType(relation.id1).className;
|
||||
relation.id2 = splitClassNameAndType(relation.id2).className;
|
||||
|
||||
relation.relationTitle1 = common.sanitizeText(
|
||||
relation.relationTitle1.trim(),
|
||||
configApi.getConfig()
|
||||
);
|
||||
relation.relationTitle1 = common.sanitizeText(relation.relationTitle1.trim(), getConfig());
|
||||
|
||||
relation.relationTitle2 = common.sanitizeText(
|
||||
relation.relationTitle2.trim(),
|
||||
configApi.getConfig()
|
||||
);
|
||||
relation.relationTitle2 = common.sanitizeText(relation.relationTitle2.trim(), getConfig());
|
||||
|
||||
relations.push(relation);
|
||||
};
|
||||
@@ -267,7 +261,7 @@ export const getTooltip = function (id: string, namespace?: string) {
|
||||
* @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file
|
||||
*/
|
||||
export const setLink = function (ids: string, linkStr: string, target: string) {
|
||||
const config = configApi.getConfig();
|
||||
const config = getConfig();
|
||||
ids.split(',').forEach(function (_id) {
|
||||
let id = _id;
|
||||
if (_id[0].match(/\d/)) {
|
||||
@@ -304,7 +298,7 @@ export const setClickEvent = function (ids: string, functionName: string, functi
|
||||
|
||||
const setClickFunc = function (_domId: string, functionName: string, functionArgs: string) {
|
||||
const domId = common.sanitizeText(_domId, configApi.getConfig());
|
||||
const config = configApi.getConfig();
|
||||
const config = getConfig();
|
||||
if (config.securityLevel !== 'loose') {
|
||||
return;
|
||||
}
|
||||
@@ -465,7 +459,7 @@ export default {
|
||||
getAccTitle,
|
||||
getAccDescription,
|
||||
setAccDescription,
|
||||
getConfig: () => configApi.getConfig().class,
|
||||
getConfig: () => getConfig().class,
|
||||
addClass,
|
||||
bindFunctions,
|
||||
clear,
|
||||
|
||||
Reference in New Issue
Block a user