Untitled conversation
- User
[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
unsetAllMarksto 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
unsetAllMarksto include comments, if we consider the comment tag a "mark," but at the same time I imagine users would generally not expectunsetAllMarksto delete comments.For now, as a workaround, we are calling
unsetMarkseparately for all non-comment marks, e.g.jseditor.chain().focus().unsetMark('link').unsetMark('bold').unsetMark('strike') ...... but would be nice to be able to use
unsetAllMarksagain for formatting-specific marks. Thanks!Browser Used
Chrome
Code Example (Preferred)
No response
Expected Behavior
unsetAllMarkswill 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: falsemust surviveunsetAllMarks(), whileunsetAllMarks({ignoreClearable: true})removes it. Callingcan().unsetAllMarks()on a selection containing only non-clearable marks is a successful no-op and must returntrue; explicitly callingunsetMarkmay 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.
- Assistant
I’ll trace the core command and mark configuration patterns, read the repository’s code/testing/versioning guidance, then implement focused tests and the fix.
- Assistant
The current command removes every ProseMirror mark indiscriminately. I’m checking how Tiptap resolves extension config callbacks so
clearablefollows existing inheritance andthissemantics, and how command tests modelcan()no-ops. - Assistant
The fix will remain opt-in for semantic marks: all existing marks stay clearable by default, while comments can set
clearable: false. The command will resolve function-valued/inherited configuration through the same extension machinery used elsewhere, and the override will preserve the old “remove everything” behavior. - Assistant
The focused behavior tests pass, including the
can()successful no-op and explicitunsetMarkescape hatch. I’m now validating formatting, type generation/build output, and the broader core test suite; I’ll adjust any API typing or integration issues that surface. - Assistant
Core’s build and all 382 core tests now pass, and the touched files are lint/format clean. The diff is limited to the new mark option, command behavior, regression tests, and a core changeset; I’m doing the repository-wide static/unit checks next.
- Assistant
Repository-wide lint and all 1,069 unit tests pass. The unit runner emitted existing happy-dom network/iframe cleanup noise, but exited successfully with 118/118 test files passing. I’m finishing with the monorepo build and final diff sanity check.
- Assistant
The full 73-package monorepo build passes. Because the repository checklist explicitly includes Chromium e2e validation, I’m running that final suite even though this change is covered at the core-command unit level.
- Assistant
The e2e suite could not launch because this workspace lacks Playwright’s Chromium binary; all failures are the same environment error before tests execute. I won’t download it because the task prohibits internet/external sources. The implementation’s unit, lint, and full-build validations are complete.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.