fix: refocus when cursor is not focused #685

main
Hufe921 2 years ago
parent 38b434fa65
commit 0ac8ae7c4b

@ -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位置 + 文字基线到底部距离 - 模拟光标偏移量

Loading…
Cancel
Save