🐛 fix(vscode): 代码阅读预览跳到定义后页面还在长高(注释里的 mermaid 画成图、中文名到了)不再把视口带跑:页面滚动统一交给滚动所有者,跟住跳到的目标、用户自己滚了改钉视口顶部那块,关掉浏览器自带的滚动锚定
This commit is contained in:
1 parent
2fa6319dd4
commit
3c5f5f5f35
24 files changed
+1016
-149
No files matched your search
@@ -81,7 +81,8 @@ export function CodeEditor({ sourceText, place, version, autoFocus, onAutoFocuse
|
||||
const el = textareaRef.current
|
||||
if (!autoFocus || !el)
|
||||
return
|
||||
el.focus()
|
||||
// 编辑框就在刚点了「编辑」的那张卡片原处,看得见,不用滚
|
||||
el.focus({ preventScroll: true })
|
||||
el.setSelectionRange(el.value.length, el.value.length)
|
||||
onAutoFocused()
|
||||
}, [autoFocus, onAutoFocused])
|
||||
|
||||
Reference in new issue
Block a user