mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
catch pastes too
This commit is contained in:
parent
fadf6fd249
commit
0499dd6cae
1 changed files with 10 additions and 0 deletions
|
|
@ -787,9 +787,13 @@ class EditorWebView(AnkiWebView):
|
|||
|
||||
def keyPressEvent(self, evt):
|
||||
self._curKey = True
|
||||
if evt.matches(QKeySequence.Paste):
|
||||
self.onPaste()
|
||||
return QWebView.keyPressEvent(self, evt)
|
||||
|
||||
def contextMenuEvent(self, evt):
|
||||
# adjust in case the user is going to paste
|
||||
self.onPaste()
|
||||
QWebView.contextMenuEvent(self, evt)
|
||||
|
||||
def dropEvent(self, evt):
|
||||
|
|
@ -813,6 +817,12 @@ class EditorWebView(AnkiWebView):
|
|||
evt.accept()
|
||||
QWebView.dropEvent(self, new)
|
||||
|
||||
def onPaste(self):
|
||||
clip = self.editor.mw.app.clipboard()
|
||||
mime = clip.mimeData()
|
||||
mime = self._processMime(mime)
|
||||
clip.setMimeData(mime)
|
||||
|
||||
def _processMime(self, mime):
|
||||
print "html=%s image=%s urls=%s txt=%s" % (
|
||||
mime.hasHtml(), mime.hasImage(), mime.hasUrls(), mime.hasText())
|
||||
|
|
|
|||
Loading…
Reference in a new issue