Skip to content

Build your personal knowledge base with Trilium Notes

revert(share): show shared code notes as highlighted HTML again

Elian Doranbca0f4d49fc7
diff --git a/packages/share-theme/src/content/note_view.tsx b/packages/share-theme/src/content/note_view.tsx
index 7ffba50da9..f169cd8e08 100644
--- a/packages/share-theme/src/content/note_view.tsx
+++ b/packages/share-theme/src/content/note_view.tsx
@@ -1,8 +1,6 @@
import type FNote from "@triliumnext/client/src/entities/fnote.js";
import { t } from "@triliumnext/client/src/services/i18n.js";
-import {
- type ExtendedNoteType, TYPE_MAPPINGS, type TypeWidget
-} from "@triliumnext/client/src/widgets/note_types.js";
+import { TYPE_MAPPINGS, type TypeWidget } from "@triliumnext/client/src/widgets/note_types.js";
import { useNoteLabel } from "@triliumnext/client/src/widgets/react/hooks.js";
import OverlayControlGroup, {
OverlayControlButton
@@ -31,7 +29,7 @@ export default function mountNoteView(container: HTMLElement, payload: AppPayloa
function NoteView({ note }: { note: FNote }) {
const [ Widget, setWidget ] = useState<TypeWidget>();
- const mapping = TYPE_MAPPINGS[getWidgetType(note)];
+ const mapping = TYPE_MAPPINGS[note.type as keyof typeof TYPE_MAPPINGS];
useEffect(() => {
Promise.resolve(mapping.view()).then((view) => {
@@ -55,18 +53,6 @@ function NoteView({ note }: { note: FNote }) {
);
}
-/**
- * The widget the app shows the note with when it is read-only, as a shared note always is: the
- * read-only editor for code and text, the type's own widget otherwise.
- */
-function getWidgetType(note: FNote): ExtendedNoteType {
- switch (note.type) {
- case "code": return "readOnlyCode";
- case "text": return "readOnlyText";
- default: return note.type as ExtendedNoteType;
- }
-}
-
/** The app's choice of source, split or preview, which a visitor makes for this page only. */
function DisplayModeSwitcher({ note }: { note: FNote }) {
const [ displayMode ] = useNoteLabel(note, "displayMode");
diff --git a/packages/trilium-core/src/share/content_renderer.ts b/packages/trilium-core/src/share/content_renderer.ts
index ee54dc13bd..48b669ff60 100644
--- a/packages/trilium-core/src/share/content_renderer.ts
+++ b/packages/trilium-core/src/share/content_renderer.ts
@@ -488,7 +488,6 @@ export function getContent(note: SNote | BNote, options: ShareRenderOptions = {}
renderMarkdown(result, note);
} else if (note.type === "code") {
renderCode(result, note.mime);
- hostNoteView(result, note);
} else if (note.type === "mermaid") {
renderMermaid(result, note);
hostNoteView(result, note);