Conversation
Implement real-time collaborative editing for rich text fields using TipTap editor with Yjs synchronization via WebRTC. Features include: - New settings in Documentate configuration for enabling collaborative mode - Configurable WebRTC signaling server (defaults to public Yjs server) - TipTap editor with full formatting toolbar (bold, italic, underline, lists, alignment, links, undo/redo) - Full table support (insert, add/delete rows/columns, merge/split cells) - Real-time cursor presence showing other users editing - Connection status indicator showing sync state - Graceful fallback to TinyMCE when collaborative mode is disabled - All dependencies loaded via CDN (esm.sh) - no server installation required
The is_collaborative_editing_enabled() method now reads directly from WordPress options instead of depending on the Documentate_Admin class, which may not be loaded yet when meta boxes are rendered.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const config = window.documentateCollaborative || {}; | ||
| const editorId = textarea.id || `editor-${Date.now()}`; | ||
| const roomName = `documentate-${config.postId || 0}-${editorId}`; | ||
| const signalingServer = config.signalingServer || 'wss://signaling.yjs.dev'; |
There was a problem hiding this comment.
Avoid sharing Yjs room between unsaved documents
On admin/js/documentate-collaborative-editor.js the room name is built as documentate-${config.postId || 0}-${editorId}, so on post-new.php where postId is 0 every unsaved document uses the same Yjs room for each meta textarea. Two different authors creating new documents will therefore edit the same collaborative buffer, seeing each other’s cursors and overwriting each other’s content before a post ID exists. Consider incorporating a per-draft identifier (e.g., wp.data postId once assigned or a UUID) into the room name so new drafts don’t cross-contaminate.
Useful? React with 👍 / 👎.
Implement real-time collaborative editing for rich text fields using TipTap editor with Yjs synchronization via WebRTC. Features include: