mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
fix: Create a copy of config passed in initialize, so that theme variables are not leaked to the object
This commit is contained in:
@@ -25,6 +25,7 @@ import { preprocessDiagram } from './preprocess.js';
|
|||||||
import { decodeEntities } from './utils.js';
|
import { decodeEntities } from './utils.js';
|
||||||
import { toBase64 } from './utils/base64.js';
|
import { toBase64 } from './utils/base64.js';
|
||||||
import type { D3Element, ParseOptions, ParseResult, RenderResult } from './types.js';
|
import type { D3Element, ParseOptions, ParseResult, RenderResult } from './types.js';
|
||||||
|
import assignWithDepth from './assignWithDepth.js';
|
||||||
|
|
||||||
const MAX_TEXTLENGTH = 50_000;
|
const MAX_TEXTLENGTH = 50_000;
|
||||||
const MAX_TEXTLENGTH_EXCEEDED_MSG =
|
const MAX_TEXTLENGTH_EXCEEDED_MSG =
|
||||||
@@ -473,9 +474,10 @@ const render = async function (
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param options - Initial Mermaid options
|
* @param userOptions - Initial Mermaid options
|
||||||
*/
|
*/
|
||||||
function initialize(options: MermaidConfig = {}) {
|
function initialize(userOptions: MermaidConfig = {}) {
|
||||||
|
const options = assignWithDepth({}, userOptions);
|
||||||
// Handle legacy location of font-family configuration
|
// Handle legacy location of font-family configuration
|
||||||
if (options?.fontFamily && !options.themeVariables?.fontFamily) {
|
if (options?.fontFamily && !options.themeVariables?.fontFamily) {
|
||||||
if (!options.themeVariables) {
|
if (!options.themeVariables) {
|
||||||
|
Reference in New Issue
Block a user