refactor(client/ts): start implementing experimental split type view for mermaid

This commit is contained in:
Elian Doran
2025-03-21 21:42:10 +02:00
parent 7a16774cdc
commit 56da5f7761
3 changed files with 69 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ import GeoMapTypeWidget from "./type_widgets/geo_map.js";
import utils from "../services/utils.js";
import type { NoteType } from "../entities/fnote.js";
import type TypeWidget from "./type_widgets/type_widget.js";
import { MermaidTypeWidget } from "./type_widgets/mermaid.js";
const TPL = `
<div class="note-detail">
@@ -72,7 +73,10 @@ const typeWidgetClasses = {
attachmentDetail: AttachmentDetailTypeWidget,
attachmentList: AttachmentListTypeWidget,
mindMap: MindMapWidget,
geoMap: GeoMapTypeWidget
geoMap: GeoMapTypeWidget,
// Split type editors
mermaid: MermaidTypeWidget
};
/**
@@ -80,7 +84,7 @@ const typeWidgetClasses = {
* for protected session or attachment information.
*/
type ExtendedNoteType =
| Exclude<NoteType, "mermaid" | "launcher" | "text" | "code">
| Exclude<NoteType, "launcher" | "text" | "code">
| "empty"
| "readOnlyCode"
| "readOnlyText"
@@ -230,7 +234,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
resultingType = "readOnlyCode";
} else if (type === "text") {
resultingType = "editableText";
} else if (type === "code" || type === "mermaid") {
} else if (type === "code") {
resultingType = "editableCode";
} else if (type === "launcher") {
resultingType = "doc";