Commit a05473b7 by pangchong

style(editor): 优化渲染相关样式和模板格式

- 规范 .rules.md 中高亮与定位联动描述的缩进格式
- 简化 DocNodeRenderer 组件中动态 class 的写法
- 优化多处行内样式字符串拼接,移除多余的分号
- 合并多行模板标签为单行,提升可读性
- 统一 CSS 选择器中单引号使用,保证风格一致
- 保持 TXTGRPHC 相关元素的严格等宽与中英文比例样式
parent ac6e7e82
...@@ -457,11 +457,7 @@ ...@@ -457,11 +457,7 @@
<span <span
class="inline-flex items-baseline text-color1 cursor-pointer select-none" class="inline-flex items-baseline text-color1 cursor-pointer select-none"
:data-node-id="node.id" :data-node-id="node.id"
:class="[ :class="[editorStore.selectedNodeId === node.id ? 'ring-2 ring-primary ring-offset-1 rounded-sm bg-primary/20 px-0.5' : '']"
editorStore.selectedNodeId === node.id
? 'ring-2 ring-primary ring-offset-1 rounded-sm bg-primary/20 px-0.5'
: ''
]"
@click.stop="editorStore.setSelectedNodeId(node.id)" @click.stop="editorStore.setSelectedNodeId(node.id)"
> >
<template v-for="(child, idx) in node.children.filter((c) => c.tagName === 'TORVALUE')" :key="child.id"> <template v-for="(child, idx) in node.children.filter((c) => c.tagName === 'TORVALUE')" :key="child.id">
...@@ -477,11 +473,7 @@ ...@@ -477,11 +473,7 @@
<span <span
class="inline-flex items-center text-color1 cursor-pointer select-none font-mono underline hover:text-primary transition-all" class="inline-flex items-center text-color1 cursor-pointer select-none font-mono underline hover:text-primary transition-all"
:data-node-id="node.id" :data-node-id="node.id"
:class="[ :class="[editorStore.selectedNodeId === node.id ? 'ring-2 ring-primary ring-offset-1 rounded-sm bg-primary/20 px-0.5' : '']"
editorStore.selectedNodeId === node.id
? 'ring-2 ring-primary ring-offset-1 rounded-sm bg-primary/20 px-0.5'
: ''
]"
@click.stop="editorStore.setSelectedNodeId(node.id)" @click.stop="editorStore.setSelectedNodeId(node.id)"
> >
{{ formatTorvalue(node.attributes.MIN, node.attributes.MAX, node.attributes.UNIT) }} {{ formatTorvalue(node.attributes.MIN, node.attributes.MAX, node.attributes.UNIT) }}
...@@ -710,15 +702,10 @@ ...@@ -710,15 +702,10 @@
<template v-else-if="node.tagName === 'TXTGRPHC'"> <template v-else-if="node.tagName === 'TXTGRPHC'">
<div <div
class="my-2 font-mono text-sm leading-relaxed overflow-x-auto flex flex-col space-y-0.5" class="my-2 font-mono text-sm leading-relaxed overflow-x-auto flex flex-col space-y-0.5"
style="font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important; white-space: pre !important;" style="font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important; white-space: pre !important"
@click.stop="editorStore.setSelectedNodeId(node.id)" @click.stop="editorStore.setSelectedNodeId(node.id)"
> >
<DocNodeRenderer <DocNodeRenderer v-for="child in node.children" :key="child.id" :node="child" :parent="node" />
v-for="child in node.children"
:key="child.id"
:node="child"
:parent="node"
/>
</div> </div>
</template> </template>
...@@ -727,7 +714,7 @@ ...@@ -727,7 +714,7 @@
<div <div
contenteditable="true" contenteditable="true"
class="focus:outline-none focus:bg-fill-3 px-1 rounded min-h-[1.5em] transition-colors" class="focus:outline-none focus:bg-fill-3 px-1 rounded min-h-[1.5em] transition-colors"
style="font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important; white-space: pre !important;" style="font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important; white-space: pre !important"
@blur="handleTextBlur" @blur="handleTextBlur"
v-text="node.textContent" v-text="node.textContent"
></div> ></div>
...@@ -1137,10 +1124,10 @@ const { ...@@ -1137,10 +1124,10 @@ const {
color: inherit; color: inherit;
} }
/* 保护 TXTGRPHC 的严格等宽与中英文 2:1 比例 */ /* 保护 TXTGRPHC 的严格等宽与中英文 2:1 比例 */
[data-tag-name="TXTGRPHC"], [data-tag-name='TXTGRPHC'],
[data-tag-name="TXTGRPHC"] *, [data-tag-name='TXTGRPHC'] *,
[data-tag-name="TXTLINE"], [data-tag-name='TXTLINE'],
[data-tag-name="TXTLINE"] * { [data-tag-name='TXTLINE'] * {
font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important; font-family: 'NSimSun', '新宋体', 'SimSun', '宋体', monospace !important;
white-space: pre !important; white-space: pre !important;
} }
......
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