Commit c7097fff by pangchong

style(editor): 优化代码格式与简洁性

- 统一箭头函数参数括号使用
- 删除多余空行,优化代码间距
- 合并 CommonXmlEditor 组件标签为单行简写形式
- 简化条件表达式,提高代码可读性
- 删除函数文件中多余空行
parent 868627e6
......@@ -161,7 +161,7 @@ export function formatXmlText(xmlStr: string): string {
const cleanXml = xmlStr.trim().replace(/>\s+</g, '><')
// 正则分割标签与文本内容
const tokens = cleanXml.split(/(<[^>]+>)/g).filter(t => t.trim() !== '')
const tokens = cleanXml.split(/(<[^>]+>)/g).filter((t) => t.trim() !== '')
let indentLevel = 0
const lines: string[] = []
......
......@@ -25,7 +25,7 @@ export function useInsertFragmentModal() {
if (text && text.trim()) {
// 如果剪贴板内容含有 XML 标签,自动格式化后再填入
const raw = text.trim()
xmlContent.value = (raw.includes('<') || raw.includes('>')) ? formatXmlText(raw) : raw
xmlContent.value = raw.includes('<') || raw.includes('>') ? formatXmlText(raw) : raw
hasClipboardContent.value = true
}
}
......
import { useStashStore, type StashItem } from '@/store/stash'
import { useEditorStore } from '@/store/editor'
export function useStashModal() {
const visible = ref(false)
const stashStore = useStashStore()
......
......@@ -145,11 +145,7 @@
<div class="h-3 bg-fill-3 rounded w-2/3"></div>
</div>
<div v-else class="flex-grow min-h-0 flex flex-col">
<CommonXmlEditor
v-model="activeItemXmlText"
disabled
height="100%"
/>
<CommonXmlEditor v-model="activeItemXmlText" disabled height="100%" />
</div>
<!-- 操作面板 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment