Manual server file uploads implemented

This commit is contained in:
Magnus Åhall 2026-06-26 08:31:54 +02:00
parent c8308664d3
commit 70b5285e16
10 changed files with 329 additions and 26 deletions

View file

@ -267,11 +267,11 @@ export class N2PageNodeUI extends CustomHTMLElement {
const file = item.getAsFile()
if (!file)
throw new Error("Couldn't convert image to file object.")
const uuid = uuidv7()
await globalThis.nodeStore.files.add({ data: { UUID: uuid, file: file } })
const fileMetadata = await globalThis.nodeStore.storeFile(file)
const [start, end] = [this.elNodeContent.selectionStart, this.elNodeContent.selectionEnd]
this.elNodeContent.setRangeText(`![${file.name}](db://${uuid})`, start, end, 'select');
this.elNodeContent.setRangeText(`![${file.name}](db://${fileMetadata.UUID})`, start, end, 'select');
// Editing the textarea programatically doesn't generate the events it usually gets when edited interactively.
this.node.setContent(this.elNodeContent.value)