feat: typo correction in the Lexical editor (Phase 2)#1321
Open
sh1nj1 wants to merge 2 commits into
Open
Conversation
Extends server-side typo correction to the inline creative editor (location 'editor', gated by the existing 'creative editor' toggle, default off). The highlight is a volatile DOM overlay over the contenteditable, drawn from live DOM Range rects — the editor state is never mutated to hold a mark, so markdown-canonical storage never serializes a highlight. Only real corrections mutate the editor (and are undoable via history). Code blocks, inline code, and link text are excluded (protected spans). - lib/lexical_typo_text.js: pure offset<->node mapping (flat text + segment map) - components/plugins/typo_correction_plugin.jsx: the Lexical plugin + overlay - lib/typo_popup.js: combobox popup extracted and shared with Phase 1 - lib/typo_settings.js: shared #comments-popup dataset reader - reuses the pure core (anchorEdits/partitionByThreshold/shouldRun/detectDevice) No backend changes — the endpoint already accepts location 'editor'.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…phase2 # Conflicts: # engines/collavre/app/javascript/modules/creative_row_editor.js
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 2 — typo correction in the inline Lexical editor
Builds on Phase 0+1 (#1317, merged). Extends server-side typo correction from the chat composer to the inline creative editor.
What it does
location: "editor"andtypo_correction_in_editoralready exists.Markdown-canonical safety (headline guarantee)
The highlight is a volatile DOM overlay over the contenteditable, drawn from live DOM
Rangerects. The editor state is never mutated to hold a mark, so$convertToMarkdownString(canonical storage) never sees a highlight. Only real corrections mutate the editor (undoable via history). Verified by a unit test on a real headless Lexical editor.Code blocks, inline code, and link text are excluded (protected spans), matching the server's skip ranges.
Files
lib/lexical_typo_text.js— pure offset↔node mapping (flat text + segment map), 11 unit testscomponents/plugins/typo_correction_plugin.jsx— the plugin + overlay controller, unit tests (collection / auto-apply / markdown-safety)lib/typo_popup.js— combobox popup extracted and now shared with Phase 1 (de-duplicated)lib/typo_settings.js— shared#comments-popupdataset readeranchorEdits/partitionByThreshold/shouldRun/detectDevice)Tests
Known limitations (documented)
Not in scope (Phase 3)
Device-detection refinement, user dictionary, additional languages.