Commit 2b95d913 by pangchong

style(editor): 优化插入索引计算的代码格式

- 调整了插入索引计算代码的缩进和换行
- 增强了代码的可读性和结构清晰度
- 保持原有逻辑未做功能性修改
parent f7d98cfa
...@@ -558,7 +558,14 @@ export function useEditAreaContextMenu(props: EditAreaContextMenuProps, emit: (e ...@@ -558,7 +558,14 @@ export function useEditAreaContextMenu(props: EditAreaContextMenuProps, emit: (e
targetItem.node.mixedContent.push({ type: 'text', text: textVal }) targetItem.node.mixedContent.push({ type: 'text', text: textVal })
} else if (targetItem.parent) { } else if (targetItem.parent) {
const mixedIdx = targetItem.parent.mixedContent.findIndex((m: any) => m.nodeId === realId) const mixedIdx = targetItem.parent.mixedContent.findIndex((m: any) => m.nodeId === realId)
const insertIdx = mode === 'above' ? (mixedIdx !== -1 ? mixedIdx : 0) : (mixedIdx !== -1 ? mixedIdx + 1 : targetItem.parent.mixedContent.length) const insertIdx =
mode === 'above'
? mixedIdx !== -1
? mixedIdx
: 0
: mixedIdx !== -1
? mixedIdx + 1
: targetItem.parent.mixedContent.length
targetItem.parent.mixedContent.splice(insertIdx, 0, { type: 'text', text: textVal }) targetItem.parent.mixedContent.splice(insertIdx, 0, { type: 'text', text: textVal })
} }
targetItem.node.textContent = targetItem.node.mixedContent targetItem.node.textContent = targetItem.node.mixedContent
......
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