Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(touch_bar): move geomap to parent typewidget
Elian Doran323f42873f10
diff --git a/src/public/app/widgets/geo_map.ts b/src/public/app/widgets/geo_map.tsindex 76ff7d0eb2..b9f14c3eff 100644--- a/src/public/app/widgets/geo_map.ts+++ b/src/public/app/widgets/geo_map.ts@@ -1,7 +1,6 @@import type { Map } from "leaflet";import library_loader from "../services/library_loader.js";import NoteContextAwareWidget from "./note_context_aware_widget.js";-import type { CommandListenerData } from "../components/app_context.js";const TPL = `\<div class="geo-map-widget">@@ -62,27 +61,4 @@ export default class GeoMapWidget extends NoteContextAwareWidget {});}- buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) {- const map = this.map;- if (!map) {- return;- }-- return [- new TouchBar.TouchBarSlider({- label: "Zoom",- value: map.getZoom(),- minValue: map.getMinZoom(),- maxValue: map.getMaxZoom(),- change(newValue) {- map.setZoom(newValue);- },- }),- new TouchBar.TouchBarButton({- label: "New geo note",- click: () => this.parent?.triggerEvent("geoMapCreateChildNote", { ntxId: this.ntxId })- })- ];- }-}diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.tsindex dddccbac82..9c86bbf486 100644--- a/src/public/app/widgets/type_widgets/geo_map.ts+++ b/src/public/app/widgets/type_widgets/geo_map.ts@@ -5,7 +5,7 @@ import TypeWidget from "./type_widget.js";import server from "../../services/server.js";import toastService from "../../services/toast.js";import dialogService from "../../services/dialog.js";-import type { EventData } from "../../components/app_context.js";+import type { CommandListenerData, EventData } from "../../components/app_context.js";import { t } from "../../services/i18n.js";import attributes from "../../services/attributes.js";import asset_path from "../../../../services/asset_path.js";@@ -381,4 +381,27 @@ export default class GeoMapTypeWidget extends TypeWidget {this.moveMarker(noteId, null);}+ buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) {+ const map = this.geoMapWidget.map;+ if (!map) {+ return;+ }++ return [+ new TouchBar.TouchBarSlider({+ label: "Zoom",+ value: map.getZoom(),+ minValue: map.getMinZoom(),+ maxValue: map.getMaxZoom(),+ change(newValue) {+ map.setZoom(newValue);+ },+ }),+ new TouchBar.TouchBarButton({+ label: "New geo note",+ click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId })+ })+ ];+ }+}