fix: HTML table fails to import with empty cells
This commit is contained in:
13
server/utils/turndown/utils.ts
Normal file
13
server/utils/turndown/utils.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export function inHtmlContext(node: HTMLElement, selector: string) {
|
||||
let currentNode = node;
|
||||
// start at the closest element
|
||||
while (currentNode !== null && currentNode.nodeType !== 1) {
|
||||
currentNode = (currentNode.parentElement ||
|
||||
currentNode.parentNode) as HTMLElement;
|
||||
}
|
||||
return (
|
||||
currentNode !== null &&
|
||||
currentNode.nodeType === 1 &&
|
||||
currentNode.closest(selector) !== null
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user