Use vue3-clipboard in LinkControl

This commit is contained in:
James Lyne 2021-05-24 16:42:58 +01:00
parent a8ec660ffd
commit b6f41a8241

View File

@ -20,7 +20,7 @@
import {Control, ControlOptions, DomUtil, Map} from 'leaflet';
import {useStore} from "@/store";
import '@/assets/icons/link.svg';
import ClipboardJS from 'clipboard';
import { toClipboard } from '@soerenmartius/vue3-clipboard'
export class LinkControl extends Control {
// @ts-ignore
@ -42,8 +42,9 @@ export class LinkControl extends Control {
<use xlink:href="#link" />
</svg>`;
new ClipboardJS(linkButton, {
text: () => window.location.href.split("#")[0] + useStore().getters.url,
linkButton.addEventListener('click', e => {
e.preventDefault();
toClipboard(window.location.href.split("#")[0] + useStore().getters.url);
});
return linkButton;