Skip to content

Files

The drive plugin puts a file manager into the editor. People upload images and documents (with a button, or by dropping them on the window), sort them into folders, find them by name, rename or delete them, and insert them: an image as an image, anything else as a link with the file’s name.

  • Files (drive) on the toolbar opens it.
  • Browse next to the address in the link, image and video dialogs opens it too, over the dialog: the image field sees images only, the video field video and sound. The chosen file fills the address.
  • Images pasted, dropped or picked into the text upload into the /Uploads folder.

Your own filePicker and uploadImage, when you give them, stay in charge; the plugin only fills in what isn’t set.

The files live on a server: the NovaProse drive server (below), or your own backend speaking the same small protocol.

createEditor({
element,
plugins: ['drive'],
toolbar: 'undo redo | bold italic | link image drive',
pluginOptions: {
drive: {
url: 'https://files.example.com',
// A short-lived token your backend signs for the signed-in user (called before each request).
token: () => fetch('/api/drive-token').then((response) => response.text()),
},
},
});
Option Meaning
url the drive server’s address
token returns the token for a request; cache it yourself between calls
adapter your own functions instead of url (below)
uploadFolder where pasted and dropped images go, '/Uploads' by default; false: not there

apps/drive-server in the repository is a small Node server: files on a disk you control, folders, search, uploads with a size limit and a quota, files served so that nothing in them can run in a browser, and a Dockerfile.

Terminal window
docker build -t novaprose-drive apps/drive-server
docker run -p 1235:1235 -e NOVA_DRIVE_SECRET=… -e NOVA_DRIVE_PUBLIC_URL=https://files.example.com \
-v novaprose-drive:/data novaprose-drive

It doesn’t know your users: your backend signs a JWT with the shared secret. The token’s root is the folder it opens — a team’s or a person’s — and role: 'viewer' lets someone see and pick files without changing them:

import { SignJWT } from 'jose';
const token = await new SignJWT({ sub: user.id, root: team.driveId })
.setProtectedHeader({ alg: 'HS256' })
.setExpirationTime('1h')
.sign(new TextEncoder().encode(process.env.NOVA_DRIVE_SECRET));

Files are served without a token, because their addresses go into documents that anyone with the document reads; use roots no one can guess (a random id). The server’s README lists its settings, the protocol and everything it refuses.

Serve the protocol from your backend (the drive server’s README describes the five requests), or give the plugin functions:

import type { DriveAdapter } from '@novaprose/core';
const adapter: DriveAdapter = {
list: (path, query) => api.files.list(path, query), // { items: [{ name, path, kind, size, type, modified, url }] }
upload: (folder, file, progress) => api.files.upload(folder, file, progress),
createFolder: (path) => api.files.createFolder(path),
move: (from, to) => api.files.move(from, to),
remove: (paths) => api.files.remove(paths),
};
createEditor({ element, plugins: ['drive'], pluginOptions: { drive: { adapter } } });

Paths start at the root the user may see: /, /Reports/2026. What your functions return is checked before use: an item without a name, a path or a kind is dropped, and an address that isn’t safe (javascript:, say) is never shown or inserted.

The list is one tab stop. ↑ and ↓ move, Home and End jump, Enter opens a folder or inserts (chooses) a file, Backspace goes up a folder, F2 renames, Delete deletes after asking. Search runs as you type; Enter in the search field runs it at once.

Tiny Drive keeps files in Tiny’s cloud. With NovaProse the same work is done by the drive plugin and a server you run; a hosted NovaProse Drive is planned.