diff --git a/index.html b/index.html
index 97055d2..2580b8d 100644
--- a/index.html
+++ b/index.html
@@ -111,6 +111,8 @@
toggleTitle: 'Click to toggle this section',
mapTitle: 'Map - Use the arrow keys to pan the map',
layersTitle: 'Layers',
+ copyToClipboardSuccess: 'Copied to clipboard',
+ copyToClipboardError: 'Unable to copy to clipboard',
}
};
diff --git a/src/api.ts b/src/api.ts
index 042773f..32e1148 100644
--- a/src/api.ts
+++ b/src/api.ts
@@ -98,6 +98,8 @@ function buildMessagesConfig(response: any): LiveAtlasMessageConfig {
toggleTitle: liveAtlasMessages.toggleTitle || '',
mapTitle: liveAtlasMessages.mapTitle || '',
layersTitle: liveAtlasMessages.layersTitle || '',
+ copyToClipboardSuccess: liveAtlasMessages.copyToClipboardSuccess || '',
+ copyToClipboardError: liveAtlasMessages.copyToClipboardError || '',
}
}
diff --git a/src/components/map/MapContextMenu.vue b/src/components/map/MapContextMenu.vue
index 8bd9b0a..2cf2f04 100644
--- a/src/components/map/MapContextMenu.vue
+++ b/src/components/map/MapContextMenu.vue
@@ -53,6 +53,8 @@ export default defineComponent({
messageCopyLink = computed(() => store.state.messages.contextMenuCopyLink),
messageCenterHere = computed(() => store.state.messages.contextMenuCenterHere),
+ messageCopySuccess = computed(() => store.state.messages.copyToClipboardSuccess),
+ messageCopyError = computed(() => store.state.messages.copyToClipboardError),
menuElement = ref(null),
menuVisible = computed(() => !!event.value),
@@ -144,9 +146,9 @@ export default defineComponent({
}
}
- const copySuccess = () => notify('Copied to clipboard');
+ const copySuccess = () => notify(messageCopySuccess.value);
const copyError = (e: Error) => {
- notify({ type: 'error', text:'Unable to copy to clipboard'});
+ notify({ type: 'error', text: messageCopyError.value });
console.error('Error copying to clipboard', e);
};
diff --git a/src/index.d.ts b/src/index.d.ts
index 20a2377..a534624 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -59,6 +59,8 @@ interface LiveAtlasMessageConfig {
toggleTitle: string;
mapTitle: string;
layersTitle: string;
+ copyToClipboardSuccess: string;
+ copyToClipboardError: string;
}
export type LiveAtlasUIElement = 'layers' | 'chat' | 'players' | 'maps' | 'settings';
diff --git a/src/leaflet/control/LinkControl.ts b/src/leaflet/control/LinkControl.ts
index 82e4b40..6b1a3a9 100644
--- a/src/leaflet/control/LinkControl.ts
+++ b/src/leaflet/control/LinkControl.ts
@@ -22,6 +22,7 @@ import {useStore} from "@/store";
import '@/assets/icons/link.svg';
import { toClipboard } from '@soerenmartius/vue3-clipboard';
import {notify} from "@kyvg/vue3-notification";
+import {computed} from "@vue/runtime-core";
export class LinkControl extends Control {
// @ts-ignore
@@ -32,7 +33,10 @@ export class LinkControl extends Control {
}
onAdd() {
- const linkButton = DomUtil.create('button', 'leaflet-control-link') as HTMLButtonElement;
+ const store = useStore(),
+ linkButton = DomUtil.create('button', 'leaflet-control-link') as HTMLButtonElement,
+ copySuccessMessage = computed(() => store.state.messages.copyToClipboardSuccess),
+ copyErrorMessage = computed(() => store.state.messages.copyToClipboardError);
linkButton.type = 'button';
linkButton.title = useStore().state.messages.linkTitle;
@@ -44,9 +48,9 @@ export class LinkControl extends Control {
linkButton.addEventListener('click', e => {
e.preventDefault();
toClipboard(window.location.href.split("#")[0] + useStore().getters.url).then(() => {
- notify('Copied to clipboard');
+ notify(copySuccessMessage.value);
}).catch((e) => {
- notify({ type: 'error', text:'Unable to copy to clipboard'});
+ notify({ type: 'error', text: copyErrorMessage.value });
console.error('Error copying to clipboard', e);
});
diff --git a/src/store/state.ts b/src/store/state.ts
index 039c6cf..fde6f1e 100644
--- a/src/store/state.ts
+++ b/src/store/state.ts
@@ -133,6 +133,8 @@ export const state: State = {
toggleTitle: '',
mapTitle: '',
layersTitle: '',
+ copyToClipboardSuccess: '',
+ copyToClipboardError: '',
},
loggedIn: false,