Add latest changes from gitlab-org/gitlab@16-1-stable-ee
This commit is contained in:
parent
9b7331ec40
commit
4c6095ca93
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ RSpec.describe 'Sandboxed Mermaid rendering', :js, feature_category: :team_plann
|
|||
MERMAID
|
||||
end
|
||||
|
||||
let_it_be(:expected) do
|
||||
%(<iframe src="/-/sandbox/mermaid" sandbox="allow-scripts allow-popups" frameborder="0" scrolling="no")
|
||||
let(:expected) do
|
||||
src = "http://#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}/-/sandbox/mermaid"
|
||||
%(<iframe src="#{src}" sandbox="allow-scripts allow-popups" frameborder="0" scrolling="no")
|
||||
end
|
||||
|
||||
context 'in an issue' do
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import renderMermaid, {
|
|||
|
||||
describe('Mermaid diagrams renderer', () => {
|
||||
// Finders
|
||||
const findMermaidIframes = () => document.querySelectorAll('iframe[src="/-/sandbox/mermaid"]');
|
||||
const findMermaidIframes = () => document.querySelectorAll('iframe[src*="/-/sandbox/mermaid"]');
|
||||
const findDangerousMermaidAlert = () =>
|
||||
createWrapper(document.querySelector('[data-testid="alert-warning"]'));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue