mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 03:35:55 +01:00
Fix mermaid-related bugs (#21431)
This commit is contained in:
parent
8e8b536c29
commit
32159cc4a3
4
web_src/js/bootstrap.js
vendored
4
web_src/js/bootstrap.js
vendored
@ -25,6 +25,10 @@ function processWindowErrorEvent(e) {
|
|||||||
// If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0.
|
// If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0.
|
||||||
return; // ignore such nonsense error event
|
return; // ignore such nonsense error event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for upstream fix: https://github.com/microsoft/monaco-editor/issues/2962
|
||||||
|
if (e.message.includes('Language id "vs.editor.nullLanguage" is not configured nor known')) return;
|
||||||
|
|
||||||
showGlobalErrorMessage(`JavaScript error: ${e.message} (${e.filename} @ ${e.lineno}:${e.colno}). Open browser console to see more details.`);
|
showGlobalErrorMessage(`JavaScript error: ${e.message} (${e.filename} @ ${e.lineno}:${e.colno}). Open browser console to see more details.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export async function renderMermaid() {
|
|||||||
// can't use bindFunctions here because we can't cross the iframe boundary. This
|
// can't use bindFunctions here because we can't cross the iframe boundary. This
|
||||||
// means js-based interactions won't work but they aren't intended to work either
|
// means js-based interactions won't work but they aren't intended to work either
|
||||||
mermaid.mermaidAPI.render('mermaid', source, (svgStr) => {
|
mermaid.mermaidAPI.render('mermaid', source, (svgStr) => {
|
||||||
const heightStr = (svgStr.match(/height="(.+?)"/) || [])[1];
|
const heightStr = (svgStr.match(/viewBox="(.+?)"/) || ['', ''])[1].split(/\s+/)[3];
|
||||||
if (!heightStr) return displayError(el, new Error('Could not determine chart height'));
|
if (!heightStr) return displayError(el, new Error('Could not determine chart height'));
|
||||||
const iframe = document.createElement('iframe');
|
const iframe = document.createElement('iframe');
|
||||||
iframe.classList.add('markup-render');
|
iframe.classList.add('markup-render');
|
||||||
|
Loading…
Reference in New Issue
Block a user