Merge branch 'release_9.2.0_buggfixes' into release/9.2.0

This commit is contained in:
Knut Sveidqvist
2022-10-14 15:12:56 +02:00
3 changed files with 12 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@mermaid-js/mermaid-mindmap", "name": "@mermaid-js/mermaid-mindmap",
"version": "9.2.0-rc2", "version": "9.2.0-rc3",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid-mindmap.core.mjs", "main": "dist/mermaid-mindmap.core.mjs",
"module": "dist/mermaid-mindmap.core.mjs", "module": "dist/mermaid-mindmap.core.mjs",

View File

@@ -34,7 +34,7 @@ function drawNodes(svg, mindmap, section, conf) {
* @param cy * @param cy
*/ */
function drawEdges(edgesEl, cy) { function drawEdges(edgesEl, cy) {
cy.edges().map((edge, id) => { cy?.edges().map((edge, id) => {
const data = edge.data(); const data = edge.data();
if (edge[0]._private.bodyBounds) { if (edge[0]._private.bodyBounds) {
const bounds = edge[0]._private.rscratch; const bounds = edge[0]._private.rscratch;
@@ -100,9 +100,10 @@ function addNodes(mindmap, cy, conf, level) {
*/ */
function layoutMindmap(node, conf) { function layoutMindmap(node, conf) {
return new Promise((resolve) => { return new Promise((resolve) => {
if (node.children.length === 0) { // if (node.children.length === 0) {
return node; // resolve(node);
} // return;
// }
// Add temporary render element // Add temporary render element
const renderEl = select('body').append('div').attr('id', 'cy').attr('style', 'display:none'); const renderEl = select('body').append('div').attr('id', 'cy').attr('style', 'display:none');

View File

@@ -35,7 +35,12 @@ export const registerDiagram = (
) => void ) => void
) => { ) => {
if (diagrams[id]) { if (diagrams[id]) {
throw new Error(`Diagram ${id} already registered.`); log.warn(`Diagram ${id} already registered.`);
// The error throw is commented out to as it breaks pages where you have multiple diagrams,
// it can happen that rendering of the same type of diagram is initiated while the previous
// one is still being imported. import deals with this and only one diagram is imported in
// the end.
// throw new Error(`Diagram ${id} already registered.`);
} }
diagrams[id] = diagram; diagrams[id] = diagram;
if (detector) { if (detector) {