Commit af2fbfbe by pangchong

refactor(compare): 优化代码格式与注释风格

- 统一 cloneWithDiff 函数的格式,删除多余空行
- 添加并规范子节点 ID 到新 ID 的映射注释
- 统一比对控制相关变量的注释风格
- 清理和规范比对模块中的多余空行
- 优化滚动同步相关代码的空行与注释
- 修正返回对象格式缩进,统一样式设置格式
- 去除 import 和代码中多余空白行,提高代码整洁度
parent 3c28c342
......@@ -8,10 +8,7 @@ import type { DiffStatusType, ScrollSide, RenderDiffHunk, XmlDiffHunk } from '..
import { MIN_THUMB_SIZE_PCT } from '../constants'
// 辅助函数:根据 status 克隆节点
function cloneWithDiff(
node: XmlNode,
status: DiffStatusType = 'none'
): XmlNode {
function cloneWithDiff(node: XmlNode, status: DiffStatusType = 'none'): XmlNode {
const children = node.children.map((c) => cloneWithDiff(c, status))
// 建立子节点原始 ID 到克隆后新 ID 的映射
......@@ -441,8 +438,6 @@ export function useCompareModal() {
}
}
// 核心比对逻辑(async:先格式化写回编辑器,让 UI 渲染加载动画后再执行重计算)
const handleCompare = async () => {
if (!leftXml.value.trim()) {
......
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