Edit page content with the Docwell editor

PageView now mounts @docwell/editor and autosaves the document through
GET/PUT /api/v1/pages/{id}/content. The server stores Tiptap JSON in
pages.content_json and derives content_text and word_count itself.
Saves are last-write-wins until the collab relay replaces them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-10-31 11:24:36 +01:00
1 parent a96c6ad3ce
commit abf55a426b
13 files changed
+420 -9

No files matched your search

+5
View File
@@ -25,6 +25,7 @@ export type PageNode = Schemas["PageNode"];
export type PageRef = Schemas["PageRef"];
export type Page = Schemas["Page"];
export type TrashedPage = Schemas["TrashedPage"];
export type PageContent = Schemas["PageContent"];
export type CreateSpaceRequest = { name: string; description?: string; icon?: string; visibility?: SpaceVisibility };
export type UpdateSpaceRequest = Partial<Pick<Space, "name" | "description" | "icon" | "visibility" | "defaultRole">>;
@@ -164,6 +165,10 @@ export function createClient(opts: ClientOptions) {
update: (id: string, patch: { title?: string; icon?: string }) =>
request<Page>("PATCH", `/api/v1/pages/${encodeURIComponent(id)}`, patch),
/** Moves a page under parent ("" = top level) at index among its other children. */
content: (id: string) => request<PageContent>("GET", `/api/v1/pages/${encodeURIComponent(id)}/content`),
/** Replaces the page's document; content is Tiptap JSON with type "doc". */
saveContent: (id: string, content: Record<string, unknown>) =>
request<PageContent>("PUT", `/api/v1/pages/${encodeURIComponent(id)}/content`, { content }),
move: (id: string, parent: string, index: number) =>
post<Page>(`/api/v1/pages/${encodeURIComponent(id)}/move`, { parent, index }),
trash: (id: string) => request<void>("DELETE", `/api/v1/pages/${encodeURIComponent(id)}`),
+84
View File
@@ -540,6 +540,26 @@ export interface paths {
patch: operations["updatePage"];
trace?: never;
};
"/api/v1/pages/{id}/content": {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
/** The page's document as Tiptap JSON (null for a page that was never edited) */
get: operations["getPageContent"];
/** Replace the page's document (editor). Last write wins until the collab relay lands; the server derives the plain text and word count. */
put: operations["savePageContent"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/pages/{id}/move": {
parameters: {
query?: never;
@@ -728,6 +748,13 @@ export interface components {
ancestors: components["schemas"]["PageRef"][];
role: components["schemas"]["SpaceRole"];
};
PageContent: {
/** @description Tiptap JSON with type "doc"; null for a page that was never edited */
content: {
[key: string]: unknown;
} | null;
updated: string;
};
TrashedPage: {
id: string;
title: string;
@@ -1864,6 +1891,63 @@ export interface operations {
404: components["responses"]["Error"];
};
};
getPageContent: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PageContent"];
};
};
404: components["responses"]["Error"];
};
};
savePageContent: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** @description Tiptap JSON with type "doc" */
content: {
[key: string]: unknown;
};
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PageContent"];
};
};
400: components["responses"]["Error"];
403: components["responses"]["Error"];
404: components["responses"]["Error"];
};
};
movePage: {
parameters: {
query?: never;