Skip to content

feat(edit-in-composer): Discord-style edit-in-input toggle#815

Open
Just-Insane wants to merge 5 commits into
SableClient:devfrom
Just-Insane:feat/edit-in-input
Open

feat(edit-in-composer): Discord-style edit-in-input toggle#815
Just-Insane wants to merge 5 commits into
SableClient:devfrom
Just-Insane:feat/edit-in-input

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 14, 2026

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Fully AI generated (explain what all the generated code does in moderate detail).
  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).

An editInInput experimental flag was added to the settings schema. When enabled, the compose input's keydown handler checks for ArrowUp when the input is empty. On match, it walks the loaded room timeline backwards to find the first m.room.message sent 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.

@Just-Insane Just-Insane force-pushed the feat/edit-in-input branch from 3735c3a to 6f7bf46 Compare May 14, 2026 19:40
@Just-Insane Just-Insane marked this pull request as ready for review May 19, 2026 23:16
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners May 19, 2026 23:16
Copilot AI review requested due to automatic review settings May 19, 2026 23:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 editInInput setting (default off) and a settings tile under Experimental.
  • New roomIdToEditDraftAtomFamily Jotai atom, consumed by RoomTimeline/ThreadDrawer to branch the edit flow, and by RoomInput to 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_to Replace event with m.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.

Comment thread src/app/features/room/RoomTimeline.tsx
Comment thread src/app/features/room/RoomInput.tsx
Comment thread src/app/features/room/RoomInput.tsx
@Just-Insane Just-Insane changed the title feat(experimental): Discord-style edit-in-input toggle feat(edit-in-composer): Discord-style edit-in-input toggle May 19, 2026
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants