mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-31 17:46:20 +01:00
E-book viewer: Fix regression that prevented pasting of text with formatting from the viewer. Fixes #1428018 [no copying with formatting in built-in ebook reader](https://bugs.launchpad.net/calibre/+bug/1428018)
This commit is contained in:
parent
899e66319a
commit
094449a000
1 changed files with 11 additions and 4 deletions
|
|
@ -8,9 +8,10 @@
|
|||
from base64 import b64encode
|
||||
from functools import partial
|
||||
|
||||
from PyQt5.Qt import (QSize, QSizePolicy, QUrl, Qt, pyqtProperty,
|
||||
QPainter, QPalette, QBrush, QDialog, QColor, QPoint, QImage, QRegion,
|
||||
QIcon, QAction, QMenu, pyqtSignal, QApplication, pyqtSlot, QKeySequence)
|
||||
from PyQt5.Qt import (
|
||||
QSize, QSizePolicy, QUrl, Qt, pyqtProperty, QPainter, QPalette, QBrush,
|
||||
QDialog, QColor, QPoint, QImage, QRegion, QIcon, QAction, QMenu,
|
||||
pyqtSignal, QApplication, pyqtSlot, QKeySequence, QMimeData)
|
||||
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
|
||||
from PyQt5.QtWebKit import QWebSettings, QWebElement
|
||||
|
||||
|
|
@ -674,7 +675,13 @@ def selected_text(self):
|
|||
return self.document.selectedText().replace(u'\u00ad', u'').strip()
|
||||
|
||||
def copy(self):
|
||||
QApplication.clipboard().setText(self.selected_text)
|
||||
self.document.triggerAction(self.document.Copy)
|
||||
c = QApplication.clipboard()
|
||||
html = c.text('html')[0].replace(u'\u00ad', u'').strip()
|
||||
md = QMimeData()
|
||||
md.setText(self.selected_text)
|
||||
md.setHtml(html)
|
||||
QApplication.clipboard().setMimeData(md)
|
||||
|
||||
def selection_changed(self):
|
||||
if self.manager is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue