Add drag/drop support when adding IO images (#3776)

* allow adding images via drag/drop when adding io

* support editing io notes as well

Co-authored-by: Abdo <abdo@abdnh.net>

---------

Co-authored-by: Abdo <abdo@abdnh.net>
This commit is contained in:
llama 2025-01-27 23:58:58 +08:00 committed by GitHub
parent 00501c267c
commit 56dd93b5be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1553,6 +1553,15 @@ class EditorWebView(AnkiWebView):
extended = self._wantsExtendedPaste()
mime = evt.mimeData()
assert mime is not None
if (
self.editor.state is EditorState.IO_PICKER
and (html := self._processUrls(mime, allowed_suffixes=pics))
and (path := self.editor.extract_img_path_from_html(html))
):
self.editor.setup_mask_editor(path)
return
evt_pos = evt.position()
cursor_pos = QPoint(int(evt_pos.x()), int(evt_pos.y()))