Repository navigation
feat(content): ✨ live editing, autosave and presence for the Content Engine #852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f88b13c
feat(ws): ✨ add rooms to the WebSocket registry and the content live …
claude 6ca303e
feat(content): ✨ add live editing broadcast and lifecycle seams
claude 20f993f
feat(content): ✨ add live editing socket: presence and collaborative …
claude ee238fb
feat(content): ✨ add field locks, shared drafts and autosave
claude 380110d
feat(content): ✨ clean up stale field locks, drafts and documents daily
claude a2a7aaa
test(content): ✅ cover field locks and draft merges against Postgres
claude 4c9de65
feat(content): ✨ add richText field with SSR renderer
claude 51f8877
feat(db): 🗃️ add live editing tables and store blog content as rich t…
claude 6d80f17
docs(content): 📝 document live editing and autosave
claude 34f53c5
feat(content): ✨ add collaborative rich text editor and presence UI
claude 50031c2
feat(blog): ✨ co-edit articles with live presence
claude 6fc4712
fix(content): 🐛 stop the collaborative editor from reopening its docu…
claude 4fcce26
docs(content): 📝 add live editing screenshots, presence UI and blog g…
claude e09e916
docs(plan): 📝 mark live editing implemented and list known limitations
claude ebd9978
docs(content): 🎨 format the live editing and rich text pages
claude bbb701d
chore: 🔧 refresh lockfile after rebasing on canary
aXenDeveloper db87323
test(content): 🔥 drop Postgres integration tests whose helper canary …
aXenDeveloper 6042b31
fix(content): 🐛 adapt rich text and live editing to canary's AI actio…
aXenDeveloper 39bde6e
fix(db): 🗃️ regenerate the live editing migration on top of canary
aXenDeveloper ecbb214
fix(ai): 🐛 read rich text documents in translation freshness
aXenDeveloper cb90058
feat(live-editing): ✨ enhance presence UI with outlines and animation…
aXenDeveloper dde84ba
feat(docs): ✏️ add rich text and services documentation
aXenDeveloper b16034c
feat(file-display): ✨ add AutoFormFileDisplay context and tests for f…
aXenDeveloper f1f71de
refactor(presence): ✨ streamline presence model and related components
aXenDeveloper c84bbaa
fix(live-store): 🐛 update `setWhere` in `acquireContentFieldLock` for…
aXenDeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
apps/api/migrations/20261010084604_add_content_live_editing/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| CREATE TABLE "core_content_documents" ( | ||
| "id" serial PRIMARY KEY, | ||
| "contentTypeId" varchar(100) NOT NULL, | ||
| "itemId" integer NOT NULL, | ||
| "field" varchar(100) NOT NULL, | ||
| "language" varchar(35) DEFAULT '' NOT NULL, | ||
| "state" bytea NOT NULL, | ||
| "baseVersion" integer, | ||
| "updatedAt" timestamp DEFAULT now() NOT NULL, | ||
| "updatedBy" integer | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "core_content_documents" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint | ||
| CREATE TABLE "core_content_drafts" ( | ||
| "id" serial PRIMARY KEY, | ||
| "contentTypeId" varchar(100) NOT NULL, | ||
| "itemId" integer NOT NULL, | ||
| "language" varchar(32) DEFAULT '' NOT NULL, | ||
| "values" jsonb DEFAULT '{}' NOT NULL, | ||
| "baseVersion" integer DEFAULT 0 NOT NULL, | ||
| "updatedAt" timestamp DEFAULT now() NOT NULL, | ||
| "updatedBy" integer | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "core_content_drafts" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint | ||
| CREATE TABLE "core_content_field_locks" ( | ||
| "id" serial PRIMARY KEY, | ||
| "contentTypeId" varchar(100) NOT NULL, | ||
| "itemId" integer NOT NULL, | ||
| "field" varchar(100) NOT NULL, | ||
| "language" varchar(32) DEFAULT '' NOT NULL, | ||
| "userId" integer NOT NULL, | ||
| "acquiredAt" timestamp DEFAULT now() NOT NULL, | ||
| "expiresAt" timestamp NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "core_content_field_locks" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint | ||
| ALTER TABLE "blog_posts_translations" ALTER COLUMN "content" SET DATA TYPE jsonb USING ( | ||
| CASE | ||
| WHEN "content" IS NULL THEN NULL | ||
| WHEN btrim(regexp_replace("content", '<[^>]*>', ' ', 'g')) = '' THEN '{"type":"doc","content":[]}'::jsonb | ||
| ELSE jsonb_build_object( | ||
| 'type', 'doc', | ||
| 'content', jsonb_build_array(jsonb_build_object( | ||
| 'type', 'paragraph', | ||
| 'content', jsonb_build_array(jsonb_build_object( | ||
| 'type', 'text', | ||
| 'text', btrim(regexp_replace(regexp_replace("content", '<[^>]*>', ' ', 'g'), '\s+', ' ', 'g')) | ||
| )) | ||
| )) | ||
| ) | ||
| END | ||
| );--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "core_content_documents_doc_unique" ON "core_content_documents" ("contentTypeId","itemId","field","language");--> statement-breakpoint | ||
| CREATE INDEX "core_content_documents_updated_at_idx" ON "core_content_documents" ("updatedAt");--> statement-breakpoint | ||
| CREATE INDEX "core_content_documents_updated_by_idx" ON "core_content_documents" ("updatedBy");--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "core_content_drafts_key_unique" ON "core_content_drafts" ("contentTypeId","itemId","language");--> statement-breakpoint | ||
| CREATE INDEX "core_content_drafts_updated_at_idx" ON "core_content_drafts" ("updatedAt");--> statement-breakpoint | ||
| CREATE INDEX "core_content_drafts_updated_by_idx" ON "core_content_drafts" ("updatedBy");--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "core_content_field_locks_key_unique" ON "core_content_field_locks" ("contentTypeId","itemId","field","language");--> statement-breakpoint | ||
| CREATE INDEX "core_content_field_locks_expires_at_idx" ON "core_content_field_locks" ("expiresAt");--> statement-breakpoint | ||
| CREATE INDEX "core_content_field_locks_user_id_idx" ON "core_content_field_locks" ("userId");--> statement-breakpoint | ||
| ALTER TABLE "core_content_documents" ADD CONSTRAINT "core_content_documents_updatedBy_core_users_id_fkey" FOREIGN KEY ("updatedBy") REFERENCES "core_users"("id") ON DELETE SET NULL ON UPDATE CASCADE;--> statement-breakpoint | ||
| ALTER TABLE "core_content_drafts" ADD CONSTRAINT "core_content_drafts_updatedBy_core_users_id_fkey" FOREIGN KEY ("updatedBy") REFERENCES "core_users"("id") ON DELETE SET NULL ON UPDATE CASCADE;--> statement-breakpoint | ||
| ALTER TABLE "core_content_field_locks" ADD CONSTRAINT "core_content_field_locks_userId_core_users_id_fkey" FOREIGN KEY ("userId") REFERENCES "core_users"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For every existing blog article containing editor-generated HTML, this conversion removes all tags and stores the remaining words in one paragraph. Headings, lists, links, tables, media, and inline formatting are therefore irreversibly lost as soon as the migration runs; convert the HTML structure to equivalent ProseMirror JSON instead of stripping it.
Useful? React with 👍 / 👎.