mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 09:44:51 +01:00
#1216 Fix for issue when mermaid freezes the browser tab due to large diagrams
This commit is contained in:
39
cypress/platform/huge.html
Normal file
39
cypress/platform/huge.html
Normal file
File diff suppressed because one or more lines are too long
29
src/diagrams/flowchart/parser/flow-huge.spec.js
Normal file
29
src/diagrams/flowchart/parser/flow-huge.spec.js
Normal file
File diff suppressed because one or more lines are too long
@@ -95,6 +95,8 @@ const config = {
|
|||||||
*/
|
*/
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
themeCSS: undefined,
|
themeCSS: undefined,
|
||||||
|
/* **maxTextSize** - The maximum allowed size of the users text diamgram */
|
||||||
|
maxTextSize: 50000,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **fontFamily** The font to be used for the rendered diagrams. Default value is \"trebuchet ms\", verdana, arial;
|
* **fontFamily** The font to be used for the rendered diagrams. Default value is \"trebuchet ms\", verdana, arial;
|
||||||
@@ -460,7 +462,13 @@ export const decodeEntities = function(text) {
|
|||||||
* provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
|
* provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
|
||||||
* completed.
|
* completed.
|
||||||
*/
|
*/
|
||||||
const render = function(id, txt, cb, container) {
|
const render = function(id, _txt, cb, container) {
|
||||||
|
// Check the maximum allowed text size
|
||||||
|
let txt = _txt;
|
||||||
|
if (_txt.length > config.maxTextSize) {
|
||||||
|
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof container !== 'undefined') {
|
if (typeof container !== 'undefined') {
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user