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
ea9823e9
Commit
ea9823e9
authored
Jul 28, 2026
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 解决 点击编辑区内容时编辑区自动滚动/定位 的问题
parent
9b585f84
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
src/views/editor/components/EditorPanel/functionals/index.ts
+21
-2
src/views/editor/components/EditorPanel/index.vue
+3
-1
No files found.
src/views/editor/components/EditorPanel/functionals/index.ts
View file @
ea9823e9
...
@@ -389,9 +389,26 @@ export function useEditorPanel() {
...
@@ -389,9 +389,26 @@ export function useEditorPanel() {
})
})
}
}
const
isEditAreaClick
=
ref
(
false
)
let
clickTimer
:
ReturnType
<
typeof
setTimeout
>
|
null
=
null
const
handleViewportMouseDown
=
()
=>
{
isEditAreaClick
.
value
=
true
if
(
clickTimer
)
clearTimeout
(
clickTimer
)
clickTimer
=
setTimeout
(()
=>
{
isEditAreaClick
.
value
=
false
},
200
)
}
watch
(
watch
(
()
=>
editorStore
.
selectedNodeId
,
()
=>
editorStore
.
selectedNodeId
,
(
newId
)
=>
syncEditorScroll
(
newId
,
true
)
(
newId
)
=>
{
if
(
isEditAreaClick
.
value
)
{
isEditAreaClick
.
value
=
false
return
}
syncEditorScroll
(
newId
,
false
)
}
)
)
watch
(
watch
(
()
=>
editorStore
.
lastUndoRedoTime
,
()
=>
editorStore
.
lastUndoRedoTime
,
...
@@ -409,6 +426,8 @@ export function useEditorPanel() {
...
@@ -409,6 +426,8 @@ export function useEditorPanel() {
handleScroll
,
handleScroll
,
setBlockRef
,
setBlockRef
,
syncEditorScroll
,
syncEditorScroll
,
scrollTop
scrollTop
,
handleViewportMouseDown
}
}
}
}
src/views/editor/components/EditorPanel/index.vue
View file @
ea9823e9
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
class=
"flex-1 overflow-y-auto min-h-0 leading-relaxed relative"
class=
"flex-1 overflow-y-auto min-h-0 leading-relaxed relative"
@
scroll=
"handleScroll"
@
scroll=
"handleScroll"
@
contextmenu=
"handleContextMenu"
@
contextmenu=
"handleContextMenu"
@
mousedown=
"handleViewportMouseDown"
>
>
<!-- 占位撑高,模拟全量内容总高度 -->
<!-- 占位撑高,模拟全量内容总高度 -->
<div
:style=
"{ height: totalHeight + 'px', position: 'relative' }"
>
<div
:style=
"{ height: totalHeight + 'px', position: 'relative' }"
>
...
@@ -114,7 +115,8 @@ const {
...
@@ -114,7 +115,8 @@ const {
handleScroll
,
handleScroll
,
setBlockRef
,
setBlockRef
,
syncEditorScroll
,
syncEditorScroll
,
scrollTop
scrollTop
,
handleViewportMouseDown
}
=
useEditorPanel
()
}
=
useEditorPanel
()
const
findReplaceVisible
=
ref
(
false
)
const
findReplaceVisible
=
ref
(
false
)
...
...
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