From 2e991f0a795b7b39953f69c4139370a71de97e4e Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 21 Jun 2022 21:33:28 +0800 Subject: [PATCH] tiptap: add list judge --- packages/client/src/tiptap/prose-utils/markdown.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/tiptap/prose-utils/markdown.ts b/packages/client/src/tiptap/prose-utils/markdown.ts index 3fb80d89..a9f9657b 100644 --- a/packages/client/src/tiptap/prose-utils/markdown.ts +++ b/packages/client/src/tiptap/prose-utils/markdown.ts @@ -3,6 +3,12 @@ export const isMarkdown = (text: string): boolean => { const html = text.match(/<\/?[a-z][\s\S]*>/i); if (html && html.length) return true; + // 无序列表 + if (/^[*|+|-]/.test(text)) return true; + + // 有序列表 + if (/^[0-9]+\)/.test(text)) return true; + // image const image = text.match(/!\[(\s|.)?\]\((\s|.)?\)/); if (image && image.length) return true;