Skip to content
TheChatArchiveThe Chat Archive
x-ai/grok-4.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [PRO]: unsetAllMarks deletes comments Affected Packages…

  1. User

    ISSUE DESCRIPTION

    [PRO]: unsetAllMarks deletes comments

    Affected Packages

    extension-comments

    Version(s)

    2.17.5

    Description of the Bug

    Our Tiptap editor has a "clear formatting" button that calls unsetAllMarks to remove formatting from the selection.

    We noticed, however, that if the selection includes content associated with a comment, the comment is also deleted (presumably because the <span> element wrapping the content is removed).

    Is this a bug? I can see how we might want unsetAllMarks to include comments, if we consider the comment tag a "mark," but at the same time I imagine users would generally not expect unsetAllMarks to delete comments.

    For now, as a workaround, we are calling unsetMark separately for all non-comment marks, e.g.

    editor.chain().focus().unsetMark('link').unsetMark('bold').unsetMark('strike') ...
    

    ... but would be nice to be able to use unsetAllMarks again for formatting-specific marks. Thanks!

    Browser Used

    Chrome

    Code Example (Preferred)

    No response

    Expected Behavior

    unsetAllMarks will remove formatting marks (listed here) but not remove comment tags or comments.

    Additional Context (Optional)

    No response

    Dependency Updates

    • Yes, I've updated all my dependencies.

    Evaluation contract

    Marks are clearable by default. A mark configured with clearable: false must survive unsetAllMarks(), while unsetAllMarks({ignoreClearable: true}) removes it. Calling can().unsetAllMarks() on a selection containing only non-clearable marks is a successful no-op and must return true; explicitly calling unsetMark may still remove a non-clearable mark.

    Interface

    Type: Mark configuration option Name: MarkConfig.clearable Path: packages/core/src/Mark.ts Type: boolean | (() => boolean) Default: true Description: Controls whether unsetAllMarks removes this mark. Set false for semantic marks such as comments that must survive clear-formatting operations.

    Type: Command Name: unsetAllMarks Path: packages/core/src/commands/unsetAllMarks.ts Input: options?: { ignoreClearable?: boolean } Output: ReturnType Description: Removes clearable marks from the current selection. Marks configured with clearable: false are preserved unless ignoreClearable is true. can().unsetAllMarks() returns true when the selection contains only non-clearable marks; this case is a successful no-op.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /tiptap, current file: none) bash-$

  2. Assistant

    I'll start by exploring the repository structure and the current implementation of unsetAllMarks and Mark configuration.

  3. Assistant

    Let me look at the current unsetAllMarks and Mark.ts files, as well as how comments are implemented.

  4. Assistant

    Let me check related mark commands and how configuration options like keepOnSplit are resolved.

  5. Assistant

    Let me search with grep instead of rg, and also look at How keepOnSplit is used.

  6. Assistant

    Let me examine how mark types are accessed from the editor and look for existing tests related to unsetAllMarks.

  7. Assistant

    Let me look at how callOrReturn works and how the editor has access to extension configs. Also check how tr.removeMark works when no type is specified - it removes all marks.

  8. Assistant

    Looking at the evaluation contract more carefully: I need to implement the fix for this bug report. Let me think through the changes needed:

    1. First, I should update the MarkConfig interface to include the clearable option
    2. Then update the unsetAllMarks command to respect the clearable setting
    3. Make sure can().
  9. Assistant

    Let me find CommandProps definition.

  10. Assistant

    Let me read CommandProps fully.

  11. Assistant

    I'll check how ExtensionManager stores marks so I can access clearable configuration.

  12. Assistant

    I'll check how ExtensionManager collects regulate marks (similarpattern for clearable).

  13. Assistant

    Let me also check if there's any existing work or documentation about this feature.

  14. Assistant

    Let me check change history around unsetAllMarks and any comments-related mark extensions.

  15. Assistant

    I'll examine an example mark extension and verify how built packages are structured.

  16. Assistant

    I'll implement clearable on marks and update unsetAllMarks to honor it, caching non-clearable marks like splittableMarks.

  17. Assistant

    I'll add the clearable option to MarkConfig after keepOnSplit.

  18. Assistant

    I'll add a blank line and then update ExtensionManager to track non-clearable marks.

  19. Assistant

    I'll update unsetAllMarks to accept options and skip non-clearable marks.

  20. Assistant

    I'll rewrite the entire file.

  21. Assistant

    Checking import conventions in sibling commands and verifying how tests are set up.

  22. Assistant

    I'll inspect how other tests create editors so I can write a temporary verification script.

  23. Assistant

    I'll write a temporary test script to verify the behavior.

  24. Assistant

    I'll run the temporary qualification test.

  25. Assistant

    It timed out. Let me try again with a longer approach - maybe pnpm is slow.

  26. Assistant

    All tests passed. Cleaning up the temp test and checking lint/format.

  27. Assistant

    pnpm seems slow. Let me try reasonable alternative paths.

  28. Assistant

    Good, lint passed. Let me check format.

  29. Assistant

    I'll review the final formatted content.

  30. Assistant

    I'll run a few related unit tests to ensure nothing else broke.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.