mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
workaround for google images+safari
This commit is contained in:
parent
4b217664aa
commit
76ed611bc0
1 changed files with 9 additions and 4 deletions
|
|
@ -1117,13 +1117,18 @@ class EditorWebView(AnkiWebView):
|
||||||
url = mime.urls()[0].toString()
|
url = mime.urls()[0].toString()
|
||||||
# chrome likes to give us the URL twice with a \n
|
# chrome likes to give us the URL twice with a \n
|
||||||
url = url.splitlines()[0]
|
url = url.splitlines()[0]
|
||||||
mime = QMimeData()
|
newmime = QMimeData()
|
||||||
link = self.editor.urlToLink(url)
|
link = self.editor.urlToLink(url)
|
||||||
if link:
|
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:
|
else:
|
||||||
mime.setText(url)
|
newmime.setText(url)
|
||||||
return mime
|
return newmime
|
||||||
|
|
||||||
# if the user has used 'copy link location' in the browser, the clipboard
|
# 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
|
# will contain the URL as text, and no URLs or HTML. the URL will already
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue