Skip to content

Commit aa9d3bb

Browse files
committed
fix(notes): 修复表格/任务列表样式失效(TipTap v3 补 tiptap 类 + --kb-border 变量)
1 parent 0e9c98d commit aa9d3bb

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎client/src/features/notes/components/CornellLayout.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function useCornellEditor(
3535
Placeholder.configure({ placeholder }),
3636
],
3737
content: initialContent,
38+
// TipTap v3 需显式声明 tiptap 类以启用 index.css 的 .tiptap 样式
39+
editorProps: { attributes: { class: 'tiptap' } },
3840
onUpdate: ({ editor: e }) => {
3941
onChangeRef.current(e.getJSON());
4042
},

‎client/src/features/notes/components/FreeTextBlock.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export default function FreeTextBlock({
6161
extensions: [StarterKit],
6262
content: initialContent,
6363
immediatelyRender: false,
64+
// TipTap v3 需显式声明 tiptap 类以启用 index.css 的 .tiptap 样式
65+
editorProps: { attributes: { class: 'tiptap' } },
6466
onFocus: () => onSelect(block.id, false),
6567
onUpdate: ({ editor: e }) => {
6668
const json = e.getJSON();

‎client/src/features/notes/hooks/useNoteEditor.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ export function useNoteEditor({ noteId, rawContent, noteKey, updateNote }: UseNo
105105
TextStyle,
106106
],
107107
content: initialContent,
108+
// TipTap v3 不再自动给编辑元素加 tiptap 类(v2 会自动加),
109+
// 需显式声明,否则 index.css 中 .tiptap 前缀的表格/任务列表/图片等样式全部失效。
110+
editorProps: { attributes: { class: 'tiptap' } },
108111
onUpdate: ({ editor: e }) => {
109112
// 传入 getter 而非预序列化字符串:getJSON/stringify 延迟到防抖回调内执行
110113
debouncedSave(() => JSON.stringify(e.getJSON()));

‎client/src/index.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ body {
133133

134134
.tiptap hr {
135135
border: none;
136-
border-top: 1px solid var(--kb-border);
136+
border-top: 1px solid var(--kb-border-default);
137137
margin: 1.5rem 0;
138138
}
139139

@@ -160,7 +160,7 @@ body {
160160
.tiptap table td,
161161
.tiptap table th {
162162
min-width: 1em;
163-
border: 1px solid var(--kb-border);
163+
border: 1px solid var(--kb-border-default);
164164
padding: 0.375rem 0.5rem;
165165
vertical-align: top;
166166
box-sizing: border-box;

0 commit comments

Comments
 (0)