Move from file IDs to file paths (with retrocompatibility)

This commit is contained in:
MassiveBox 2025-04-02 20:15:48 +02:00
parent 56cf62f1eb
commit a2503d5def
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
7 changed files with 62 additions and 49 deletions

View file

@ -1,15 +1,15 @@
function copyEditLink(fileID) {
navigator.clipboard.writeText(getEditLink(fileID));
function copyEditLink(path) {
navigator.clipboard.writeText(getEditLink(path));
}
function copyImageLink(fileID) {
navigator.clipboard.writeText(`![Drawing](assets/${fileID}.svg)`);
function copyImageLink(path) {
navigator.clipboard.writeText(`![Drawing](${path.replace("/data/", "")})`);
}
function refreshPage() {
window.location.reload();
}
function addButton(document, fileID) {
function addButton(document, path) {
// Add floating button
const floatingButton = document.createElement('button');
@ -22,8 +22,8 @@ function addButton(document, fileID) {
popupMenu.id = 'popupMenu';
popupMenu.innerHTML = `
<button onclick="refreshPage()">Refresh</button>
<button onclick="copyEditLink('${fileID}')">Copy Direct Edit Link</button>
<button onclick="copyImageLink('${fileID}')">Copy Image Link</button>
<button onclick="copyEditLink('${path}')">Copy Direct Edit Link</button>
<button onclick="copyImageLink('${path}')">Copy Image Link</button>
`;
document.body.appendChild(popupMenu);