Replace inline display styles with .macros-u-hidden class; setCssProps for tooltip

This commit is contained in:
James Clifford Spratt 2026-06-28 11:51:17 +01:00
parent a5612daa35
commit 5c7a2164ef
4 changed files with 9 additions and 7 deletions

View file

@ -20,7 +20,7 @@ export function registerProcessors(plugin: MacrosPlugin): void {
// instead of falling back to showing their raw source.
plugin.registerMarkdownCodeBlockProcessor('macrosmicro', (_source, el) => {
el.empty();
el.style.display = 'none';
el.addClass('macros-u-hidden');
});
plugin.logger.debug('All processors registered');

View file

@ -254,7 +254,7 @@ export class ManualFoodEntryModal extends Modal {
// Only show status section if we have added items
if (this.addedItems.length > 0) {
this.statusContainer.style.display = 'block';
this.statusContainer.removeClass('macros-u-hidden');
const addedHeader = this.statusContainer.createDiv({ cls: 'added-items-header' });
addedHeader.createEl('h3', {
@ -265,7 +265,7 @@ export class ManualFoodEntryModal extends Modal {
this.addedItemsList = this.statusContainer.createDiv({ cls: 'added-items-list' });
this.updateAddedItemsDisplay();
} else {
this.statusContainer.style.display = 'none';
this.statusContainer.addClass('macros-u-hidden');
}
}
@ -303,10 +303,10 @@ export class ManualFoodEntryModal extends Modal {
// Show/hide status section based on items
if (this.addedItems.length > 0) {
this.statusContainer.style.display = 'block';
this.statusContainer.removeClass('macros-u-hidden');
this.updateAddedItemsDisplay();
} else {
this.statusContainer.style.display = 'none';
this.statusContainer.addClass('macros-u-hidden');
}
}
@ -326,7 +326,7 @@ export class ManualFoodEntryModal extends Modal {
});
const body = section.createDiv({ cls: 'micronutrient-entry-body' });
body.style.display = 'none';
body.addClass('macros-u-hidden');
let expanded = false;
const toggle = () => {

View file

@ -16,7 +16,7 @@ function ensureTooltipEl(): HTMLDivElement {
if (!tooltipEl) {
tooltipEl = activeDocument.createElement('div');
tooltipEl.className = 'macro-tooltip macro-tooltip-hidden';
tooltipEl.setAttribute('style', '--x: -9999px; --y: -9999px;');
tooltipEl.setCssProps({ '--x': '-9999px', '--y': '-9999px' });
activeDocument.body.appendChild(tooltipEl);
}
return tooltipEl;

View file

@ -9292,3 +9292,5 @@ body:not(.theme-obsidian) .api-credentials-success {
font-size: 0.75rem;
color: var(--text-faint);
}
.macros-u-hidden { display: none !important; }