mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-23 05:42:33 +09:00
Fix various problems (#37077)
Quick fix for 1.26. * Slightly refactor NewComment to fix incorrect responses, remove incorrect defer (still far from ideal) * Avoid `const` causes js error in global scope * Don't process markup contents on user's home activity feed, to avoid js error due to broken math/mermaid code * Fix #36582 --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -6,10 +6,20 @@ import {initMarkupTasklist} from './tasklist.ts';
|
||||
import {registerGlobalSelectorFunc} from '../modules/observer.ts';
|
||||
import {initMarkupRenderIframe} from './render-iframe.ts';
|
||||
import {initMarkupRefIssue} from './refissue.ts';
|
||||
import {toggleElemClass} from '../utils/dom.ts';
|
||||
|
||||
// code that runs for all markup content
|
||||
export function initMarkupContent(): void {
|
||||
registerGlobalSelectorFunc('.markup', (el: HTMLElement) => {
|
||||
if (el.matches('.truncated-markup')) {
|
||||
// when the rendered markup is truncated (e.g.: user's home activity feed)
|
||||
// we should not initialize any of the features (e.g.: code copy button), due to:
|
||||
// * truncated markup already means that the container doesn't want to show complex contents
|
||||
// * truncated markup may contain incomplete HTML/mermaid elements
|
||||
// so the only thing we need to do is to remove the "is-loading" class added by the backend render.
|
||||
toggleElemClass(el.querySelectorAll('.is-loading'), 'is-loading', false);
|
||||
return;
|
||||
}
|
||||
initMarkupCodeCopy(el);
|
||||
initMarkupTasklist(el);
|
||||
initMarkupCodeMermaid(el);
|
||||
|
||||
Reference in New Issue
Block a user