Offer to edit images

Any SVG image in assets/ can now be edited with js-draw. It won't reload automatically (yet)
This commit is contained in:
MassiveBox 2025-04-01 23:03:22 +02:00
parent 5c261b35f2
commit 8d1438de33
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
4 changed files with 240 additions and 18 deletions

View file

@ -1,6 +1,9 @@
function copyEditLink(fileID) {
navigator.clipboard.writeText(getEditLink(fileID));
}
function copyImageLink(fileID) {
navigator.clipboard.writeText(`![Drawing](assets/${fileID}.svg)`);
}
function refreshPage() {
window.location.reload();
@ -20,7 +23,7 @@ function addButton(document, fileID) {
popupMenu.innerHTML = `
<button onclick="refreshPage()">Refresh</button>
<button onclick="copyEditLink('${fileID}')">Copy Direct Edit Link</button>
<button onclick="copyImageLink('${fileID}')">Copy Image Link</button>
`;
document.body.appendChild(popupMenu);
@ -31,6 +34,7 @@ function addButton(document, fileID) {
document.body.addEventListener('mouseleave', () => {
floatingButton.style.display = 'none';
popupMenu.style.display = 'none';
});
// Toggle popup menu on button click