mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 13:59:54 +02:00
Merge pull request #1557 from cmmoran/develop
Render tweak - each diagram should reset the config to siteConfig upon rendering
This commit is contained in:
@@ -29,7 +29,6 @@
|
|||||||
"test": "yarn lint && jest src/.*",
|
"test": "yarn lint && jest src/.*",
|
||||||
"test:watch": "jest --watch src",
|
"test:watch": "jest --watch src",
|
||||||
"prepublishOnly": "yarn build && yarn test && yarn e2e",
|
"prepublishOnly": "yarn build && yarn test && yarn e2e",
|
||||||
"prepush": "yarn test",
|
|
||||||
"prepare": "yarn build"
|
"prepare": "yarn build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -106,5 +105,10 @@
|
|||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"**/*.css",
|
"**/*.css",
|
||||||
"**/*.scss"
|
"**/*.scss"
|
||||||
]
|
],
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-push": "yarn test"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -197,16 +197,20 @@ export const decodeEntities = function(text) {
|
|||||||
* completed.
|
* completed.
|
||||||
*/
|
*/
|
||||||
const render = function(id, _txt, cb, container) {
|
const render = function(id, _txt, cb, container) {
|
||||||
const cnf = getConfig();
|
|
||||||
// Check the maximum allowed text size
|
|
||||||
let txt = _txt;
|
let txt = _txt;
|
||||||
if (_txt.length > cnf.maxTextSize) {
|
|
||||||
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
|
||||||
}
|
|
||||||
const graphInit = utils.detectInit(txt);
|
const graphInit = utils.detectInit(txt);
|
||||||
if (graphInit) {
|
if (graphInit) {
|
||||||
reinitialize(graphInit);
|
reinitialize(graphInit);
|
||||||
assignWithDepth(cnf, getConfig());
|
} else {
|
||||||
|
configApi.reset();
|
||||||
|
const siteConfig = getSiteConfig();
|
||||||
|
updateRendererConfigs(siteConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cnf = getConfig();
|
||||||
|
// Check the maximum allowed text size
|
||||||
|
if (_txt.length > cnf.maxTextSize) {
|
||||||
|
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof container !== 'undefined') {
|
if (typeof container !== 'undefined') {
|
||||||
|
Reference in New Issue
Block a user