diff --git a/qt/aqt/data/web/js/editor.ts b/qt/aqt/data/web/js/editor.ts index e906bc4f6..0fdc20aea 100644 --- a/qt/aqt/data/web/js/editor.ts +++ b/qt/aqt/data/web/js/editor.ts @@ -176,19 +176,14 @@ const INLINE_TAGS = [ ]; function nodeIsInline(node: Node): boolean { - return ( - nodeIsText(node) || - INLINE_TAGS.includes((node as Element).tagName) - ); + return !nodeIsElement(node) || INLINE_TAGS.includes(node.tagName); } function inListItem(): boolean { const anchor = window.getSelection().anchorNode; - let n = nodeIsElement(anchor) ? anchor : anchor.parentElement; - let inList = false; - + let n = nodeIsElement(anchor) ? anchor : anchor.parentElement; while (n) { inList = inList || window.getComputedStyle(n).display == "list-item"; n = n.parentElement;