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:
|
if is_image:
|
||||||
c.insertImage(url)
|
c.insertImage(url)
|
||||||
else:
|
else:
|
||||||
|
oldfmt = QTextCharFormat(c.charFormat())
|
||||||
fmt = QTextCharFormat()
|
fmt = QTextCharFormat()
|
||||||
fmt.setAnchor(True)
|
fmt.setAnchor(True)
|
||||||
fmt.setAnchorHref(url)
|
fmt.setAnchorHref(url)
|
||||||
@ -590,6 +591,8 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
|||||||
cur = self.textCursor()
|
cur = self.textCursor()
|
||||||
cur.setPosition(i), cur.setPosition(i + 1, c.KeepAnchor)
|
cur.setPosition(i), cur.setPosition(i + 1, c.KeepAnchor)
|
||||||
cur.mergeCharFormat(fmt)
|
cur.mergeCharFormat(fmt)
|
||||||
|
c.setPosition(c.position())
|
||||||
|
c.setCharFormat(oldfmt)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
error_dialog(self, _('Invalid URL'),
|
error_dialog(self, _('Invalid URL'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user