mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 11:29:42 +02:00
Fix style issue of mermaid.js and mermaidAPI.js
This commit is contained in:
@@ -64,12 +64,12 @@ var init = function () {
|
|||||||
}
|
}
|
||||||
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
nodes = nodes === undefined ? document.querySelectorAll('.mermaid')
|
||||||
: typeof nodes === 'string' ? document.querySelectorAll(nodes)
|
: typeof nodes === 'string' ? document.querySelectorAll(nodes)
|
||||||
: nodes instanceof Node ? [nodes]
|
: nodes instanceof window.Node ? [nodes]
|
||||||
: nodes // Last case - sequence config was passed pick next
|
: nodes // Last case - sequence config was passed pick next
|
||||||
|
|
||||||
var i
|
var i
|
||||||
|
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof global.mermaid_config !== 'undefined') {
|
||||||
mermaidAPI.initialize(global.mermaid_config)
|
mermaidAPI.initialize(global.mermaid_config)
|
||||||
}
|
}
|
||||||
log.debug('Start On Load before: ' + global.mermaid.startOnLoad)
|
log.debug('Start On Load before: ' + global.mermaid.startOnLoad)
|
||||||
@@ -204,7 +204,7 @@ exports.parseError = global.mermaid.parseError
|
|||||||
exports.contentLoaded = function () {
|
exports.contentLoaded = function () {
|
||||||
var config
|
var config
|
||||||
// Check state of start config mermaid namespace
|
// Check state of start config mermaid namespace
|
||||||
if (typeof mermaid_config !== 'undefined') {
|
if (typeof global.mermaid_config !== 'undefined') {
|
||||||
if (equals(false, global.mermaid_config.htmlLabels)) {
|
if (equals(false, global.mermaid_config.htmlLabels)) {
|
||||||
global.mermaid.htmlLabels = false
|
global.mermaid.htmlLabels = false
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ var gitGraphRenderer = require('./diagrams/gitGraph/gitGraphRenderer')
|
|||||||
var gitGraphAst = require('./diagrams/gitGraph/gitGraphAst')
|
var gitGraphAst = require('./diagrams/gitGraph/gitGraphAst')
|
||||||
var d3 = require('./d3')
|
var d3 = require('./d3')
|
||||||
|
|
||||||
SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function (toElement) {
|
window.SVGElement.prototype.getTransformToElement = window.SVGElement.prototype.getTransformToElement || function (toElement) {
|
||||||
return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM())
|
return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM())
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -222,15 +222,15 @@ var config = {
|
|||||||
}],
|
}],
|
||||||
// Monday a week
|
// Monday a week
|
||||||
['w. %U', function (d) {
|
['w. %U', function (d) {
|
||||||
return d.getDay() == 1
|
return d.getDay() === 1
|
||||||
}],
|
}],
|
||||||
// Day within a week (not monday)
|
// Day within a week (not monday)
|
||||||
['%a %d', function (d) {
|
['%a %d', function (d) {
|
||||||
return d.getDay() && d.getDate() != 1
|
return d.getDay() && d.getDate() !== 1
|
||||||
}],
|
}],
|
||||||
// within a month
|
// within a month
|
||||||
['%b %d', function (d) {
|
['%b %d', function (d) {
|
||||||
return d.getDate() != 1
|
return d.getDate() !== 1
|
||||||
}],
|
}],
|
||||||
// Month
|
// Month
|
||||||
['%m-%y', function (d) {
|
['%m-%y', function (d) {
|
||||||
@@ -316,7 +316,7 @@ exports.encodeEntities = function (text) {
|
|||||||
return innerTxt
|
return innerTxt
|
||||||
})
|
})
|
||||||
|
|
||||||
txt = txt.replace(/#\w+\;/g, function (s) {
|
txt = txt.replace(/#\w+;/g, function (s) {
|
||||||
var innerTxt = s.substring(1, s.length - 1)
|
var innerTxt = s.substring(1, s.length - 1)
|
||||||
|
|
||||||
var isInt = /^\+?\d+$/.test(innerTxt)
|
var isInt = /^\+?\d+$/.test(innerTxt)
|
||||||
@@ -333,10 +333,10 @@ exports.encodeEntities = function (text) {
|
|||||||
exports.decodeEntities = function (text) {
|
exports.decodeEntities = function (text) {
|
||||||
var txt = text
|
var txt = text
|
||||||
|
|
||||||
txt = txt.replace(/\fl\°\°/g, function () {
|
txt = txt.replace(/fl°°/g, function () {
|
||||||
return '&#'
|
return '&#'
|
||||||
})
|
})
|
||||||
txt = txt.replace(/\fl\°/g, function () {
|
txt = txt.replace(/fl°/g, function () {
|
||||||
return '&'
|
return '&'
|
||||||
})
|
})
|
||||||
txt = txt.replace(/¶ß/g, function () {
|
txt = txt.replace(/¶ß/g, function () {
|
||||||
@@ -380,7 +380,7 @@ var render = function (id, txt, cb, container) {
|
|||||||
.attr('xmlns', 'http://www.w3.org/2000/svg')
|
.attr('xmlns', 'http://www.w3.org/2000/svg')
|
||||||
.append('g')
|
.append('g')
|
||||||
} else {
|
} else {
|
||||||
var element = document.querySelector('#' + 'd' + id)
|
const element = document.querySelector('#' + 'd' + id)
|
||||||
if (element) {
|
if (element) {
|
||||||
element.innerHTML = ''
|
element.innerHTML = ''
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user