mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
check shift key when paste starts; avoid progress dlg for local file
https://anki.tenderapp.com/discussions/ankidesktop/26661-conot-paste-image-and-text-together-from-word-into-anki
This commit is contained in:
parent
b08e25dafb
commit
5cd063a8bd
1 changed files with 4 additions and 4 deletions
|
@ -610,7 +610,7 @@ to a cloze type first, via Edit>Change Note Type."""))
|
||||||
local = False
|
local = False
|
||||||
# fetch it into a temporary folder
|
# fetch it into a temporary folder
|
||||||
self.mw.progress.start(
|
self.mw.progress.start(
|
||||||
immediate=True, parent=self.parentWindow)
|
immediate=not local, parent=self.parentWindow)
|
||||||
ct = None
|
ct = None
|
||||||
try:
|
try:
|
||||||
if local:
|
if local:
|
||||||
|
@ -679,9 +679,8 @@ to a cloze type first, via Edit>Change Note Type."""))
|
||||||
html = str(doc)
|
html = str(doc)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def doPaste(self, html, internal):
|
def doPaste(self, html, internal, extended=False):
|
||||||
html = self._pastePreFilter(html, internal)
|
html = self._pastePreFilter(html, internal)
|
||||||
extended = self.mw.app.queryKeyboardModifiers() & Qt.ShiftModifier
|
|
||||||
if extended:
|
if extended:
|
||||||
extended = "true"
|
extended = "true"
|
||||||
else:
|
else:
|
||||||
|
@ -791,11 +790,12 @@ class EditorWebView(AnkiWebView):
|
||||||
self.triggerPageAction(QWebEnginePage.Copy)
|
self.triggerPageAction(QWebEnginePage.Copy)
|
||||||
|
|
||||||
def onPaste(self):
|
def onPaste(self):
|
||||||
|
extended = self.editor.mw.app.queryKeyboardModifiers() & Qt.ShiftModifier
|
||||||
mime = self.editor.mw.app.clipboard().mimeData(mode=QClipboard.Clipboard)
|
mime = self.editor.mw.app.clipboard().mimeData(mode=QClipboard.Clipboard)
|
||||||
html, internal = self._processMime(mime)
|
html, internal = self._processMime(mime)
|
||||||
if not html:
|
if not html:
|
||||||
return
|
return
|
||||||
self.editor.doPaste(html, internal)
|
self.editor.doPaste(html, internal, extended)
|
||||||
|
|
||||||
def dropEvent(self, evt):
|
def dropEvent(self, evt):
|
||||||
mime = evt.mimeData()
|
mime = evt.mimeData()
|
||||||
|
|
Loading…
Reference in a new issue