mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 09:44:51 +01:00
fix: handling diagram width in sandbox mode
This commit is contained in:
@@ -6,7 +6,9 @@ import intersect from './intersect/index.js';
|
||||
import createLabel from './createLabel';
|
||||
import note from './shapes/note';
|
||||
import { parseMember } from '../diagrams/class/svgDraw';
|
||||
import { evaluate } from '../diagrams/common/common';
|
||||
import { evaluate, sanitizeText as sanitize } from '../diagrams/common/common';
|
||||
|
||||
const sanitizeText = (txt) => sanitize(txt, getConfig());
|
||||
|
||||
const question = (parent, node) => {
|
||||
const { shapeSvg, bbox } = labelHelper(parent, node, undefined, true);
|
||||
|
||||
@@ -216,7 +216,7 @@ export const setLink = function (ids, linkStr, target) {
|
||||
if (config.securityLevel === 'sandbox') {
|
||||
classes[id].linkTarget = '_top';
|
||||
} else if (typeof target === 'string') {
|
||||
classes[id].linkTarget = target;
|
||||
classes[id].linkTarget = sanitizeText(target);
|
||||
} else {
|
||||
classes[id].linkTarget = '_blank';
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ const render = function (id, _txt, cb, container) {
|
||||
let width = '100%';
|
||||
let height = '100%';
|
||||
if (svgEl) {
|
||||
width = svgEl.viewBox.baseVal.width + 'px';
|
||||
// width = svgEl.viewBox.baseVal.width + 'px';
|
||||
height = svgEl.viewBox.baseVal.height + 'px';
|
||||
}
|
||||
svgCode = `<iframe style="width:${width};height:${height};border:0;margin:0;" src="data:text/html;base64,${btoa(
|
||||
|
||||
Reference in New Issue
Block a user