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
feat(touch_bar): reflect new note state
Elian Dorana3c58834d1f7
diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.tsindex b68b2c09ca..5ada5c7f53 100644--- a/src/public/app/widgets/type_widgets/geo_map.ts+++ b/src/public/app/widgets/type_widgets/geo_map.ts@@ -280,6 +280,7 @@ export default class GeoMapTypeWidget extends TypeWidget {#changeState(newState: State) {this._state = newState;this.geoMapWidget.$container.toggleClass("placing-note", newState === State.NewNote);+ this.triggerCommand("refreshTouchBar");}async #onMapClicked(e: LeafletMouseEvent) {@@ -396,22 +397,31 @@ export default class GeoMapTypeWidget extends TypeWidget {return;}- return [- new TouchBar.TouchBarSlider({- label: "Zoom",- value: map.getZoom(),- minValue: map.getMinZoom(),- maxValue: map.getMaxZoom(),- change(newValue) {- that.ignoreNextZoomEvent = true;- map.setZoom(newValue);- },- }),- new TouchBar.TouchBarButton({- label: "New geo note",- click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId })- })- ];+ switch (this._state) {+ case State.Normal:+ return [+ new TouchBar.TouchBarSlider({+ label: "Zoom",+ value: map.getZoom(),+ minValue: map.getMinZoom(),+ maxValue: map.getMaxZoom(),+ change(newValue) {+ that.ignoreNextZoomEvent = true;+ map.setZoom(newValue);+ },+ }),+ new TouchBar.TouchBarButton({+ label: "New geo note",+ click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId })+ })+ ];++ case State.NewNote:+ return [+ new TouchBar.TouchBarSpacer({ size: "flexible" }),+ new TouchBar.TouchBarLabel({ label: "New note" })+ ]+ }}}