mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-19 20:24:16 +01:00
Addressing code style issues
This commit is contained in:
@@ -11,7 +11,6 @@ parser.yy = classDb;
|
|||||||
const MERMAID_DOM_ID_PREFIX = 'classid-';
|
const MERMAID_DOM_ID_PREFIX = 'classid-';
|
||||||
let idCache = {};
|
let idCache = {};
|
||||||
|
|
||||||
let classCnt = 0;
|
|
||||||
const conf = {
|
const conf = {
|
||||||
dividerMargin: 10,
|
dividerMargin: 10,
|
||||||
padding: 5,
|
padding: 5,
|
||||||
@@ -433,8 +432,7 @@ const drawClass = function(elem, classDef) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (classDef.tooltip) {
|
if (classDef.tooltip) {
|
||||||
const tooltip = title
|
title.insert('title')
|
||||||
.insert('title')
|
|
||||||
.text(classDef.tooltip);
|
.text(classDef.tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +443,6 @@ const drawClass = function(elem, classDef) {
|
|||||||
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
||||||
|
|
||||||
idCache[id] = classInfo;
|
idCache[id] = classInfo;
|
||||||
classCnt++;
|
|
||||||
return classInfo;
|
return classInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,13 +95,12 @@ export const sanitize = (text, config) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const formatUrl = (linkStr, config) => {
|
export const formatUrl = (linkStr, config) => {
|
||||||
let url = linkStr;
|
let url = linkStr.trim();
|
||||||
|
|
||||||
|
if (url) {
|
||||||
if (config.securityLevel !== 'loose') {
|
if (config.securityLevel !== 'loose') {
|
||||||
return sanitizeUrl(url);
|
return sanitizeUrl(url);
|
||||||
} else {
|
} else {
|
||||||
url = url.trim();
|
|
||||||
if (!!url) {
|
|
||||||
if (!/^(https?:)?\/\//i.test(url)) {
|
if (!/^(https?:)?\/\//i.test(url)) {
|
||||||
url = 'http://' + url;
|
url = 'http://' + url;
|
||||||
}
|
}
|
||||||
@@ -109,7 +108,7 @@ export const formatUrl = (linkStr, config) => {
|
|||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const distance = (p1, p2) =>
|
const distance = (p1, p2) =>
|
||||||
p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
|
p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user