mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix(selected unit coords): failsafe in case of absence of the navigator element
This commit is contained in:
parent
f00fce7fe7
commit
8b5df691ec
@ -116,6 +116,8 @@ export class MouseInfoPanel extends Panel {
|
||||
#listenForCopyableElements() {
|
||||
const copyableElements = document.getElementsByClassName('copyable');
|
||||
|
||||
// TODO: copy all the coordinates and elevation instead of copying only lat, lng or elevation.
|
||||
|
||||
for (const element of copyableElements) {
|
||||
element.addEventListener('contextmenu', (ev) => {
|
||||
if (!ev.target) return;
|
||||
@ -134,12 +136,14 @@ export class MouseInfoPanel extends Panel {
|
||||
|
||||
if (!text) return;
|
||||
|
||||
if(!navigator || !navigator.clipboard) return;
|
||||
|
||||
navigator.clipboard.writeText(text)
|
||||
.then(() => {
|
||||
//console.log('Testo copiato negli appunti!');
|
||||
// Text copied to clipboard. TODO: add a toast or alert for this event.
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Errore nel copiare:', err);
|
||||
console.error('An error occurred while copying text to clipboard: ', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user