Commit b616f3bd by pangchong

style(editor): 优化代码格式和模板组件结构

- 合并多行函数参数为单行提升代码简洁度
- 调整模板组件中标签格式,增加可读性和缩进一致性
- 移除多余空行和尾部空白,规范代码风格
- 优化弹窗组件的属性写法,使结构更紧凑清晰
- 调整表格单元格内容缩进,提升视图排版一致性
parent a43e8977
......@@ -632,11 +632,7 @@ export const useEditorStore = defineStore('editor', {
return newNodes.length
},
insertXmlNodeFragment(
fragment: XmlNode,
mode: 'above' | 'below' | 'inside' | 'replace' | 'append-root',
targetNodeId?: string
) {
insertXmlNodeFragment(fragment: XmlNode, mode: 'above' | 'below' | 'inside' | 'replace' | 'append-root', targetNodeId?: string) {
if (!this.xmlTree) {
throw new Error('当前编辑器未加载任何 XML 文档!')
}
......
......@@ -1190,7 +1190,9 @@
<td
class="px-2 border border-black dark:border-white/40 font-bold text-center w-20"
:class="node.attributes?.MERGED === 'TRUE' ? '' : 'bg-fill-2/50'"
>操作人 MECH</td>
>
操作人 MECH
</td>
<td class="px-2 border border-black dark:border-white/40 text-center w-28 font-mono">
{{ node.attributes.mech ? `${node.attributes.mech} ${node.attributes.mechName || ''}` : '——' }}
</td>
......
......@@ -130,4 +130,3 @@ export const getEditorBlocks = (node: XmlNode): EditorBlock[] => {
walk(node)
return blocks
}
......@@ -310,10 +310,7 @@ export function useStashModal() {
}
}
const handleApplyFragment = async (
item: StashItem,
mode: 'above' | 'below' | 'inside' | 'replace' | 'append-root'
) => {
const handleApplyFragment = async (item: StashItem, mode: 'above' | 'below' | 'inside' | 'replace' | 'append-root') => {
if (mode === 'replace') {
try {
await window.$dialog?.warning({
......
......@@ -175,16 +175,24 @@
<div class="flex items-center gap-1.5 text-xs min-w-0 shrink-0">
<span class="text-[11px] text-color3">当前目标:</span>
<template v-if="selectedNode">
<span class="inline-flex items-center gap-1 font-mono text-[11px] bg-primary/10 text-primary border border-primary/20 px-2 py-0.5 rounded font-medium">
<span
class="inline-flex items-center gap-1 font-mono text-[11px] bg-primary/10 text-primary border border-primary/20 px-2 py-0.5 rounded font-medium"
>
&lt;{{ selectedNode.tagName }}&gt;
<span v-if="isRootSelected" class="text-[10px] text-color3 font-sans">(根节点)</span>
</span>
<span v-if="selectedNodeParent" class="text-[10px] text-color3 max-w-[160px] truncate" :title="selectedNodeParent.tagName">
<span
v-if="selectedNodeParent"
class="text-[10px] text-color3 max-w-[160px] truncate"
:title="selectedNodeParent.tagName"
>
父级: &lt;{{ selectedNodeParent.tagName }}&gt;
</span>
</template>
<template v-else>
<span class="text-[11px] text-warning flex items-center gap-1 bg-warning/10 px-2 py-0.5 rounded border border-warning/20">
<span
class="text-[11px] text-warning flex items-center gap-1 bg-warning/10 px-2 py-0.5 rounded border border-warning/20"
>
<n-icon><AlertCircleOutline /></n-icon>
未选中节点
</span>
......
......@@ -6,4 +6,3 @@ export interface ViewEffectState {
loading: boolean
blocks: EditorBlock[]
}
<template>
<CommonModal
v-model="visible"
:title="title"
:width="900"
:loading="loading"
:show-confirm="false"
cancel-text="关闭"
>
<CommonModal v-model="visible" :title="title" :width="900" :loading="loading" :show-confirm="false" cancel-text="关闭">
<div class="min-h-[400px] p-2">
<!-- 渲染文档树效果(时间切片分批流式渲染,保持60FPS高刷与瞬时首屏) -->
<div v-if="blocks.length > 0" class="space-y-1">
......@@ -61,5 +54,3 @@ defineExpose({
</script>
<style scoped></style>
<template>
<CommonModal
v-model="visible"
title="插入 XML 模板"
:width="750"
:loading="loading"
confirm-text="确认插入"
@confirm="handleInsert"
>
<CommonModal v-model="visible" title="插入 XML 模板" :width="750" :loading="loading" confirm-text="确认插入" @confirm="handleInsert">
<div class="flex flex-col space-y-4">
<div class="text-xs text-color3 bg-primary-1 p-3 rounded-lg border border-primary-3">
提示:模板中包含预先设计好的复杂节点结构(如 CALS 表格、多列配置等)。请选择要插入的模板,并直接进行插入。
......
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