Commit e84a7c4c by pangchong

feat: 格式化代码

parent 846ea4b3
...@@ -833,7 +833,10 @@ ...@@ -833,7 +833,10 @@
<span class="text-xs font-bold text-color2 flex items-center space-x-2"> <span class="text-xs font-bold text-color2 flex items-center space-x-2">
<n-icon><ImageOutline /></n-icon> <n-icon><ImageOutline /></n-icon>
<span>工卡附图</span> <span>工卡附图</span>
<span v-if="getGraphicKey(node)" class="text-[11px] font-mono text-primary font-medium bg-primary/10 px-1.5 py-0.5 rounded border border-primary/20"> <span
v-if="getGraphicKey(node)"
class="text-[11px] font-mono text-primary font-medium bg-primary/10 px-1.5 py-0.5 rounded border border-primary/20"
>
KEY: {{ getGraphicKey(node) }} KEY: {{ getGraphicKey(node) }}
</span> </span>
</span> </span>
...@@ -848,7 +851,9 @@ ...@@ -848,7 +851,9 @@
@click.stop="editorStore.setSelectedNodeId(getReferencingNodes(node)[0].id, true)" @click.stop="editorStore.setSelectedNodeId(getReferencingNodes(node)[0].id, true)"
title="点击直接定位至引用当前插图的位置" title="点击直接定位至引用当前插图的位置"
> >
<template #icon><n-icon><NavigateOutline /></n-icon></template> <template #icon>
<n-icon><NavigateOutline /></n-icon>
</template>
定位引用位置 (&lt;{{ getReferencingNodes(node)[0].tagName }}&gt;) 定位引用位置 (&lt;{{ getReferencingNodes(node)[0].tagName }}&gt;)
</CommonButton> </CommonButton>
</template> </template>
...@@ -858,14 +863,14 @@ ...@@ -858,14 +863,14 @@
<n-popover trigger="click" placement="bottom-end"> <n-popover trigger="click" placement="bottom-end">
<template #trigger> <template #trigger>
<CommonButton size="tiny" type="primary" secondary @click.stop> <CommonButton size="tiny" type="primary" secondary @click.stop>
<template #icon><n-icon><LinkOutline /></n-icon></template> <template #icon>
<n-icon><LinkOutline /></n-icon>
</template>
定位引用位置 ({{ getReferencingNodes(node).length }}处) 定位引用位置 ({{ getReferencingNodes(node).length }}处)
</CommonButton> </CommonButton>
</template> </template>
<div class="p-2 space-y-1 min-w-[240px] select-none" @click.stop> <div class="p-2 space-y-1 min-w-[240px] select-none" @click.stop>
<div class="text-[11px] font-bold text-color3 pb-1 border-b border-divider mb-1"> <div class="text-[11px] font-bold text-color3 pb-1 border-b border-divider mb-1">引用当前插图的节点列表:</div>
引用当前插图的节点列表:
</div>
<div <div
v-for="refNode in getReferencingNodes(node)" v-for="refNode in getReferencingNodes(node)"
:key="refNode.id" :key="refNode.id"
...@@ -1486,7 +1491,11 @@ const getNodePreviewText = (node: XmlNode): string => { ...@@ -1486,7 +1491,11 @@ const getNodePreviewText = (node: XmlNode): string => {
const getRefTargetId = (node: XmlNode): string | null => { const getRefTargetId = (node: XmlNode): string | null => {
let refId = node.attributes?.REFID || node.attributes?.STRUCTID || node.attributes?.GRAPHICKEY || node.attributes?.GNBR let refId = node.attributes?.REFID || node.attributes?.STRUCTID || node.attributes?.GRAPHICKEY || node.attributes?.GNBR
if (!refId && node.textContent) { if (!refId && node.textContent) {
refId = node.textContent.trim().replace(/^\(?(?:Ref:\s*|参考:\s*)?|\)?$/gi, '').replace(/\[Sh\.\d+\]/gi, '').trim() refId = node.textContent
.trim()
.replace(/^\(?(?:Ref:\s*|参考:\s*)?|\)?$/gi, '')
.replace(/\[Sh\.\d+\]/gi, '')
.trim()
} }
if (refId) { if (refId) {
const target = editorStore.findNodeByRef(refId, 'GRAPHIC') const target = editorStore.findNodeByRef(refId, 'GRAPHIC')
......
...@@ -416,7 +416,7 @@ export function useNodeTree( ...@@ -416,7 +416,7 @@ export function useNodeTree(
const refTagStr = Array.from(referencingTags).join('/') const refTagStr = Array.from(referencingTags).join('/')
const refInfo = refCount > 0 ? ` [被 ${refTagStr} 引用 ${refCount} 次]` : '' const refInfo = refCount > 0 ? ` [被 ${refTagStr} 引用 ${refCount} 次]` : ''
attrSummary = key ? `KEY: ${key}${refInfo}` : (refInfo.trim() || 'GRAPHIC') attrSummary = key ? `KEY: ${key}${refInfo}` : refInfo.trim() || 'GRAPHIC'
subtitle = graphicTitle || getNodeTextPreview(node, false) subtitle = graphicTitle || getNodeTextPreview(node, false)
fullSubtitle = graphicTitle || getNodeTextPreview(node, true) fullSubtitle = graphicTitle || getNodeTextPreview(node, true)
} else if (node.tagName === 'GRPHCREF') { } else if (node.tagName === 'GRPHCREF') {
......
...@@ -309,7 +309,11 @@ const getTreeItemRefNodes = (node: any): any[] => { ...@@ -309,7 +309,11 @@ const getTreeItemRefNodes = (node: any): any[] => {
const getTreeItemTargetId = (node: any): string | null => { const getTreeItemTargetId = (node: any): string | null => {
let refId = node.attributes?.REFID || node.attributes?.STRUCTID || node.attributes?.GRAPHICKEY || node.attributes?.GNBR let refId = node.attributes?.REFID || node.attributes?.STRUCTID || node.attributes?.GRAPHICKEY || node.attributes?.GNBR
if (!refId && node.textContent) { if (!refId && node.textContent) {
refId = node.textContent.trim().replace(/^\(?(?:Ref:\s*|参考:\s*)?|\)?$/gi, '').replace(/\[Sh\.\d+\]/gi, '').trim() refId = node.textContent
.trim()
.replace(/^\(?(?:Ref:\s*|参考:\s*)?|\)?$/gi, '')
.replace(/\[Sh\.\d+\]/gi, '')
.trim()
} }
if (refId) { if (refId) {
const target = editorStore.findNodeByRef(refId, 'GRAPHIC') const target = editorStore.findNodeByRef(refId, 'GRAPHIC')
......
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