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()
|
const agentCursorDom = this.cursorAgent.getAgentCursorDom()
|
||||||
if (isFocus) {
|
if (isFocus) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
agentCursorDom.focus()
|
// 光标不聚焦时重新定位
|
||||||
agentCursorDom.setSelectionRange(0, 0)
|
if (document.activeElement !== agentCursorDom) {
|
||||||
|
agentCursorDom.focus()
|
||||||
|
agentCursorDom.setSelectionRange(0, 0)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// fillText位置 + 文字基线到底部距离 - 模拟光标偏移量
|
// fillText位置 + 文字基线到底部距离 - 模拟光标偏移量
|
||||||
|
|||||||
Reference in New Issue
Block a user