mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix flowchart text size measuring issue
This commit is contained in:
parent
f8da3c2e48
commit
8b1698b17d
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mermaid",
|
||||
"version": "8.0.0-rc.5",
|
||||
"version": "8.0.0-rc.6",
|
||||
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
||||
"main": "dist/mermaid.core.js",
|
||||
"keywords": [
|
||||
|
@ -351,38 +351,6 @@ const render = function (id, txt, cb, container) {
|
||||
|
||||
const element = d3.select('#d' + id).node()
|
||||
const graphType = utils.detectType(txt)
|
||||
switch (graphType) {
|
||||
case 'git':
|
||||
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
gitGraphRenderer.setConf(config.git)
|
||||
gitGraphRenderer.draw(txt, id, false)
|
||||
break
|
||||
case 'flowchart':
|
||||
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
flowRenderer.setConf(config.flowchart)
|
||||
flowRenderer.draw(txt, id, false)
|
||||
break
|
||||
case 'sequence':
|
||||
config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
if (config.sequenceDiagram) { // backwards compatibility
|
||||
sequenceRenderer.setConf(Object.assign(config.sequence, config.sequenceDiagram))
|
||||
console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.')
|
||||
} else {
|
||||
sequenceRenderer.setConf(config.sequence)
|
||||
}
|
||||
sequenceRenderer.draw(txt, id)
|
||||
break
|
||||
case 'gantt':
|
||||
config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
ganttRenderer.setConf(config.gantt)
|
||||
ganttRenderer.draw(txt, id)
|
||||
break
|
||||
case 'class':
|
||||
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
classRenderer.setConf(config.class)
|
||||
classRenderer.draw(txt, id)
|
||||
break
|
||||
}
|
||||
|
||||
// insert inline style into svg
|
||||
const svg = element.firstChild
|
||||
@ -419,6 +387,39 @@ const render = function (id, txt, cb, container) {
|
||||
}`
|
||||
svg.insertBefore(style2, firstChild)
|
||||
|
||||
switch (graphType) {
|
||||
case 'git':
|
||||
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
gitGraphRenderer.setConf(config.git)
|
||||
gitGraphRenderer.draw(txt, id, false)
|
||||
break
|
||||
case 'flowchart':
|
||||
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
flowRenderer.setConf(config.flowchart)
|
||||
flowRenderer.draw(txt, id, false)
|
||||
break
|
||||
case 'sequence':
|
||||
config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
if (config.sequenceDiagram) { // backwards compatibility
|
||||
sequenceRenderer.setConf(Object.assign(config.sequence, config.sequenceDiagram))
|
||||
console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.')
|
||||
} else {
|
||||
sequenceRenderer.setConf(config.sequence)
|
||||
}
|
||||
sequenceRenderer.draw(txt, id)
|
||||
break
|
||||
case 'gantt':
|
||||
config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
ganttRenderer.setConf(config.gantt)
|
||||
ganttRenderer.draw(txt, id)
|
||||
break
|
||||
case 'class':
|
||||
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute
|
||||
classRenderer.setConf(config.class)
|
||||
classRenderer.draw(txt, id)
|
||||
break
|
||||
}
|
||||
|
||||
d3.select(`[id="${id}"]`).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml')
|
||||
|
||||
let url = ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user