Skip to content

Commit

Permalink
feat: 在Markdown编辑器中支持表格行和单元格的节点操作,增强表格内部节点的验证逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Feb 19, 2025
1 parent d464914 commit 1b75fcd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MarkdownEditor/editor/plugins/withMarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const TableInlineNode = new Set([
'inline-katex',
'paragraph',
'footnoteDefinition',
'table-row',
'table-cell',
'media',
]);

Expand Down Expand Up @@ -213,13 +215,16 @@ export const withMarkdown = (editor: Editor) => {
) {
if (TableInlineNode.has(operation.node.type) || !operation.node.type) {
apply(operation);
return;
}
if (operation.node.type === 'card') {
const relativeNode = operation.node.children.at(1);
if (TableInlineNode.has(relativeNode.type)) {
apply(operation);
return;
}
}
console.log('parentNode', operation.node);
message.error('表格内部只支持行内节点!');
return;
}
Expand Down

1 comment on commit 1b75fcd

@vercel
Copy link

@vercel vercel bot commented on 1b75fcd Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.