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
77b4b5b1
Commit
77b4b5b1
authored
Jul 29, 2026
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 防止选中后重新唤起
parent
1bb9b364
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
src/components/CommonXmlEditor.vue
+15
-3
No files found.
src/components/CommonXmlEditor.vue
View file @
77b4b5b1
...
...
@@ -469,7 +469,8 @@ const xmlCompletionSource = (context: CompletionContext) => {
return
{
from
:
context
.
pos
-
typedAttr
.
length
,
options
options
,
validFor
:
/^
[
a-zA-Z0-9_-
]
*$/
}
}
}
else
{
...
...
@@ -489,6 +490,13 @@ const xmlCompletionSource = (context: CompletionContext) => {
const
attrDef
=
attrs
[
attrName
]
if
(
attrDef
&&
attrDef
.
enumValues
&&
attrDef
.
enumValues
.
length
>
0
)
{
const
typedVal
=
tagText
.
substring
(
lastQuoteIdx
+
1
)
// 如果非显式快捷键唤起(自动补全),且当前已完整匹配其中一个属性值候选,则无需弹窗提示
const
isExactMatch
=
attrDef
.
enumValues
.
some
((
val
)
=>
val
.
toLowerCase
()
===
typedVal
.
toLowerCase
())
if
(
!
context
.
explicit
&&
isExactMatch
)
{
return
null
}
const
options
=
attrDef
.
enumValues
.
map
((
val
)
=>
{
return
{
label
:
val
,
...
...
@@ -500,7 +508,8 @@ const xmlCompletionSource = (context: CompletionContext) => {
return
{
from
:
context
.
pos
-
typedVal
.
length
,
options
options
,
validFor
:
/^
[
a-zA-Z0-9_-
]
*$/
}
}
}
...
...
@@ -644,7 +653,10 @@ const initCodeMirror = () => {
}
// 如果是用户编辑(输入或删除)导致的变化,且当前正处于可能需要提示的上下文中,自动激活提示
const
isUserEdit
=
update
.
transactions
.
some
((
tr
)
=>
tr
.
isUserEvent
(
'input'
)
||
tr
.
isUserEvent
(
'delete'
))
// 注意:如果是通过下拉列表选中补全项(input.complete),则不再重新唤起 startCompletion
const
isUserEdit
=
update
.
transactions
.
some
(
(
tr
)
=>
(
tr
.
isUserEvent
(
'input'
)
||
tr
.
isUserEvent
(
'delete'
))
&&
!
tr
.
isUserEvent
(
'input.complete'
)
)
if
(
isUserEdit
)
{
const
mainSelection
=
update
.
state
.
selection
.
main
if
(
mainSelection
.
empty
)
{
...
...
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