mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Move icon name logic to Attachment and Reference classes - Create reusable setElementIcon Svelte action in ElementHelper - Update ChatArea and ChatAttachments to use new icon helper - Add visual separator and background color for message attachments - Fix duplicate URIs in drag-and-drop file handling - Improve attachment icon centering with flexbox layout
20 lines
No EOL
615 B
TypeScript
20 lines
No EOL
615 B
TypeScript
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);
|
|
}
|
|
}
|
|
};
|
|
} |