From 7fdef3418a3023f8048a1b9fc010e6d621ad8243 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 22 Jul 2025 19:54:01 +0300 Subject: [PATCH] refactor(share): check note type --- apps/client/src/share.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/client/src/share.ts b/apps/client/src/share.ts index a1e348336..692f9f5dd 100644 --- a/apps/client/src/share.ts +++ b/apps/client/src/share.ts @@ -47,8 +47,12 @@ async function fetchNote(noteId: string | null = null) { document.addEventListener( "DOMContentLoaded", () => { - formatCodeBlocks(); - applyMath(); + const noteType = determineNoteType(); + + if (noteType === "text") { + formatCodeBlocks(); + applyMath(); + } const toggleMenuButton = document.getElementById("toggleMenuButton"); const layout = document.getElementById("layout"); @@ -60,6 +64,12 @@ document.addEventListener( false ); +function determineNoteType() { + const bodyClass = document.body.className; + const match = bodyClass.match(/type-([^\s]+)/); + return match ? match[1] : null; +} + // workaround to prevent webpack from removing "fetchNote" as dead code: // add fetchNote as property to the window object Object.defineProperty(window, "fetchNote", {