From 56dd93b5be107f7fa8cf78affa22f2e93d06b4ad Mon Sep 17 00:00:00 2001 From: llama <100429699+iamllama@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:58:58 +0800 Subject: [PATCH] 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 --------- Co-authored-by: Abdo --- qt/aqt/editor.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index b8a3804d0..8f5335ec0 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -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()))