Description
Integrate the OnlyOffice Document Server into AFFiNE so that office attachments embedded in a document (Word / Excel / PowerPoint and related formats) can be opened and edited in-place, with edits saved back into the workspace as versioned blobs.
Today an office file attached to an AFFiNE doc can only be downloaded and opened in an external application. This request adds a first-class "Open with OnlyOffice" experience, gated behind an experimental feature flag and disabled by default, so self-hosted deployments that run an OnlyOffice Document Server can turn it on.
Scope
- Backend plugin (
plugins/onlyoffice)
- Builds a signed (JWT) editor config for a given attachment.
- Serves a token-authenticated file download endpoint the Document Server uses to fetch the source file (server-to-server).
- Handles the JWT-verified OnlyOffice callback and writes edited output back as a content-addressed blob.
- Maintains a per-attachment version manifest: autosaves within one editing session are collapsed onto a single working entry and sealed into a finalized history version on explicit close / force-save. Manifest updates are guarded by a distributed mutex for safe concurrent editing.
- Serves a standalone editor page and a versions page.
- Aligns the editor UI language with the AFFiNE locale and aligns permissions with the document's share permissions.
- Frontend view-extension (
view-extensions/onlyoffice)
- Adds an attachment-toolbar entry to open the editor.
- Adds an in-app version panel to browse/restore prior versions.
- Wired through the feature flag and the blocksuite view manager. No blocksuite core schema changes.
Supported file types
doc/docx/docm/dot/dotx/odt/ott/rtf/txt (word), xls/xlsx/xlsm/ods/ots/csv (cell), ppt/pptx/pptm/odp/otp (slide), and pdf.
Interaction modes (7)
edit (full editing), review (strict track-changes), view (read-only + anti-leak: no copy/print/download), fillForms, comment, embedded, and mobile.
Use case
Self-hosted AFFiNE users who keep office documents as attachments want to edit those files directly inside AFFiNE — collaboratively, with version history — instead of downloading, editing externally, and re-uploading. This is especially valuable for teams already running an OnlyOffice Document Server alongside their AFFiNE deployment.
Anything else?
Feature flag
- Frontend:
enable_onlyoffice — "OnlyOffice document editing", category affine, default off, configurable on desktop/web.
- Backend module config
onlyoffice (default disabled), configured via env vars:
AFFINE_ONLYOFFICE_ENABLED — enable the integration.
AFFINE_ONLYOFFICE_DOCUMENT_SERVER_URL — public URL the browser uses to load the editor api.js.
AFFINE_ONLYOFFICE_INTERNAL_URL — internal server-to-server URL (falls back to the public URL).
AFFINE_ONLYOFFICE_CALLBACK_HOST — base URL the Document Server uses to reach back to AFFiNE for file download and posting edits.
AFFINE_ONLYOFFICE_JWT_SECRET — shared JWT secret; must match the Document Server JWT_SECRET.
Security
- All editor config payloads and callbacks are JWT-signed/verified with the shared secret.
- File download for the Document Server is token-authenticated.
- The
view mode disables copy/print/download as an anti-leak measure.
- The integration is off by default and requires a configured Document Server, so existing deployments are unaffected.
Protocol references:
Are you willing to submit a PR?
Is your content generated by AI?
Description
Integrate the OnlyOffice Document Server into AFFiNE so that office attachments embedded in a document (Word / Excel / PowerPoint and related formats) can be opened and edited in-place, with edits saved back into the workspace as versioned blobs.
Today an office file attached to an AFFiNE doc can only be downloaded and opened in an external application. This request adds a first-class "Open with OnlyOffice" experience, gated behind an experimental feature flag and disabled by default, so self-hosted deployments that run an OnlyOffice Document Server can turn it on.
Scope
plugins/onlyoffice)view-extensions/onlyoffice)Supported file types
doc/docx/docm/dot/dotx/odt/ott/rtf/txt(word),xls/xlsx/xlsm/ods/ots/csv(cell),ppt/pptx/pptm/odp/otp(slide), andpdf.Interaction modes (7)
edit(full editing),review(strict track-changes),view(read-only + anti-leak: no copy/print/download),fillForms,comment,embedded, andmobile.Use case
Self-hosted AFFiNE users who keep office documents as attachments want to edit those files directly inside AFFiNE — collaboratively, with version history — instead of downloading, editing externally, and re-uploading. This is especially valuable for teams already running an OnlyOffice Document Server alongside their AFFiNE deployment.
Anything else?
Feature flag
enable_onlyoffice— "OnlyOffice document editing", categoryaffine, default off, configurable on desktop/web.onlyoffice(default disabled), configured via env vars:AFFINE_ONLYOFFICE_ENABLED— enable the integration.AFFINE_ONLYOFFICE_DOCUMENT_SERVER_URL— public URL the browser uses to load the editorapi.js.AFFINE_ONLYOFFICE_INTERNAL_URL— internal server-to-server URL (falls back to the public URL).AFFINE_ONLYOFFICE_CALLBACK_HOST— base URL the Document Server uses to reach back to AFFiNE for file download and posting edits.AFFINE_ONLYOFFICE_JWT_SECRET— shared JWT secret; must match the Document ServerJWT_SECRET.Security
viewmode disables copy/print/download as an anti-leak measure.Protocol references:
Are you willing to submit a PR?
Is your content generated by AI?