From 6cc9b5cde4686df130716e08189ffffa893ac360 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 8 Aug 2018 12:46:51 +1000 Subject: [PATCH] favour urls over images in local file case fixes copying&pasting from finder pasting icons instead of actual image https://anki.tenderapp.com/discussions/ankidesktop/29082-found-several-issues-in-anki-21 --- aqt/editor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index a15194e9c..f3bcf2bbc 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -878,7 +878,14 @@ class EditorWebView(AnkiWebView): html, internal = self._processHtml(mime) if html: return html, internal - for fn in (self._processImage, self._processUrls, self._processText): + + # favour url if it's a local link + if mime.hasUrls() and mime.urls()[0].toString().startswith("file://"): + types = (self._processUrls, self._processImage, self._processText) + else: + types = (self._processImage, self._processUrls, self._processText) + + for fn in types: html = fn(mime) if html: return html, False