feat: add support for links in sanbox mode

This commit is contained in:
Knut Sveidqvist
2022-01-28 14:45:43 +01:00
parent e3e9c67f5b
commit fa55b7c824
8 changed files with 138 additions and 32 deletions

View File

@@ -213,7 +213,9 @@ export const setLink = function (ids, linkStr, target) {
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
if (typeof classes[id] !== 'undefined') {
classes[id].link = utils.formatUrl(linkStr, config);
if (typeof target === 'string') {
if (config.securityLevel === 'sandbox') {
classes[id].linkTarget = '_top';
} else if (typeof target === 'string') {
classes[id].linkTarget = target;
} else {
classes[id].linkTarget = '_blank';