Allow customisation of context menu text

This commit is contained in:
James Lyne 2021-05-24 18:23:35 +01:00
parent 4d34927c39
commit 6531040f9d
5 changed files with 22 additions and 4 deletions

View File

@ -106,6 +106,8 @@
loadingTitle: 'Loading...', loadingTitle: 'Loading...',
locationRegion: 'Region', locationRegion: 'Region',
locationChunk: 'Chunk', locationChunk: 'Chunk',
contextMenuCopyLink: 'Copy link to here',
contextMenuCenterHere: 'Center here',
} }
}; };
</script> </script>

View File

@ -93,6 +93,8 @@ function buildMessagesConfig(response: any): LiveAtlasMessageConfig {
loadingTitle: liveAtlasMessages.loadingTitle || '', loadingTitle: liveAtlasMessages.loadingTitle || '',
locationRegion: liveAtlasMessages.locationRegion || '', locationRegion: liveAtlasMessages.locationRegion || '',
locationChunk: liveAtlasMessages.locationChunk || '', locationChunk: liveAtlasMessages.locationChunk || '',
contextMenuCopyLink: liveAtlasMessages.contextMenuCopyLink || '',
contextMenuCenterHere: liveAtlasMessages.contextMenuCenterHere || '',
} }
} }

View File

@ -4,8 +4,12 @@
<li> <li>
<button ref="locationButton" type="button" v-clipboard="locationCopy">{{ locationLabel }}</button> <button ref="locationButton" type="button" v-clipboard="locationCopy">{{ locationLabel }}</button>
</li> </li>
<li><button type="button" v-clipboard="url">Copy link to here</button></li> <li>
<li><button type="button" @click.prevent="pan">Center here</button></li> <button type="button" v-clipboard="url">{{ messageCopyLink }}</button>
</li>
<li>
<button type="button" @click.prevent="pan">{{ messageCenterHere }}</button>
</li>
<WorldListItem v-if="currentWorld" :world="currentWorld"></WorldListItem> <WorldListItem v-if="currentWorld" :world="currentWorld"></WorldListItem>
</ul> </ul>
</nav> </nav>
@ -34,6 +38,9 @@ export default defineComponent({
const store = useStore(), const store = useStore(),
event = ref<LeafletMouseEvent | null>(null), event = ref<LeafletMouseEvent | null>(null),
messageCopyLink = computed(() => store.state.messages.contextMenuCopyLink),
messageCenterHere = computed(() => store.state.messages.contextMenuCenterHere),
menuElement = ref<HTMLInputElement | null>(null), menuElement = ref<HTMLInputElement | null>(null),
locationButton = ref<HTMLInputElement | null>(null), locationButton = ref<HTMLInputElement | null>(null),
menuVisible = computed(() => !!event.value), menuVisible = computed(() => !!event.value),
@ -130,6 +137,9 @@ export default defineComponent({
}); });
return { return {
messageCopyLink,
messageCenterHere,
menuVisible, menuVisible,
menuElement, menuElement,
locationButton, locationButton,

2
src/index.d.ts vendored
View File

@ -61,4 +61,6 @@ interface LiveAtlasMessageConfig {
loadingTitle: string; loadingTitle: string;
locationRegion: string; locationRegion: string;
locationChunk: string; locationChunk: string;
contextMenuCopyLink: string;
contextMenuCenterHere: string;
} }

View File

@ -124,6 +124,8 @@ export const state: State = {
loadingTitle: '', loadingTitle: '',
locationRegion: '', locationRegion: '',
locationChunk: '', locationChunk: '',
contextMenuCopyLink: '',
contextMenuCenterHere: ''
}, },
loggedIn: false, loggedIn: false,