优化了编辑器中的图片显示尺寸

This commit is contained in:
2025-10-12 21:09:03 +08:00
parent 1bb9b4a79e
commit b2fda14451
3 changed files with 146 additions and 19 deletions

View File

@@ -14,7 +14,7 @@
</div>
<div class="code-fun-flex-row code-fun-justify-between mt-17-5">
<!-- 便签正文第一行 -->
<span class="font_3 text_19">{{ content }}</span>
<span class="font_3 text_19">{{ displayContent }}</span>
<!-- 便签中是否存在图片 -->
<img v-if="hasImage" class="image_28" src="/assets/icons/drawable-xxhdpi/list_item_image_icon.png" />
</div>
@@ -81,6 +81,23 @@ const formattedDate = computed(() => {
return props.date
})
// 处理显示内容过滤HTML标签并只显示第一行
const displayContent = computed(() => {
console.log('NoteItem content:', props.content)
// 过滤HTML标签
let text = props.content.replace(/<[^>]*>/g, '')
console.log('NoteItem text without HTML:', text)
// 处理换行符,统一为\n
text = text.replace(/\\n/g, '\n')
// 按换行符分割并获取第一行
const lines = text.split('\n')
// 返回第一行内容,如果为空则显示默认文本
return lines[0]?.trim() || '无内容'
})
// 滑动阈值(删除按钮宽度)
const SLIDE_THRESHOLD = 64 // 4rem 转换为 px