fix(web): restore Tiptap Enter and list editing

This commit is contained in:
Amruth Pillai
2026-07-28 15:10:24 +02:00
parent c6ac3fd1a9
commit b303b89758
3 changed files with 256 additions and 236 deletions
+7 -7
View File
@@ -48,13 +48,13 @@
"@tanstack/react-hotkeys": "^0.10.0",
"@tanstack/react-query": "^5.101.4",
"@tanstack/react-router": "^1.170.18",
"@tiptap/extension-color": "^3.29.1",
"@tiptap/extension-highlight": "^3.29.1",
"@tiptap/extension-text-align": "^3.29.1",
"@tiptap/extension-text-style": "^3.29.1",
"@tiptap/pm": "^3.29.1",
"@tiptap/react": "^3.29.1",
"@tiptap/starter-kit": "^3.29.1",
"@tiptap/extension-color": "^3.29.2",
"@tiptap/extension-highlight": "^3.29.2",
"@tiptap/extension-text-align": "^3.29.2",
"@tiptap/extension-text-style": "^3.29.2",
"@tiptap/pm": "^3.29.2",
"@tiptap/react": "^3.29.2",
"@tiptap/starter-kit": "^3.29.2",
"@types/js-cookie": "^3.0.6",
"@uiw/color-convert": "^2.10.3",
"@uiw/react-color-colorful": "^2.10.3",
@@ -1,6 +1,33 @@
// @vitest-environment happy-dom
import { describe, expect, it } from "vitest";
import { Editor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import { resolveHighlightToolbarState } from "./rich-input.utils";
describe("Tiptap editing", () => {
it("creates a new paragraph when Enter is pressed", () => {
const editor = new Editor({ extensions: [StarterKit], content: "<p>First</p>" });
editor.commands.setTextSelection(editor.state.doc.content.size - 1);
editor.commands.enter();
expect(editor.getHTML()).toBe("<p>First</p><p></p>");
editor.destroy();
});
it("creates and splits list items", () => {
const editor = new Editor({ extensions: [StarterKit], content: "<p>First</p>" });
editor.commands.setTextSelection(editor.state.doc.content.size - 1);
editor.commands.toggleBulletList();
editor.commands.enter();
expect(editor.getHTML()).toBe("<ul><li><p>First</p></li><li><p></p></li></ul><p></p>");
editor.destroy();
});
});
describe("resolveHighlightToolbarState", () => {
it("shows legacy colorless highlights as default yellow and clearable", () => {
expect(resolveHighlightToolbarState(true, null)).toEqual({