Commit 5dda8631 by pangchong

fix(TableEditor): 修正合并单元格及列宽判断逻辑

- 优化拖拽调整列宽手柄的v-if条件,移除多余括号
- 格式化TableMergeModal组件中的useTableMergeModal解构代码
- 修正文本节点默认标签赋值逻辑,保证优先使用CHINESE_FIRST_PARA_TAGS首项
- 保持代码风格统一,提升可读性和维护性
parent 318eff57
...@@ -132,17 +132,8 @@ const emit = defineEmits<{ ...@@ -132,17 +132,8 @@ const emit = defineEmits<{
(e: 'confirm', retainedItems: MergeContentItem[], params: TableMergeModalOpenParams): void (e: 'confirm', retainedItems: MergeContentItem[], params: TableMergeModalOpenParams): void
}>() }>()
const { const { show, cellGroups, open, presetActions, isGroupSelected, isGroupIndeterminate, toggleGroup, previewCellNode, handleConfirm } =
show, useTableMergeModal(emit)
cellGroups,
open,
presetActions,
isGroupSelected,
isGroupIndeterminate,
toggleGroup,
previewCellNode,
handleConfirm
} = useTableMergeModal(emit)
defineExpose({ open }) defineExpose({ open })
</script> </script>
...@@ -1061,7 +1061,7 @@ export function useTableEditor(props: { node: XmlNode }, options?: { mergeModalR ...@@ -1061,7 +1061,7 @@ export function useTableEditor(props: { node: XmlNode }, options?: { mergeModalR
const cloned = cloneXmlNode(item.xmlNode, topLeftCellXml.id) const cloned = cloneXmlNode(item.xmlNode, topLeftCellXml.id)
newChildren.push(cloned) newChildren.push(cloned)
} else if (item.text && item.text.trim()) { } else if (item.text && item.text.trim()) {
const defaultTag = item.tagName && item.tagName !== 'ENTRY' ? item.tagName : (CHINESE_FIRST_PARA_TAGS[0] || 'PARAC') const defaultTag = item.tagName && item.tagName !== 'ENTRY' ? item.tagName : CHINESE_FIRST_PARA_TAGS[0] || 'PARAC'
const newParaNode: XmlNode = { const newParaNode: XmlNode = {
id: crypto.randomUUID(), id: crypto.randomUUID(),
tagName: defaultTag, tagName: defaultTag,
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
</template> </template>
<!-- 拖拽调整列宽手柄 --> <!-- 拖拽调整列宽手柄 -->
<div <div
v-if="!isDiffMode && ((cell.colIdx ?? 0) + (cell.colspan ?? 1)) < structure.cols" v-if="!isDiffMode && (cell.colIdx ?? 0) + (cell.colspan ?? 1) < structure.cols"
class="absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/40 active:bg-primary/60 transition-colors z-20 select-none" class="absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/40 active:bg-primary/60 transition-colors z-20 select-none"
@mousedown.stop.prevent="handleResizeStart(cell, $event)" @mousedown.stop.prevent="handleResizeStart(cell, $event)"
></div> ></div>
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
</template> </template>
<!-- 拖拽调整列宽手柄 --> <!-- 拖拽调整列宽手柄 -->
<div <div
v-if="!isDiffMode && ((cell.colIdx ?? 0) + (cell.colspan ?? 1)) < structure.cols" v-if="!isDiffMode && (cell.colIdx ?? 0) + (cell.colspan ?? 1) < structure.cols"
class="absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/40 active:bg-primary/60 transition-colors z-20 select-none" class="absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/40 active:bg-primary/60 transition-colors z-20 select-none"
@mousedown.stop.prevent="handleResizeStart(cell, $event)" @mousedown.stop.prevent="handleResizeStart(cell, $event)"
></div> ></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