Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging 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. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The issue is about unsetAllMarks deleting comments in a Tiptap editor. The expected behavior is that unsetAllMarks will remove formatting marks but not remove comment tags or comments that are configured with clearable: false.

    Let me explore the repository structure first, then look at the relevant files mentioned in the issue:

    1. packages/core/src/Mark.ts - where the clearable option needs to be added
    2. packages/core/src/commands/unsetAllMarks.ts - where the command needs to be modified

    Let me start exploring.

  3. DeepSeek Assistant

    Let me look at the relevant files mentioned in the issue.

  4. DeepSeek Assistant

    Let me see the rest of this file and also look at the unsetAllMarks command.

  5. DeepSeek Assistant

    Let me see the rest of the file and also look at the unsetAllMarks command.

  6. DeepSeek Assistant

    Now let me look at the unsetAllMarks command file

  7. DeepSeek Assistant

    Let me open the unsetAllMarks file.

  8. DeepSeek Assistant

    Now let me explore the codebase more to understand how marks are accessed and how the comment extension works

  9. DeepSeek Assistant

    The find command didn't output anything, probably due to the pattern. Let me try a different approach.

  10. DeepSeek Assistant

    Let me look at the packages directory structure

  11. DeepSeek Assistant

    I don't see a comment extension. Let me check deprecated packages and look for any comment-related code

  12. DeepSeek Assistant

    Let me look at the Extendable class and understand how marks are stored and accessed

  13. DeepSeek Assistant

    Let me look at how the editor stores extensions and how marks are accessed

  14. DeepSeek Assistant

    Let me look at the

  15. DeepSeek Assistant

    Let me look at the ExtensionManager to understand how marks and their configurations are stored.

  16. DeepSeek Assistant

    Let me look at the types to understand how commands get access to editor and other context

  17. DeepSeek Assistant

    Let me look at the CommandProps and RawCommands to understand how commands can access the editor.

  18. DeepSeek Assistant

    Now let me look at the ExtensionManager's extensions property and find how to access mark

  19. DeepSeek Assistant

    Now let me look at some existing commands to see patterns for accessing extension config:

  20. DeepSeek Assistant

    Let me look at unsetMark.ts and toggleMark.ts to see how they interact with mark configuration

  21. DeepSeek Assistant

    Let me look at the getExtensionField helper and how mark properties like exitable are

  22. DeepSeek Assistant

    Let me also look at the callOrReturn utility and how the

  23. DeepSeek Assistant

    Let me look at how the config is stored in the

  24. DeepSeek Assistant

    Let me look at the Extendable class's default config:

  25. DeepSeek Assistant

    Let me search for patterns where commands use editor.extensionManager to get extension

  26. DeepSeek Assistant

    Let me look for existing tests for unsetAllMarks:

  27. DeepSeek Assistant

    Let me check existing tests in the core package

  28. DeepSeek Assistant

    Let me check the package.json for test commands

  29. DeepSeek Assistant

    Let me check the test script more and the core package.json

  30. DeepSeek Assistant

    Now let me implement the solution. First, let me add the clearable property to the MarkConfig interface:

  31. DeepSeek Assistant

    Let me open the Mark.ts file

  32. DeepSeek Assistant

    Let me use the goto command to navigate the file

  33. DeepSeek Assistant

    Now let me add the clearable property to the MarkConfig interface. I'll add it after the addAttributes property:

  34. DeepSeek Assistant

    Let me use the proper heredoc syntax:

  35. DeepSeek Assistant

    Let me try a different approach - using the heredoc syntax:

  36. DeepSeek Assistant

    Good, the clearable property has been added to MarkConfig. Now let me modify the unsetAllMarks command:

  37. DeepSeek Assistant

    Let me try different commands.

  38. DeepSeek Assistant

    Let me check how properties like exitable are resolved in the codebase to follow the same pattern:

  39. DeepSeek Assistant

    Let me look at how exitable is used in the ExtensionManager:

  40. DeepSeek Assistant

    Let me check how other boolean-function properties like keepOnSplit are used

  41. DeepSeek Assistant

    Now I have a clear pattern. Let me modify the unsetAllMarks command using callOrReturn + getExtensionField pattern

  42. DeepSeek Assistant

    Now let me verify the code compiles by running the TypeScript check

  43. DeepSeek Assistant

    The errors are in demos, not in core. Let me filter for only core errors

  44. DeepSeek Assistant

    It says there's no such file or directory... but we're in /tiptap. Let me check.

  45. DeepSeek Assistant

    I see, the current directory is /tiptap/packages/core. Let me check from

  46. DeepSeek Assistant

    Let me run the TypeScript check from the correct

  47. DeepSeek Assistant

    No errors for our files. Let me also run the core tests to make sure nothing breaks:

  48. DeepSeek Assistant

    All 377 tests pass. Now let me create a test script to verify the fix works correctly for the described behavior:

  49. DeepSeek Assistant

    Now let me run the test script

  50. DeepSeek Assistant

    Let me fix the script to use absolute paths

  51. DeepSeek Assistant

    Let me check how other files import these modules:

  52. DeepSeek Assistant

    Let me look at how existing test files import modules:

  53. DeepSeek Assistant

    Let me create a test using vitest within the core package

  54. DeepSeek Assistant

    Now let me run the test:

  55. DeepSeek Assistant

    All 4 tests pass. Let me also run the full test suite to make sure nothing is broken:

  56. DeepSeek Assistant

    All 381 tests pass. Now let me remove the test file as instructed (we should not add new tests

  57. DeepSeek Assistant

    Now let me verify the final state of both modified files:

  58. DeepSeek Assistant

    Let me see the bottom part of Mark.ts where I added the clearable property

  59. DeepSeek Assistant

    I notice a missing blank line before the /** comment for Attributes. Let me fix that:

  60. DeepSeek Assistant

    Now let me verify the unsetAllMarks.ts file:

  61. DeepSeek Assistant

    Let me run the full test suite one more time to confirm everything passes:

  62. DeepSeek Assistant

    All 377 tests pass. Let me check the git diff to verify all changes are correct:

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