workaround for google images+safari

This commit is contained in:
Damien Elmes 2014-01-14 14:59:16 +09:00
parent 4b217664aa
commit 76ed611bc0

View file

@ -1117,13 +1117,18 @@ class EditorWebView(AnkiWebView):
url = mime.urls()[0].toString()
# chrome likes to give us the URL twice with a \n
url = url.splitlines()[0]
mime = QMimeData()
newmime = QMimeData()
link = self.editor.urlToLink(url)
if link:
mime.setHtml(link)
newmime.setHtml(link)
elif mime.hasImage():
# if we couldn't convert the url to a link and there's an
# image on the clipboard (such as copy&paste from
# google images in safari), use that instead
return self._processImage(mime)
else:
mime.setText(url)
return mime
newmime.setText(url)
return newmime
# if the user has used 'copy link location' in the browser, the clipboard
# will contain the URL as text, and no URLs or HTML. the URL will already