From b6f41a82414720787a605037f0f997a6da1e460b Mon Sep 17 00:00:00 2001 From: James Lyne Date: Mon, 24 May 2021 16:42:58 +0100 Subject: [PATCH] Use vue3-clipboard in LinkControl --- src/leaflet/control/LinkControl.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/leaflet/control/LinkControl.ts b/src/leaflet/control/LinkControl.ts index 220eac2..e249d93 100644 --- a/src/leaflet/control/LinkControl.ts +++ b/src/leaflet/control/LinkControl.ts @@ -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 { `; - 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;