mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
After inserting a hyperlink restore text format
allows typing after inserting the link in the previous text style
This commit is contained in:
parent
113be27352
commit
350494d016
@ -576,6 +576,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
||||
if is_image:
|
||||
c.insertImage(url)
|
||||
else:
|
||||
oldfmt = QTextCharFormat(c.charFormat())
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setAnchor(True)
|
||||
fmt.setAnchorHref(url)
|
||||
@ -590,6 +591,8 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
||||
cur = self.textCursor()
|
||||
cur.setPosition(i), cur.setPosition(i + 1, c.KeepAnchor)
|
||||
cur.mergeCharFormat(fmt)
|
||||
c.setPosition(c.position())
|
||||
c.setCharFormat(oldfmt)
|
||||
|
||||
else:
|
||||
error_dialog(self, _('Invalid URL'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user