mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A more robust modification of the copy process to only remove soft hyphens from the plain text content
This commit is contained in:
parent
094449a000
commit
ff82ba858c
@ -11,7 +11,7 @@ from functools import partial
|
|||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QSize, QSizePolicy, QUrl, Qt, pyqtProperty, QPainter, QPalette, QBrush,
|
QSize, QSizePolicy, QUrl, Qt, pyqtProperty, QPainter, QPalette, QBrush,
|
||||||
QDialog, QColor, QPoint, QImage, QRegion, QIcon, QAction, QMenu,
|
QDialog, QColor, QPoint, QImage, QRegion, QIcon, QAction, QMenu,
|
||||||
pyqtSignal, QApplication, pyqtSlot, QKeySequence, QMimeData)
|
pyqtSignal, QApplication, pyqtSlot, QKeySequence)
|
||||||
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
|
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
|
||||||
from PyQt5.QtWebKit import QWebSettings, QWebElement
|
from PyQt5.QtWebKit import QWebSettings, QWebElement
|
||||||
|
|
||||||
@ -677,10 +677,8 @@ class DocumentView(QWebView): # {{{
|
|||||||
def copy(self):
|
def copy(self):
|
||||||
self.document.triggerAction(self.document.Copy)
|
self.document.triggerAction(self.document.Copy)
|
||||||
c = QApplication.clipboard()
|
c = QApplication.clipboard()
|
||||||
html = c.text('html')[0].replace(u'\u00ad', u'').strip()
|
md = c.mimeData()
|
||||||
md = QMimeData()
|
|
||||||
md.setText(self.selected_text)
|
md.setText(self.selected_text)
|
||||||
md.setHtml(html)
|
|
||||||
QApplication.clipboard().setMimeData(md)
|
QApplication.clipboard().setMimeData(md)
|
||||||
|
|
||||||
def selection_changed(self):
|
def selection_changed(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user