Skip to content

fix(desktop): editor bug fixes — codeblock escaping, thread edit leak, channel links, and edit cancel#553

Merged
wesbillman merged 2 commits into
mainfrom
fix-editor-bugs
May 12, 2026
Merged

fix(desktop): editor bug fixes — codeblock escaping, thread edit leak, channel links, and edit cancel#553
wesbillman merged 2 commits into
mainfrom
fix-editor-bugs

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Summary

  • Codeblock escaping: prosemirror-markdown's esc() backslash-escapes markdown special characters in text nodes. Added post-processing in getMarkdownFromEditor() to unescape them so code fences, inline code, bold/italic survive the editor roundtrip.
  • Thread edit leaks to main composer: A single editTarget was passed to both the main channel composer and thread panel composer. Added isEditInThread check to scope editTarget to the correct composer based on whether the message lives in the thread or main timeline.
  • Channel link / @mention not rendering as sole content: createRemarkPrefixPlugin's walkChildren only spliced replacements when parts.length > 1, skipping single-match text nodes. Fixed the guard.
  • Edit cancel leaves stale content: When cancelling a message edit, the composer retained the edit content instead of restoring the pre-edit draft. Added preEditContentRef to save/restore the draft around edit mode transitions.

Test plan

  • Edit a message, click Cancel — composer should restore whatever was typed before (or be empty)
  • Edit a message, press Escape — same behavior
  • Edit a message, save — composer clears correctly, no stale content
  • Type a draft, enter edit mode, cancel — draft is preserved
  • Send a message containing only #channel-name — renders as a link
  • Send a message with inline code and code blocks — backticks not double-escaped
  • Edit a message in a thread — edit stays scoped to thread composer, not main
  • Edit a message in main timeline while thread is open — edit stays in main composer

🤖 Generated with Claude Code

wesbillman and others added 2 commits May 12, 2026 12:14
Three editor/rendering bugs:

1. Codeblock rendering broken: prosemirror-markdown's esc() backslash-escapes
   markdown special characters (backticks, asterisks, etc.) in text nodes.
   Added post-processing in getMarkdownFromEditor() to unescape them so code
   fences, inline code, bold/italic syntax survive the editor roundtrip.

2. Thread edit leaks to main: single editTarget was passed to both the main
   channel composer and thread panel composer. Added isEditInThread check to
   scope editTarget to the correct composer based on whether the message
   being edited lives in the thread or main timeline.

3. Channel link (and @mention) not rendering when sole message content:
   createRemarkPrefixPlugin's walkChildren only spliced replacements when
   parts.length > 1, skipping the case where the entire text node is a
   single match. Fixed guard to also splice when the single part is a
   non-text node.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When cancelling a message edit, the composer retained the edit content
instead of restoring whatever the user had typed before. Added
preEditContentRef to save the current draft before entering edit mode
and restore it (or clear to empty) when edit mode exits via cancel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wesbillman wesbillman enabled auto-merge (squash) May 12, 2026 19:28
@wesbillman wesbillman merged commit 78508ea into main May 12, 2026
15 checks passed
@wesbillman wesbillman deleted the fix-editor-bugs branch May 12, 2026 19:35
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.

1 participant