feat(geomap): add floating button section

This commit is contained in:
Elian Doran 2025-01-20 22:39:48 +02:00
parent 4d5e04fc5a
commit f803b9f822
No known key found for this signature in database
4 changed files with 51 additions and 2 deletions

View File

@ -36,7 +36,7 @@ const NOTE_TYPE_ICONS = {
* end user. Those types should be used only for checking against, they are * end user. Those types should be used only for checking against, they are
* not for direct use. * not for direct use.
*/ */
type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap"; type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap" | "geoMap";
interface NotePathRecord { interface NotePathRecord {
isArchived: boolean; isArchived: boolean;

View File

@ -85,6 +85,7 @@ import ScrollPaddingWidget from "../widgets/scroll_padding.js";
import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js"; import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js";
import options from "../services/options.js"; import options from "../services/options.js";
import utils from "../services/utils.js"; import utils from "../services/utils.js";
import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js";
export default class DesktopLayout { export default class DesktopLayout {
constructor(customWidgets) { constructor(customWidgets) {
@ -200,6 +201,7 @@ export default class DesktopLayout {
.child(new ShowHighlightsListWidgetButton()) .child(new ShowHighlightsListWidgetButton())
.child(new CodeButtonsWidget()) .child(new CodeButtonsWidget())
.child(new RelationMapButtons()) .child(new RelationMapButtons())
.child(new GeoMapButtons())
.child(new CopyImageReferenceButton()) .child(new CopyImageReferenceButton())
.child(new SvgExportButton()) .child(new SvgExportButton())
.child(new BacklinksWidget()) .child(new BacklinksWidget())

View File

@ -0,0 +1,40 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js"
const TPL = `\
<div class="geo-map-buttons">
<style>
.geo-map-buttons {
display: flex;
gap: 10px;
}
.leaflet-pane {
z-index: 50;
}
.geo-map-buttons {
contain: none;
background: var(--main-background-color);
box-shadow: 0px 10px 20px rgba(0, 0, 0, var(--dropdown-shadow-opacity));
border-radius: 4px;
}
</style>
<button type="button"
class="geo-map-create-child-note floating-button btn bx bx-folder-plus"
title="Create new child note and add it to the map" />
</div>`;
export default class GeoMapButtons extends NoteContextAwareWidget {
isEnabled() {
return super.isEnabled() && this.note?.type === "geoMap";
}
doRender() {
super.doRender();
this.$widget = $(TPL);
}
}

View File

@ -3,7 +3,14 @@ import type FNote from "../../entities/fnote.js";
import GeoMapWidget from "../geo_map.js"; import GeoMapWidget from "../geo_map.js";
import TypeWidget from "./type_widget.js" import TypeWidget from "./type_widget.js"
const TPL = `<div class="note-detail-geo-map note-detail-printable"></div>`; const TPL = `\
<div class="note-detail-geo-map note-detail-printable">
<style>
.leaflet-pane {
z-index: 1;
}
</style>
</div>`;
interface MapData { interface MapData {
view?: { view?: {