client: Create blank type widget for mind map

This commit is contained in:
Elian Doran 2024-09-01 14:16:45 +03:00
parent 945bc7ded3
commit e39dd1525d
No known key found for this signature in database
5 changed files with 39 additions and 3 deletions

View File

@ -22,7 +22,8 @@ const NOTE_TYPE_ICONS = {
"webView": "bx bx-globe-alt",
"launcher": "bx bx-link",
"doc": "bx bxs-file-doc",
"contentWidget": "bx bxs-widget"
"contentWidget": "bx bxs-widget",
"mindMap": "bx bx-sitemap"
};
/**

View File

@ -13,6 +13,7 @@ async function getNoteTypeItems(command) {
{ title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" },
{ title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" },
{ title: "Web View", command: command, type: "webView", uiIcon: "bx bx-globe-alt" },
{ title: "Mind Map", command, type: "mindMap", uiIcon: "bx bx-sitemap" }
];
const templateNoteIds = await server.get("search-templates");

View File

@ -28,6 +28,7 @@ import DocTypeWidget from "./type_widgets/doc.js";
import ContentWidgetTypeWidget from "./type_widgets/content_widget.js";
import AttachmentListTypeWidget from "./type_widgets/attachment_list.js";
import AttachmentDetailTypeWidget from "./type_widgets/attachment_detail.js";
import MindMapWidget from "./type_widgets/mind_map.js";
const TPL = `
<div class="note-detail">
@ -63,7 +64,8 @@ const typeWidgetClasses = {
'doc': DocTypeWidget,
'contentWidget': ContentWidgetTypeWidget,
'attachmentDetail': AttachmentDetailTypeWidget,
'attachmentList': AttachmentListTypeWidget
'attachmentList': AttachmentListTypeWidget,
'mindMap': MindMapWidget
};
export default class NoteDetailWidget extends NoteContextAwareWidget {

View File

@ -0,0 +1,31 @@
import TypeWidget from "./type_widget.js";
const TPL = `
<div class="note-detail-mind-map note-detail-printable">
</div>
`;
export default class MindMapWidget extends TypeWidget {
static getType() { return "mindMap"; }
doRender() {
this.$widget = $(TPL);
super.doRender();
}
async doRefresh(note) {
this.$widget.html("<p>Hello</p>");
this.$widget.show();
}
cleanup() {
this.$widget.empty();
}
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
}
}

View File

@ -13,7 +13,8 @@ const noteTypes = [
{ type: 'webView', defaultMime: '' },
{ type: 'launcher', defaultMime: '' },
{ type: 'doc', defaultMime: '' },
{ type: 'contentWidget', defaultMime: '' }
{ type: 'contentWidget', defaultMime: '' },
{ type: 'mindMap', defaultMime: 'application/json' }
];
function getDefaultMimeForNoteType(typeName: string) {