aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/markup/content.ts
diff options
context:
space:
mode:
authorKerwin Bryant <kerwin612@qq.com>2025-03-04 03:49:15 +0800
committerGitHub <noreply@github.com>2025-03-03 11:49:15 -0800
commitf0f1737d4d533e06f482a63ff995ae79cc1c89dc (patch)
tree5b60a1b158cbbc50cb6ef9a88a2f932eaf17dee4 /web_src/js/markup/content.ts
parent43c8d85f19e14e695eb129a8ff71bd106430b016 (diff)
downloadgitea-f0f1737d4d533e06f482a63ff995ae79cc1c89dc.tar.gz
gitea-f0f1737d4d533e06f482a63ff995ae79cc1c89dc.zip
Refactor markup and pdf-viewer to use new init framework (#33772)
1. Add some "render-content" classes to "markup" elements when the content is rendered 2. Use correct "markup" wrapper for "preview" (but not set that class on the tab) 3. Remove incorrect "markup" class from LFS file view, because there is no markup content * "edit-diff" is also removed because it does nothing 5. Use "initPdfViewer" for PDF viewer 6. Remove incorrect "content" class from milestone markup 7. Init all ".markup" elements by new init framework --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/js/markup/content.ts')
-rw-r--r--web_src/js/markup/content.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/web_src/js/markup/content.ts b/web_src/js/markup/content.ts
index b9190b15ce..55db4aa810 100644
--- a/web_src/js/markup/content.ts
+++ b/web_src/js/markup/content.ts
@@ -1,18 +1,17 @@
-import {renderMermaid} from './mermaid.ts';
-import {renderMath} from './math.ts';
-import {renderCodeCopy} from './codecopy.ts';
-import {renderAsciicast} from './asciicast.ts';
+import {initMarkupCodeMermaid} from './mermaid.ts';
+import {initMarkupCodeMath} from './math.ts';
+import {initMarkupCodeCopy} from './codecopy.ts';
+import {initMarkupRenderAsciicast} from './asciicast.ts';
import {initMarkupTasklist} from './tasklist.ts';
+import {registerGlobalSelectorFunc} from '../modules/observer.ts';
// code that runs for all markup content
export function initMarkupContent(): void {
- renderMermaid();
- renderMath();
- renderCodeCopy();
- renderAsciicast();
-}
-
-// code that only runs for comments
-export function initCommentContent(): void {
- initMarkupTasklist();
+ registerGlobalSelectorFunc('.markup', (el: HTMLElement) => {
+ initMarkupCodeCopy(el);
+ initMarkupTasklist(el);
+ initMarkupCodeMermaid(el);
+ initMarkupCodeMath(el);
+ initMarkupRenderAsciicast(el);
+ });
}