feat(edit-in-composer): Discord-style edit-in-input toggle#815
Open
Just-Insane wants to merge 5 commits into
Open
feat(edit-in-composer): Discord-style edit-in-input toggle#815Just-Insane wants to merge 5 commits into
Just-Insane wants to merge 5 commits into
Conversation
3735c3a to
6f7bf46
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in experimental "Discord-style edit-in-input" toggle. When enabled, choosing to edit a message loads it into the composer (instead of opening the inline edit dialog), with a cancel affordance and an Escape shortcut; pressing Enter sends an m.replace event.
Changes:
- New
editInInputsetting (default off) and a settings tile under Experimental. - New
roomIdToEditDraftAtomFamilyJotai atom, consumed byRoomTimeline/ThreadDrawerto branch the edit flow, and byRoomInputto populate/clear the composer and send a replacement event. - Composer UI: edit banner with cancel button, Escape handling, and a send path that builds an
m.relates_toReplace event withm.new_content.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| .changeset/edit-in-input.md | Changeset entry (minor) for the feature. |
| src/app/state/settings.ts | Adds editInInput to settings interface and defaults. |
| src/app/state/room/roomInputDrafts.ts | Adds IEditDraft type and roomIdToEditDraftAtomFamily. |
| src/app/features/settings/experimental/EditInInput.tsx | New settings tile to toggle the feature. |
| src/app/features/settings/experimental/Experimental.tsx | Registers the new tile in the Experimental section. |
| src/app/features/room/RoomTimeline.tsx | Branches edit action through new draft when toggle is on; suppresses inline editId. |
| src/app/features/room/ThreadDrawer.tsx | Same edit-branching logic for threads. |
| src/app/features/room/RoomInput.tsx | Loads the message into the editor, renders cancel banner, handles Escape, and sends the replacement event. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Route ArrowUp 'edit last message' through handleEditCallback so that editInInput mode actually sets the editDraft atom instead of opening the inline edit dialog (the original bug) - Preserve media metadata fields (filename, info, file, url, spoiler, link previews, per-message profile) in m.new_content when sending a replacement event so image/file captions and vendor extensions survive the Discord-style edit flow - Clear editDraft + reset editor when findEventById returns undefined so the user is never stuck in an unrecoverable edit state
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.
Description
Adds an opt-in experimental setting that loads the last sent message into the compose input for editing when the user presses ArrowUp — matching Discord's behaviour.
When enabled, pressing ArrowUp in an empty input box populates it with the user's most recent editable message instead of opening the dedicated edit dialog. The feature is gated behind an experimental flag in settings and defaults to off.
Fixes #
Type of change
Checklist:
AI disclosure:
An
editInInputexperimental flag was added to the settings schema. When enabled, the compose input'skeydownhandler checks forArrowUpwhen the input is empty. On match, it walks the loaded room timeline backwards to find the firstm.room.messagesent by the local user within the edit window, then calls the Slate editor API to populate the input value and set the editor into edit mode for that event ID.