mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-29 07:03:02 +02:00
Edit book: When changing a paragraph to a heading if the cursor is adjacent to a paragraph tag but not inside any tags other than body, use the adjacent tag
This commit is contained in:
parent
932c37d9e1
commit
95fc272b5b
1 changed files with 8 additions and 0 deletions
|
|
@ -422,6 +422,14 @@ def rename_block_tag(self, editor, new_name):
|
|||
tag = find_closest_containing_block_tag(block, offset)
|
||||
|
||||
if tag is not None:
|
||||
if tag.name == 'body':
|
||||
ntag = find_closest_containing_block_tag(block, offset + 1)
|
||||
if ntag is not None and ntag.name != 'body':
|
||||
tag = ntag
|
||||
elif offset > 0:
|
||||
ntag = find_closest_containing_block_tag(block, offset - 1)
|
||||
if ntag is not None and ntag.name != 'body':
|
||||
tag = ntag
|
||||
closing_tag = find_closing_tag(tag)
|
||||
if closing_tag is None:
|
||||
return error_dialog(editor, _('Invalid HTML'), _(
|
||||
|
|
|
|||
Loading…
Reference in a new issue