Use vue3-clipboard in LinkControl
This commit is contained in:
parent
a8ec660ffd
commit
b6f41a8241
@ -20,7 +20,7 @@
|
|||||||
import {Control, ControlOptions, DomUtil, Map} from 'leaflet';
|
import {Control, ControlOptions, DomUtil, Map} from 'leaflet';
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import '@/assets/icons/link.svg';
|
import '@/assets/icons/link.svg';
|
||||||
import ClipboardJS from 'clipboard';
|
import { toClipboard } from '@soerenmartius/vue3-clipboard'
|
||||||
|
|
||||||
export class LinkControl extends Control {
|
export class LinkControl extends Control {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -42,8 +42,9 @@ export class LinkControl extends Control {
|
|||||||
<use xlink:href="#link" />
|
<use xlink:href="#link" />
|
||||||
</svg>`;
|
</svg>`;
|
||||||
|
|
||||||
new ClipboardJS(linkButton, {
|
linkButton.addEventListener('click', e => {
|
||||||
text: () => window.location.href.split("#")[0] + useStore().getters.url,
|
e.preventDefault();
|
||||||
|
toClipboard(window.location.href.split("#")[0] + useStore().getters.url);
|
||||||
});
|
});
|
||||||
|
|
||||||
return linkButton;
|
return linkButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user