mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -422,6 +422,14 @@ class Smarts(NullSmarts):
|
||||
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…
x
Reference in New Issue
Block a user