mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-07 01:26:42 +02:00
fix not rendered style when style is optional
This commit is contained in:
@@ -7,7 +7,6 @@ import { addStylesForDiagram } from '../styles.js';
|
||||
import { DiagramDefinition, DiagramDetector } from './types.js';
|
||||
import * as _commonDb from '../commonDb.js';
|
||||
import { parseDirective as _parseDirective } from '../directiveUtils.js';
|
||||
import isEmpty from 'lodash-es/isEmpty.js';
|
||||
|
||||
/*
|
||||
Packaging and exposing resources for external diagrams so that they can import
|
||||
@@ -51,9 +50,7 @@ export const registerDiagram = (
|
||||
if (detector) {
|
||||
addDetector(id, detector);
|
||||
}
|
||||
if (!isEmpty(diagram.styles)) {
|
||||
addStylesForDiagram(id, diagram.styles);
|
||||
}
|
||||
addStylesForDiagram(id, diagram.styles);
|
||||
|
||||
if (diagram.injectUtils) {
|
||||
diagram.injectUtils(
|
||||
|
@@ -73,8 +73,10 @@ const getStyles = (
|
||||
`;
|
||||
};
|
||||
|
||||
export const addStylesForDiagram = (type: string, diagramTheme: unknown): void => {
|
||||
themes[type] = diagramTheme;
|
||||
export const addStylesForDiagram = (type: string, diagramTheme?: unknown): void => {
|
||||
if (diagramTheme !== undefined) {
|
||||
themes[type] = diagramTheme;
|
||||
}
|
||||
};
|
||||
|
||||
export default getStyles;
|
||||
|
Reference in New Issue
Block a user