"修复:便签内容为空检查逻辑,支持纯图片便签"

This commit is contained in:
yuantao
2025-10-17 13:05:28 +08:00
parent 836a3e1916
commit c47835e2ee

View File

@@ -214,6 +214,10 @@ const handleSave = async () => {
const isContentEmpty = content => { const isContentEmpty = content => {
if (!content) return true if (!content) return true
// 检查是否包含图片元素
const hasImages = /<img[^>]*>|<div[^>]*class="[^"]*editor-image[^"]*"[^>]*>/.test(content)
if (hasImages) return false
// 移除HTML标签和空白字符后检查是否为空 // 移除HTML标签和空白字符后检查是否为空
const plainText = content.replace(/<[^>]*>/g, '').trim() const plainText = content.replace(/<[^>]*>/g, '').trim()
if (plainText === '') return true if (plainText === '') return true