Internal file paths are now Markdown image paths

In the last commit, file paths were implemented to be the full path for the API, however that is not necessary.
Before this change: /data/assets/filename.svg
After: assets/filename.svg
The new method is what SiYuan uses for Markdown images, like ![Drawing](assets/filename.svg)
This commit is contained in:
MassiveBox 2025-04-03 00:12:36 +02:00
parent a2503d5def
commit 5e51589ffa
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
8 changed files with 66 additions and 14 deletions

View file

@ -2,7 +2,7 @@ function copyEditLink(path) {
navigator.clipboard.writeText(getEditLink(path));
}
function copyImageLink(path) {
navigator.clipboard.writeText(`![Drawing](${path.replace("/data/", "")})`);
navigator.clipboard.writeText(`![Drawing](${path})`);
}
function refreshPage() {

View file

@ -29,7 +29,7 @@ async function getFile(path) {
async function getSVG(path) {
const resp = await getFile(path);
const resp = await getFile("/data/" + path);
if(resp == null) {
return FALLBACK;
}

View file

@ -8,7 +8,7 @@
let path = urlParams.get('path');
if(path === null) {
const fileID = urlParams.get('id'); // legacy support
path = "/data/assets/" + fileID + ".svg";
path = "assets/" + fileID + ".svg";
}
document.addEventListener('DOMContentLoaded', async () => {