Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
Ifar-Xml-Edtor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pangchong
Ifar-Xml-Edtor
Commits
e2062d14
Commit
e2062d14
authored
Jul 30, 2026
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 格式化代码
parent
233926ec
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
19 deletions
+13
-19
src/utils/dtdManager.ts
+7
-14
src/views/editor/components/EditorPanel/components/EditAreaContextMenuModal/functionals/index.ts
+0
-3
src/views/editor/components/EditorPanel/components/EditAreaContextMenuModal/index.vue
+6
-1
src/views/editor/components/NodeTree/functionals/index.ts
+0
-1
No files found.
src/utils/dtdManager.ts
View file @
e2062d14
...
...
@@ -392,11 +392,7 @@ function buildSequenceConstraints(model: DtdContentModel): Array<[string, string
* @param childIndex 要移动的子节点在 childTags 中的索引
* @returns { canMoveUp, canMoveDown }
*/
export
function
canMoveNode
(
parentTagName
:
string
,
childTags
:
string
[],
childIndex
:
number
):
{
canMoveUp
:
boolean
;
canMoveDown
:
boolean
}
{
export
function
canMoveNode
(
parentTagName
:
string
,
childTags
:
string
[],
childIndex
:
number
):
{
canMoveUp
:
boolean
;
canMoveDown
:
boolean
}
{
const
atTop
=
childIndex
<=
0
const
atBottom
=
childIndex
>=
childTags
.
length
-
1
...
...
@@ -450,7 +446,6 @@ export function canMoveNode(
}
}
/**
* 根据父节点 DTD 定义的子节点顺序进行排序
*/
...
...
@@ -511,18 +506,17 @@ export function checkCanMoveNode(
return
{
canMoveUp
:
false
,
canMoveDown
:
false
}
}
return
canMoveNode
(
parent
.
tagName
,
realSiblings
.
map
((
c
)
=>
c
.
tagName
),
realIdx
)
return
canMoveNode
(
parent
.
tagName
,
realSiblings
.
map
((
c
)
=>
c
.
tagName
),
realIdx
)
}
/**
* 通用节点移动执行函数(支持 mixedContent 数组与结构化 children 数组同步)
*/
export
function
moveNodeInParent
(
parent
:
XmlNode
|
null
|
undefined
,
nodeId
:
string
,
direction
:
'up'
|
'down'
,
isVirtual
:
boolean
=
false
):
boolean
{
export
function
moveNodeInParent
(
parent
:
XmlNode
|
null
|
undefined
,
nodeId
:
string
,
direction
:
'up'
|
'down'
,
isVirtual
:
boolean
=
false
):
boolean
{
if
(
!
parent
)
return
false
// 1. 如果父节点存在 mixedContent,优先在 mixedContent 中执行交换
...
...
@@ -589,4 +583,3 @@ export function moveNodeInParent(
return
false
}
src/views/editor/components/EditorPanel/components/EditAreaContextMenuModal/functionals/index.ts
View file @
e2062d14
...
...
@@ -293,7 +293,6 @@ export function useEditAreaContextMenu(props: EditAreaContextMenuProps, emit: (e
return
checkCanMoveNode
(
parent
,
nodeId
,
isVirtual
).
canMoveDown
})
// 根据 DTD 获取允许添加的子标签列表
const
allowedChildrenList
=
computed
<
string
[]
>
(()
=>
{
const
node
=
activeNode
.
value
...
...
@@ -582,8 +581,6 @@ export function useEditAreaContextMenu(props: EditAreaContextMenuProps, emit: (e
window
.
$message
.
warning
(
'下移失败'
)
}
}
}
const
pasteXmlOptions
=
computed
(()
=>
[
...
...
src/views/editor/components/EditorPanel/components/EditAreaContextMenuModal/index.vue
View file @
e2062d14
...
...
@@ -94,7 +94,12 @@
</n-dropdown>
<!-- 5b. 编辑顺序 -->
<n-dropdown
trigger=
"click"
:options=
"editOrderOptions"
:disabled=
"isTextNode || (!canMoveUpActive && !canMoveDownActive)"
@
select=
"runAction"
>
<n-dropdown
trigger=
"click"
:options=
"editOrderOptions"
:disabled=
"isTextNode || (!canMoveUpActive && !canMoveDownActive)"
@
select=
"runAction"
>
<CommonButton
type=
"warning"
secondary
block
:disabled=
"isTextNode || (!canMoveUpActive && !canMoveDownActive)"
>
<
template
#
icon
>
<n-icon><swap-vertical-outline
/></n-icon>
...
...
src/views/editor/components/NodeTree/functionals/index.ts
View file @
e2062d14
...
...
@@ -1484,7 +1484,6 @@ export function useNodeTree(
}
break
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment