Change nodeIsInline logic to be more typesafe
This commit is contained in:
parent
feddf96f2a
commit
9b5d915983
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user