andy-stack_vaultkeeper-ai/Helpers/ElementHelper.ts

20 lines
615 B
TypeScript
Raw Normal View History

import { setIcon } from "obsidian";
export function getOuterHeight(element: HTMLElement): number {
const marginTop = parseFloat(getComputedStyle(element).marginTop) || 0;
const marginBottom = parseFloat(getComputedStyle(element).marginBottom) || 0;
return element.offsetHeight + marginTop + marginBottom;
}
export function setElementIcon(element: HTMLDivElement, iconName: string) {
if (element) {
setIcon(element, iconName);
}
return {
update(newIconName: string) {
if (element) {
setIcon(element, newIconName);
}
}
};
}