diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-03 16:48:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-03 16:48:23 +0300 |
commit | 4c6095ca9375c4b88dafc35ca064ab8a21771d6c (patch) | |
tree | a1c1628d6c9a9c58e6206fc8306bba2a79e27db9 /app/assets | |
parent | 9b7331ec40066a8edfc3452ec6658aad89b56126 (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-ee
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js | 11 | ||||
-rw-r--r-- | app/assets/javascripts/lib/mermaid.js | 7 |
2 files changed, 14 insertions, 4 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js index bd9e41ac0ba..22e9b2b9709 100644 --- a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js +++ b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js @@ -72,11 +72,14 @@ function fixElementSource(el) { export function getSandboxFrameSrc() { const path = joinPaths(gon.relative_url_root || '', SANDBOX_FRAME_PATH); - if (!darkModeEnabled()) { - return path; + let absoluteUrl = relativePathToAbsolute(path, getBaseURL()); + if (darkModeEnabled()) { + absoluteUrl = setUrlParams({ darkMode: darkModeEnabled() }, absoluteUrl); } - const absoluteUrl = relativePathToAbsolute(path, getBaseURL()); - return setUrlParams({ darkMode: darkModeEnabled() }, absoluteUrl); + if (window.gon?.relative_url_root) { + absoluteUrl = setUrlParams({ relativeRootPath: window.gon.relative_url_root }, absoluteUrl); + } + return absoluteUrl; } function renderMermaidEl(el, source) { diff --git a/app/assets/javascripts/lib/mermaid.js b/app/assets/javascripts/lib/mermaid.js index bbc1d8ae1e1..5e62a023777 100644 --- a/app/assets/javascripts/lib/mermaid.js +++ b/app/assets/javascripts/lib/mermaid.js @@ -1,6 +1,13 @@ import mermaid from 'mermaid'; import { getParameterByName } from '~/lib/utils/url_utility'; +import { resetServiceWorkersPublicPath } from '~/lib/utils/webpack'; +const resetWebpackPublicPath = () => { + window.gon = { relative_url_root: getParameterByName('relativeRootPath') }; + resetServiceWorkersPublicPath(); +}; + +resetWebpackPublicPath(); const setIframeRenderedSize = (h, w) => { const { origin } = window.location; window.parent.postMessage({ h, w }, origin); |