mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix incorrect variable names in tooltip
Fixes #1903837 [Inserting hyperlink in editor: template variables do not work](https://bugs.launchpad.net/calibre/+bug/1903837)
This commit is contained in:
parent
3b5016c010
commit
3eb6365c96
@ -425,13 +425,14 @@ class Smarts(NullSmarts):
|
|||||||
template = template or DEFAULT_LINK_TEMPLATE
|
template = template or DEFAULT_LINK_TEMPLATE
|
||||||
template = template.replace('_TARGET_', prepare_string_for_xml(target, True))
|
template = template.replace('_TARGET_', prepare_string_for_xml(target, True))
|
||||||
offset = template.find('_TEXT_')
|
offset = template.find('_TEXT_')
|
||||||
|
template = template.replace('_TEXT_', text or '')
|
||||||
editor.highlighter.join()
|
editor.highlighter.join()
|
||||||
c = editor.textCursor()
|
c = editor.textCursor()
|
||||||
if c.hasSelection():
|
if c.hasSelection():
|
||||||
c.insertText('') # delete any existing selected text
|
c.insertText('') # delete any existing selected text
|
||||||
ensure_not_within_tag_definition(c)
|
ensure_not_within_tag_definition(c)
|
||||||
p = c.position() + offset
|
p = c.position() + offset
|
||||||
c.insertText(template.replace('_TEXT_', text or ''))
|
c.insertText(template)
|
||||||
c.setPosition(p) # ensure cursor is positioned inside the newly created tag
|
c.setPosition(p) # ensure cursor is positioned inside the newly created tag
|
||||||
editor.setTextCursor(c)
|
editor.setTextCursor(c)
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ class InsertLink(Dialog):
|
|||||||
in the template, they will be replaced by the source filename, the destination
|
in the template, they will be replaced by the source filename, the destination
|
||||||
filename and the anchor, respectively.
|
filename and the anchor, respectively.
|
||||||
''').format(
|
''').format(
|
||||||
'_TITLE_', '_TARGET', '_SOURCE_FILENAME_', '_DEST_FILENAME_', '_ANCHOR_'))
|
'_TEXT_', '_TARGET_', '_SOURCE_FILENAME_', '_DEST_FILENAME_', '_ANCHOR_'))
|
||||||
|
|
||||||
l.addWidget(self.bb)
|
l.addWidget(self.bb)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user