-
Notifications
You must be signed in to change notification settings - Fork 2
feat(landing): Add Kerebron rich text editor demo #47
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
base: main
Are you sure you want to change the base?
Conversation
Add a new demo page showcasing the Kerebron ProseMirror-based rich text editor integrated with Ozwell AI via MCP tools. Features: - Kerebron editor loaded from CDN with AdvancedEditorKit - AI-controlled document editing via postMessage tools - Tools: get_document, set_document, insert_text, format_text, find_and_replace - Live event log showing tool executions - Markdown preview panel - Manual formatting toolbar (Bold, Italic, H1) Integration follows the same postMessage pattern as tictactoe demo, using tool_call_id for proper OpenAI function calling protocol.
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.
Pull request overview
This PR adds a new demo page showcasing the Kerebron ProseMirror-based rich text editor integrated with Ozwell AI through MCP tools. The integration follows the same postMessage pattern as the existing tic-tac-toe demo, enabling users to edit documents using natural language commands.
Key Changes:
- Implements 5 MCP tools for AI-controlled document manipulation (get, set, insert, format, find-and-replace)
- Adds real-time markdown preview and live event logging for debugging
- Includes manual formatting toolbar alongside AI-powered editing
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| landing-page/server.js | Adds route handler for /kerebron.html |
| landing-page/public/landing.html | Updates demo video link and adds navigation link to Kerebron demo |
| landing-page/public/kerebron.html | Main demo page with OzwellChatConfig, tool definitions, and editor UI structure |
| landing-page/public/kerebron.css | Comprehensive styling for editor, preview panel, event log, and responsive layout |
| landing-page/public/kerebron-app.js | Editor initialization, tool handlers, postMessage communication, and text-to-HTML conversion utilities |
landing-page/public/kerebron-app.js
Outdated
| document.getElementById('bold-btn')?.addEventListener('click', () => { | ||
| if (!editor) return; | ||
| editor.chain().toggleStrong().run(); | ||
| updateMarkdownPreview(); | ||
| logEvent('info', 'Toggle bold'); | ||
| }); | ||
|
|
||
| // Italic button | ||
| document.getElementById('italic-btn')?.addEventListener('click', () => { | ||
| if (!editor) return; | ||
| editor.chain().toggleItalic().run(); | ||
| updateMarkdownPreview(); | ||
| logEvent('info', 'Toggle italic'); | ||
| }); | ||
|
|
||
| // Heading button | ||
| document.getElementById('heading-btn')?.addEventListener('click', () => { | ||
| if (!editor) return; | ||
| editor.chain().setHeading1().run(); | ||
| updateMarkdownPreview(); |
Copilot
AI
Jan 4, 2026
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.
Missing await keyword before updateMarkdownPreview() calls. Since this function is async, the call should be awaited to ensure the preview is updated before logging the event. This could cause race conditions where the log entry appears before the preview actually updates.
| document.getElementById('bold-btn')?.addEventListener('click', () => { | |
| if (!editor) return; | |
| editor.chain().toggleStrong().run(); | |
| updateMarkdownPreview(); | |
| logEvent('info', 'Toggle bold'); | |
| }); | |
| // Italic button | |
| document.getElementById('italic-btn')?.addEventListener('click', () => { | |
| if (!editor) return; | |
| editor.chain().toggleItalic().run(); | |
| updateMarkdownPreview(); | |
| logEvent('info', 'Toggle italic'); | |
| }); | |
| // Heading button | |
| document.getElementById('heading-btn')?.addEventListener('click', () => { | |
| if (!editor) return; | |
| editor.chain().setHeading1().run(); | |
| updateMarkdownPreview(); | |
| document.getElementById('bold-btn')?.addEventListener('click', async () => { | |
| if (!editor) return; | |
| editor.chain().toggleStrong().run(); | |
| await updateMarkdownPreview(); | |
| logEvent('info', 'Toggle bold'); | |
| }); | |
| // Italic button | |
| document.getElementById('italic-btn')?.addEventListener('click', async () => { | |
| if (!editor) return; | |
| editor.chain().toggleItalic().run(); | |
| await updateMarkdownPreview(); | |
| logEvent('info', 'Toggle italic'); | |
| }); | |
| // Heading button | |
| document.getElementById('heading-btn')?.addEventListener('click', async () => { | |
| if (!editor) return; | |
| editor.chain().setHeading1().run(); | |
| await updateMarkdownPreview(); |
| document.getElementById('load-sample-btn')?.addEventListener('click', () => { | ||
| loadSampleDocument(); | ||
| }); |
Copilot
AI
Jan 4, 2026
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.
Inconsistent event listener pattern compared to other button handlers. Lines 574, 583, 591, and 599 use arrow functions with async, but this handler doesn't need async since it's not awaiting anything. However, for consistency with lines 583 and 591 which should be async, consider making all button handlers either async arrow functions or regular arrow functions consistently.
| inList = true; | ||
| } | ||
| const content = escapeHtml(trimmed.slice(2)); | ||
| html += `<li>${applyInlineFormatting(content)}</li>`; |
Copilot
AI
Jan 4, 2026
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.
The applyInlineFormatting function is called on already-escaped HTML. Since escapeHtml is called first at line 467 and 483, any special characters are already converted to entities. The function should receive unescaped text, apply formatting, then escape the result. Otherwise, the regex patterns will work but may produce double-escaped content in edge cases.
aditya-damerla128
left a comment
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.
kerebron.css line 27 - Back link gets covered by the title on smaller screens - hard to click
kerebron-app.js line 577 - Clear button doesn't work - throws a 404 in console. Think it's the text/x-markdown vs text/html thing?
kerebron.css (dark mode) - Editor text is invisible in dark mode - Kerebron applies light text but the page background stays light
Will attach screenshots in a follow-up comment.
When the editor is not initialized, error messages are returned to the AI, but these technical error messages may not be helpful for the user. The AI should provide a user-friendly message. However, since the error is passed back to the AI via the tool result, the AI can interpret it. This is acceptable, but consider whether a more user-friendly message would be better. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tually updates. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ght key differentiators
…yling to stop overlap on some screens
Summary
Watch: https://youtube.com/shorts/DkxTvPlXVTk
Add a new demo page showcasing the Kerebron ProseMirror-based rich text editor integrated with Ozwell AI via MCP tools.
Features
get_document- Read current document contentset_document- Replace entire documentinsert_text- Insert text at start/end/cursorformat_text- Apply bold, italic, headingsfind_and_replace- Find and replace textIntegration Pattern
Follows the same postMessage pattern as the tic-tac-toe demo:
tool_callwithtool_call_idtool_resultback with matchingtool_call_idFiles Changed
landing-page/public/kerebron.html- Demo page with OzwellChatConfig and toolslanding-page/public/kerebron-app.js- Editor init and tool handlerslanding-page/public/kerebron.css- Styling for demo pagelanding-page/public/landing.html- Added link to Kerebron demolanding-page/server.js- Added route for kerebron.htmlTesting
npm run devScreenshots
The demo includes: