mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Metadata editor: Fix adding an image to an empty comments block not working
This commit is contained in:
parent
8d693050a5
commit
9d848e14a7
@ -308,14 +308,14 @@ class EditorWidget(QWebView): # {{{
|
||||
|
||||
def fget(self):
|
||||
ans = u''
|
||||
check = unicode(self.page().mainFrame().toPlainText()).strip()
|
||||
if not check:
|
||||
return ans
|
||||
try:
|
||||
check = unicode(self.page().mainFrame().toPlainText()).strip()
|
||||
raw = unicode(self.page().mainFrame().toHtml())
|
||||
raw = xml_to_unicode(raw, strip_encoding_pats=True,
|
||||
resolve_entities=True)[0]
|
||||
raw = self.comments_pat.sub('', raw)
|
||||
if not check and '<img' not in raw.lower():
|
||||
return ans
|
||||
|
||||
try:
|
||||
root = html.fromstring(raw)
|
||||
|
Loading…
x
Reference in New Issue
Block a user