fix drag/drop breaking when editor is zoomed (#3916)

This commit is contained in:
llama 2025-04-13 12:44:28 +08:00 committed by GitHub
parent 4f6dcb0b5b
commit 8b2a64852b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1053,9 +1053,10 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
if ret:
self.doPaste(html, internal, extended)
self.web.evalWithCallback(
f"focusIfField({cursor_pos.x()}, {cursor_pos.y()});", pasteIfField
)
zoom = self.web.zoomFactor()
x, y = int(cursor_pos.x() / zoom), int(cursor_pos.y() / zoom)
self.web.evalWithCallback(f"focusIfField({x}, {y});", pasteIfField)
def onPaste(self) -> None:
self.web.onPaste()