Commit 9680b880 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'djadmin-fix-sandbox-styling' into 'master'

Fix styling issues for mermaid diagrams

See merge request gitlab-org/gitlab!78040
parents 5079f1c7 3ea41f64
...@@ -31,6 +31,7 @@ const MAX_CHAR_LIMIT = 2000; ...@@ -31,6 +31,7 @@ const MAX_CHAR_LIMIT = 2000;
const MAX_MERMAID_BLOCK_LIMIT = 50; const MAX_MERMAID_BLOCK_LIMIT = 50;
// Max # of `&` allowed in Chaining of links syntax // Max # of `&` allowed in Chaining of links syntax
const MAX_CHAINING_OF_LINKS_LIMIT = 30; const MAX_CHAINING_OF_LINKS_LIMIT = 30;
const BUFFER_IFRAME_HEIGHT = 10;
// Keep a map of mermaid blocks we've already rendered. // Keep a map of mermaid blocks we've already rendered.
const elsProcessingMap = new WeakMap(); const elsProcessingMap = new WeakMap();
let renderedMermaidBlocks = 0; let renderedMermaidBlocks = 0;
...@@ -117,9 +118,9 @@ function renderMermaidEl(el, source) { ...@@ -117,9 +118,9 @@ function renderMermaidEl(el, source) {
if (event.origin !== 'null' || event.source !== iframeEl.contentWindow) { if (event.origin !== 'null' || event.source !== iframeEl.contentWindow) {
return; return;
} }
const { h, w } = event.data; const { h } = event.data;
iframeEl.width = w; iframeEl.width = '100%';
iframeEl.height = h; iframeEl.height = `${h + BUFFER_IFRAME_HEIGHT}px`;
}, },
false, false,
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment