fix: refocus when cursor is not focused #685
This commit is contained in:
@@ -129,8 +129,11 @@ export class Cursor {
|
||||
const agentCursorDom = this.cursorAgent.getAgentCursorDom()
|
||||
if (isFocus) {
|
||||
setTimeout(() => {
|
||||
agentCursorDom.focus()
|
||||
agentCursorDom.setSelectionRange(0, 0)
|
||||
// 光标不聚焦时重新定位
|
||||
if (document.activeElement !== agentCursorDom) {
|
||||
agentCursorDom.focus()
|
||||
agentCursorDom.setSelectionRange(0, 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
// fillText位置 + 文字基线到底部距离 - 模拟光标偏移量
|
||||
|
||||
Reference in New Issue
Block a user