Skip to content

[WIP] Fix Cmd+Z functionality after applying Cmd+D strikethrough - #43

Draft
sbolel with Codex wants to merge 2 commits into
mainfrom
codex/fix-undo-after-strikethrough
Draft

[WIP] Fix Cmd+Z functionality after applying Cmd+D strikethrough#43
sbolel with Codex wants to merge 2 commits into
mainfrom
codex/fix-undo-after-strikethrough

Conversation

@Codex

@Codex Codex AI commented Jul 9, 2026

Copy link
Copy Markdown

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[Bug]: Cmd+Z (Undo) does not work after applying Cmd+D strikethrough</issue_title>
<issue_description>### Summary

Cmd+Z (Undo) does not work after using Cmd+D to apply strikethrough formatting in the editor.

Affected page: https://sbolel.github.io/paste-to-markdown/

Reproduction steps

Clipboard content type: Markdown
Occurs in live demo: https://sbolel.github.io/paste-to-markdown/

  1. Navigate to https://sbolel.github.io/paste-to-markdown/
  2. Enter or paste any Markdown content into the editor.
  3. Select a word or phrase.
  4. Press Cmd+D to apply strikethrough formatting.
  5. Press Cmd+Z to undo the last action.

Expected behavior

Pressing Cmd+Z should undo the most recent formatting operation, removing the strikethrough and restoring the previous editor state.

Actual behavior

After Cmd+D applies strikethrough formatting, pressing Cmd+Z has no effect. The formatting remains applied, and the undo shortcut no longer works for that action.

Minimal sanitized sample

Initial Markdown


This is sample text.


After selecting `sample text` and pressing `Cmd+D`


This is ~~sample text~~.


Expected after `Cmd+Z`


This is sample text.

Environment

macOS; Chrome (Atlas); https://sbolel.github.io/paste-to-markdown</issue_description>

<agent_instructions>Fix #42.

Problem:
Cmd+Z undo does not work after Cmd+D applies strikethrough formatting in the editor.

Goal:
Make the Cmd+D strikethrough command participate correctly in the editor undo history so that pressing Cmd+Z immediately after Cmd+D removes the strikethrough and restores the previous editor state.

Acceptance criteria:

  1. In the live editor, selecting text and pressing Cmd+D applies strikethrough formatting.
  2. Pressing Cmd+Z immediately afterward undoes only that strikethrough change.
  3. Undo/redo behavior remains intact for normal typing and other formatting shortcuts.
  4. The fix should work on macOS keyboard shortcuts and should not regress non-macOS behavior if the app supports equivalent shortcuts.
  5. Add or update automated tests that would have caught this regression.
  6. Keep the fix focused. Avoid broad refactors unless necessary.

Suggested reproduction:

  1. Open the app.
  2. Enter: This is sample text.
  3. Select sample text.
  4. Press Cmd+D.
  5. Confirm the editor shows: This is ~~sample text~~.
  6. Press Cmd+Z.
  7. Confirm the editor returns to: This is sample text.

Implementation guidance:

  • First inspect how the editor currently handles Cmd+D, strikethrough formatting, and undo history.
  • Look for direct DOM mutation, direct textarea value assignment, or state updates that bypass the editor’s native/history transaction model.
  • Prefer using the editor’s existing command/transaction/update API so the strikethrough operation becomes undoable.
  • If the editor uses a custom state model, ensure the strikethrough action records a proper history entry before mutating content.
  • Do not introduce a separate undo stack unless the existing editor architecture requires it.

Testing guidance:

  • Inspect package.json and existing tests before choosing the test approach.
  • Add the smallest useful regression test around the keyboard shortcut behavior.
  • If there are browser/e2e tests, prefer a test that simulates selection, Meta+D, then Meta+Z.
  • If only unit/component tests exist, test the command handler or editor state transition directly.
  • Run the relevant test suite and any formatter/linter commands available in the repo.

Deliverables:

  • Commit-ready code change.
  • Regression test.
  • Brief summary of root cause.
  • Brief summary of fix.
  • Commands run and results.</agent_instructions>

Comments on the Issue (you are @codex[agent] in this section)

@Codex
Codex AI requested a review from sbolel July 9, 2026 15:42
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.

[Bug]: Cmd+Z (Undo) does not work after applying Cmd+D strikethrough

2 participants