Skip to content

Commit 75f38fe

Browse files
fix: make e2e tests pass after adding alignment
1 parent 06a84ce commit 75f38fe

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/web/formats/EnrichedCheckboxList.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { type CommandProps } from '@tiptap/core';
22
import { TaskList } from '@tiptap/extension-list';
33

44
import { applyWrappingListToSelection } from './applyWrappingListToSelection';
5+
import { withPreservedAlignment } from './formatRules';
56

67
declare module '@tiptap/core' {
78
interface Commands<ReturnType> {
@@ -24,9 +25,11 @@ export const EnrichedCheckboxList = TaskList.extend({
2425
addCommands() {
2526
return {
2627
toggleCheckboxList: (checked: boolean) => {
27-
return ({ editor, commands, chain }: CommandProps): boolean => {
28+
return ({ editor, chain }: CommandProps): boolean => {
2829
if (editor.isActive('checkboxList')) {
29-
return commands.setParagraph();
30+
return withPreservedAlignment(editor, chain(), (c) =>
31+
c.clearNodes().setParagraph()
32+
);
3033
}
3134

3235
return applyWrappingListToSelection(

src/web/formats/EnrichedOrderedList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const EnrichedOrderedList = OrderedList.extend({
2727
({ editor, chain }) => {
2828
if (editor.isActive('orderedList')) {
2929
return withPreservedAlignment(editor, chain(), (c) =>
30-
c.setParagraph()
30+
c.clearNodes().setParagraph()
3131
);
3232
}
3333

src/web/formats/EnrichedUnorderedList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const EnrichedUnorderedList = BulletList.extend({
3737
({ editor, chain }: CommandProps) => {
3838
if (editor.isActive('unorderedList')) {
3939
return withPreservedAlignment(editor, chain(), (c) =>
40-
c.setParagraph()
40+
c.clearNodes().setParagraph()
4141
);
4242
}
4343

0 commit comments

Comments
 (0)