Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Code Branches Pull requestsIssuesInsights
main
Home Code PRsIssues

#232 [P1] Modernize Canvas editing and keep chat available beside files

open

Opened by mweinbach · last month

mweinbachopened this issueAuthor· last month

Problem

Opening a supported file disables the main composer without a specific explanation. At the same time, Markdown editing uses a bespoke contentEditable surface, HTML↔Markdown conversion, document selection listeners, and deprecated document.execCommand.

The Canvas edit prompt also clears optimistically and does not reliably preserve text when sendMessage returns a non-throwing failure.

User impact

The assistant becomes least available when users most want to ask about a document. Editing can suffer from caret/selection quirks, paste damage, formatting loss, unclear save state, and lost edit prompts.

Relevant code

  • apps/desktop/src/ui/Canvas.tsx
  • apps/desktop/src/ui/ChatView.tsx
  • Composer and file-context request handling
  • Coordinate with the Canvas race-safe save issue

Implementation outline

  • Keep normal chat available while Canvas is open.
  • Add an explicit removable current-file context chip.
  • Add Ask about this file, Edit this file, and future selection-context actions.
  • Make it clear whether the file is attached to the outgoing request.
  • Preserve chat and Canvas edit drafts independently.
  • Replace the bespoke rich editor with a maintained foundation such as Lexical, ProseMirror, or Tiptap.
  • Use a stable Markdown source-of-truth and a documented conversion model.
  • Add accessible toolbar state, undo/redo, paste handling, selection preservation, and keyboard commands.
  • Preserve edit prompts whenever sending is rejected.
  • Surface Saving/Saved/Failed/Conflict states from the race-safe persistence layer.
  • If a Canvas state must be read-only, explain why and provide a repair action.

Acceptance criteria

  • Opening a file does not automatically disable chat.
  • Users can send with or without explicit current-file context.
  • Chat and editor drafts survive switching files/panes.
  • Failed sends preserve prompts and context.
  • Common formatting, paste, undo/redo, and selection flows are stable.
  • The editor is fully keyboard-operable and labeled.
  • Save/conflict state is always visible and recoverable.
  • Closing Canvas does not discard an unsent chat draft.

Required tests

  • Send with/without file context while Canvas stays open.
  • Failed send and preserved prompt.
  • Switch files with both chat and editor drafts.
  • Formatting, paste, undo/redo, selection, and Markdown round-trip fixtures.
  • Keyboard and accessibility coverage.

Additional scope from the July UI audit

  • Make Quick preview versus Open in Canvas an explicit user choice with consistent ownership and close behavior.
  • Bring PPTX/slide preview titlebar, actions, loading, and error states into the shared Canvas/Preview contract.
  • Clamp selection and formatting controls to the visible viewport.

Sign in to comment.

Linked pull requests

No linked pull requests yet.