Edit book: Fix pasting of image from clipboard using (Ctrl-V) not working

This commit is contained in:
Kovid Goyal 2019-03-05 10:07:48 +05:30
parent 20ba5d597f
commit 30e25ecf21
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -191,9 +191,9 @@ class TextEdit(PlainTextEdit):
return return
if md.hasImage(): if md.hasImage():
img = md.imageData() img = md.imageData()
if img is not None and img.isValid(): if img is not None and not img.isNull():
data = image_to_data(img, fmt='PNG') data = image_to_data(img, fmt='PNG')
name = add_file(get_name('dropped_image.png', data)) name = add_file(get_name('dropped_image.png'), data)
self.insert_image(get_href(name)) self.insert_image(get_href(name))
self.ensureCursorVisible() self.ensureCursorVisible()
return return