diff --git a/apps/client/src/widgets/ribbon/NoteMapTab.tsx b/apps/client/src/widgets/ribbon/NoteMapTab.tsx
new file mode 100644
index 000000000..e9e8b3436
--- /dev/null
+++ b/apps/client/src/widgets/ribbon/NoteMapTab.tsx
@@ -0,0 +1,16 @@
+import { TabContext } from "./ribbon-interface";
+import NoteMapWidget from "../note_map";
+import { useLegacyWidget } from "../react/hooks";
+
+export default function NoteMapTab({ note, noteContext }: TabContext) {
+ const noteMapWidget = useLegacyWidget(() => new NoteMapWidget("ribbon"), {
+ noteContext,
+ containerClassName: "note-map-container"
+ });
+
+ return (
+
+ {noteMapWidget}
+
+ );
+}
\ No newline at end of file
diff --git a/apps/client/src/widgets/ribbon/Ribbon.tsx b/apps/client/src/widgets/ribbon/Ribbon.tsx
index e14ae45c8..4702dcf07 100644
--- a/apps/client/src/widgets/ribbon/Ribbon.tsx
+++ b/apps/client/src/widgets/ribbon/Ribbon.tsx
@@ -18,6 +18,7 @@ import SimilarNotesTab from "./SimilarNotesTab";
import FilePropertiesTab from "./FilePropertiesTab";
import ImagePropertiesTab from "./ImagePropertiesTab";
import NotePathsTab from "./NotePathsTab";
+import NoteMapTab from "./NoteMapTab";
interface TitleContext {
note: FNote | null | undefined;
@@ -121,9 +122,11 @@ const TAB_CONFIGURATION = numberObjectsInPlace([
toggleCommand: "toggleRibbonTabNotePaths"
},
{
- // NoteMapRibbonWidget
title: t("note_map.title"),
- icon: "bx bxs-network-chart"
+ icon: "bx bxs-network-chart",
+ content: NoteMapTab,
+ show: true,
+ toggleCommand: "toggleRibbonTabNoteMap"
},
{
title: t("similar_notes.title"),
@@ -142,7 +145,7 @@ const TAB_CONFIGURATION = numberObjectsInPlace([
]);
export default function Ribbon() {
- const { note, ntxId, hoistedNoteId, notePath } = useNoteContext();
+ const { note, ntxId, hoistedNoteId, notePath, noteContext } = useNoteContext();
const titleContext: TitleContext = { note };
const [ activeTabIndex, setActiveTabIndex ] = useState();
const filteredTabs = useMemo(() => TAB_CONFIGURATION.filter(tab => typeof tab.show === "boolean" ? tab.show : tab.show?.(titleContext)), [ titleContext, note ]);
@@ -183,7 +186,8 @@ export default function Ribbon() {
hidden: !isActive,
ntxId,
hoistedNoteId,
- notePath
+ notePath,
+ noteContext
});
})}
diff --git a/apps/client/src/widgets/ribbon/ribbon-interface.ts b/apps/client/src/widgets/ribbon/ribbon-interface.ts
index 6fa15edc5..e7fcc4a75 100644
--- a/apps/client/src/widgets/ribbon/ribbon-interface.ts
+++ b/apps/client/src/widgets/ribbon/ribbon-interface.ts
@@ -1,3 +1,4 @@
+import NoteContext from "../../components/note_context";
import FNote from "../../entities/fnote";
export interface TabContext {
@@ -6,4 +7,5 @@ export interface TabContext {
ntxId?: string | null;
hoistedNoteId?: string;
notePath?: string | null;
+ noteContext?: NoteContext;
}
diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.css
index dee220bf6..c70463659 100644
--- a/apps/client/src/widgets/ribbon/style.css
+++ b/apps/client/src/widgets/ribbon/style.css
@@ -245,4 +245,26 @@
.note-path-list .path-search a {
font-style: italic;
}
+/* #endregion */
+
+/* #region Note map */
+.note-map-ribbon-widget {
+ position: relative;
+}
+
+.note-map-ribbon-widget .note-map-container {
+ height: 300px;
+}
+
+.note-map-ribbon-widget .open-full-button, .note-map-ribbon-widget .collapse-button {
+ position: absolute;
+ right: 5px;
+ bottom: 5px;
+ z-index: 1000;
+}
+
+.style-resolver {
+ color: var(--muted-text-color);
+ display: none;
+}
/* #endregion */
\ No newline at end of file
diff --git a/apps/client/src/widgets/ribbon_widgets/note_map.ts b/apps/client/src/widgets/ribbon_widgets/note_map.ts
index 574e44dc2..fe7a65479 100644
--- a/apps/client/src/widgets/ribbon_widgets/note_map.ts
+++ b/apps/client/src/widgets/ribbon_widgets/note_map.ts
@@ -3,63 +3,20 @@ import NoteMapWidget from "../note_map.js";
import { t } from "../../services/i18n.js";
const TPL = /*html*/`
-`;
export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
private openState!: "small" | "full";
- private noteMapWidget: NoteMapWidget;
private $container!: JQuery;
private $openFullButton!: JQuery;
private $collapseButton!: JQuery;
- constructor() {
- super();
-
- this.noteMapWidget = new NoteMapWidget("ribbon");
- this.child(this.noteMapWidget);
- }
-
- get name() {
- return "noteMap";
- }
-
- get toggleCommand() {
- return "toggleRibbonTabNoteMap";
- }
-
- getTitle() {
- return {
- show: this.isEnabled()
- };
- }
doRender() {
this.$widget = $(TPL);