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...',
locationRegion: 'Region',
locationChunk: 'Chunk',
contextMenuCopyLink: 'Copy link to here',
contextMenuCenterHere: 'Center here',
}
};
</script>

View File

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

View File

@ -2,10 +2,14 @@
<nav id="map__context-menu" v-show="menuVisible" ref="menuElement" :style="style">
<ul class="menu">
<li>
<button ref="locationButton" type="button" v-clipboard="locationCopy">{{locationLabel}}</button>
<button ref="locationButton" type="button" v-clipboard="locationCopy">{{ locationLabel }}</button>
</li>
<li>
<button type="button" v-clipboard="url">{{ messageCopyLink }}</button>
</li>
<li>
<button type="button" @click.prevent="pan">{{ messageCenterHere }}</button>
</li>
<li><button type="button" v-clipboard="url">Copy link to here</button></li>
<li><button type="button" @click.prevent="pan">Center here</button></li>
<WorldListItem v-if="currentWorld" :world="currentWorld"></WorldListItem>
</ul>
</nav>
@ -32,7 +36,10 @@ export default defineComponent({
setup(props) {
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),
locationButton = ref<HTMLInputElement | null>(null),
@ -130,6 +137,9 @@ export default defineComponent({
});
return {
messageCopyLink,
messageCenterHere,
menuVisible,
menuElement,
locationButton,

2
src/index.d.ts vendored
View File

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

View File

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