fix: Enter key not creating new line in memo mode on macOS#4966
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
fix: Enter key not creating new line in memo mode on macOS#4966devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
On macOS WKWebView (Tauri), the Enter key in memo mode fails to create new lines because the keydown event passes through handleDOMEvents (component event listeners from @handlewithcare/react-prosemirror) before reaching the keymap plugin's handleKeyDown. This can cause plain Enter to be silently dropped for non-list paragraph blocks. Add a direct handleKeyDown prop on the ProseMirror view that handles Enter key processing at the view level, ensuring it runs reliably for every keydown event regardless of the component event listener pipeline. Closes #4964 Co-Authored-By: John <[email protected]>
Co-Authored-By: John <[email protected]>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for hyprnote canceled.
|
✅ Deploy Preview for char-cli-web canceled.
|
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.
Summary
Adds a direct
handleKeyDownprop on the<ProseMirror>component to handle Enter key processing at the view level, bypassing the normal keymap plugin pipeline. This is intended to fix #4964 where Enter fails to create new lines in memo mode on macOS.The hypothesis is that
@handlewithcare/react-prosemirror's event handling pipeline (component event listeners inhandleDOMEvents) can interfere with the keymap plugin'shandleKeyDownon macOS WKWebView, preventingsplitBlockfrom running for plain paragraph blocks.The new
enterKeyHandlerreplicates the full Enter key chain (code block exit, newline-in-code, list item split/lift, paragraph split) plus Shift+Enter / Mod+Enter hard break handling, and is exported fromkeymap.tsand passed as thehandleKeyDowndirect prop inindex.tsx.Review & Testing Checklist for Human
useEditorEventListenerclosures (slash command / mention handlers returningtruefromhandleDOMEvents.keydown), this fix will NOT help —handleDOMEventsruns beforehandleKeyDownin ProseMirror's event pipeline, so a stale handler swallowing Enter would still prevent our new handler from firing. Test Enter in a fresh memo with no slash command or mention popup active.handleDOMEventswhich is checked first, but needs manual verification.enterCommand,hardBreakCommand, andexitCodeBlockCommandare near-copies of the logic already inbuildKeymap. The view-level handler now runs before the keymap plugin for Enter events, effectively making the keymap'sEnterbinding dead code. Consider whether maintaining two copies of this logic is acceptable long-term.Notes
handleKeyDowndirect prop has the highest priority in ProseMirror'ssomeProplookup (checked before view-level plugins and state-level plugins). For Enter keys, the keymap plugin's handler will no longer be reached.buildKeymapif either is updated independently. A future refactor could extract shared command definitions.nodeViewstyping) exist onmainand are not introduced by this PR.Link to Devin session: https://app.devin.ai/sessions/03589faf360d4fd69e77bfba0a689014
Requested by: @ComputelessComputer