From 6531040f9d12356f47e13200e7ee0dc5c1eb24c2 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Mon, 24 May 2021 18:23:35 +0100 Subject: [PATCH] Allow customisation of context menu text --- index.html | 2 ++ src/api.ts | 2 ++ src/components/map/MapContextMenu.vue | 18 ++++++++++++++---- src/index.d.ts | 2 ++ src/store/state.ts | 2 ++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 35285d5..5646e47 100644 --- a/index.html +++ b/index.html @@ -106,6 +106,8 @@ loadingTitle: 'Loading...', locationRegion: 'Region', locationChunk: 'Chunk', + contextMenuCopyLink: 'Copy link to here', + contextMenuCenterHere: 'Center here', } }; diff --git a/src/api.ts b/src/api.ts index 4140015..d381c38 100644 --- a/src/api.ts +++ b/src/api.ts @@ -93,6 +93,8 @@ function buildMessagesConfig(response: any): LiveAtlasMessageConfig { loadingTitle: liveAtlasMessages.loadingTitle || '', locationRegion: liveAtlasMessages.locationRegion || '', locationChunk: liveAtlasMessages.locationChunk || '', + contextMenuCopyLink: liveAtlasMessages.contextMenuCopyLink || '', + contextMenuCenterHere: liveAtlasMessages.contextMenuCenterHere || '', } } diff --git a/src/components/map/MapContextMenu.vue b/src/components/map/MapContextMenu.vue index ceb43f4..1fed8cf 100644 --- a/src/components/map/MapContextMenu.vue +++ b/src/components/map/MapContextMenu.vue @@ -2,10 +2,14 @@ @@ -32,7 +36,10 @@ export default defineComponent({ setup(props) { const store = useStore(), - event = ref(null), + event = ref(null), + + messageCopyLink = computed(() => store.state.messages.contextMenuCopyLink), + messageCenterHere = computed(() => store.state.messages.contextMenuCenterHere), menuElement = ref(null), locationButton = ref(null), @@ -130,6 +137,9 @@ export default defineComponent({ }); return { + messageCopyLink, + messageCenterHere, + menuVisible, menuElement, locationButton, diff --git a/src/index.d.ts b/src/index.d.ts index 5c618f0..4df8dab 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -61,4 +61,6 @@ interface LiveAtlasMessageConfig { loadingTitle: string; locationRegion: string; locationChunk: string; + contextMenuCopyLink: string; + contextMenuCenterHere: string; } \ No newline at end of file diff --git a/src/store/state.ts b/src/store/state.ts index b74c362..5a60a4a 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -124,6 +124,8 @@ export const state: State = { loadingTitle: '', locationRegion: '', locationChunk: '', + contextMenuCopyLink: '', + contextMenuCenterHere: '' }, loggedIn: false,