mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-30 15:23:55 +02: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
1 changed files with 3 additions and 0 deletions
|
|
@ -576,6 +576,7 @@ def do_insert_link(self, *args):
|
|||
if is_image:
|
||||
c.insertImage(url)
|
||||
else:
|
||||
oldfmt = QTextCharFormat(c.charFormat())
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setAnchor(True)
|
||||
fmt.setAnchorHref(url)
|
||||
|
|
@ -590,6 +591,8 @@ def do_insert_link(self, *args):
|
|||
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…
Reference in a new issue