mirror of
https://github.com/dragonish/obsidian-heading-decorator.git
synced 2026-07-22 05:42:05 +00:00
fix(plugin): fix decorators in third-party plugins that may not have hidden as expected
This issue occurs when the heading hides decorator is needed for note content changes.
This commit is contained in:
parent
f640b8e515
commit
5aaa0605e5
3 changed files with 38 additions and 52 deletions
|
|
@ -145,19 +145,17 @@ function decorateFileHeadingElement(
|
|||
opacity: OpacityOptions,
|
||||
position: PostionOptions
|
||||
): void {
|
||||
if (content) {
|
||||
element.dataset.headingDecorator = content;
|
||||
element.dataset.decoratorOpacity = `${opacity}%`;
|
||||
element.dataset.headingDecorator = content;
|
||||
element.dataset.decoratorOpacity = `${opacity}%`;
|
||||
|
||||
//? Remove potential residual class names
|
||||
element.classList.remove(
|
||||
position === "after" ? beforeDecoratorClassName : afterDecoratorClassName
|
||||
);
|
||||
element.classList.add(
|
||||
fileExplorerHeadingDecoratorClassName,
|
||||
position === "after" ? afterDecoratorClassName : beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
//? Remove potential residual class names
|
||||
element.classList.remove(
|
||||
position === "after" ? beforeDecoratorClassName : afterDecoratorClassName
|
||||
);
|
||||
element.classList.add(
|
||||
fileExplorerHeadingDecoratorClassName,
|
||||
position === "after" ? afterDecoratorClassName : beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -144,27 +144,21 @@ function decorateOutlineElement(
|
|||
opacity: OpacityOptions,
|
||||
position: PostionOptions
|
||||
): void {
|
||||
if (content) {
|
||||
const inner = element.querySelector<HTMLElement>(
|
||||
".tree-item-self .tree-item-inner"
|
||||
);
|
||||
if (inner) {
|
||||
inner.dataset.headingDecorator = content;
|
||||
inner.dataset.decoratorOpacity = `${opacity}%`;
|
||||
const inner = element.querySelector<HTMLElement>(
|
||||
".tree-item-self .tree-item-inner"
|
||||
);
|
||||
if (inner) {
|
||||
inner.dataset.headingDecorator = content;
|
||||
inner.dataset.decoratorOpacity = `${opacity}%`;
|
||||
|
||||
//? Remove potential residual class names
|
||||
inner.classList.remove(
|
||||
position === "after"
|
||||
? beforeDecoratorClassName
|
||||
: afterDecoratorClassName
|
||||
);
|
||||
inner.classList.add(
|
||||
outlineHeadingDecoratorClassName,
|
||||
position === "after"
|
||||
? afterDecoratorClassName
|
||||
: beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
//? Remove potential residual class names
|
||||
inner.classList.remove(
|
||||
position === "after" ? beforeDecoratorClassName : afterDecoratorClassName
|
||||
);
|
||||
inner.classList.add(
|
||||
outlineHeadingDecoratorClassName,
|
||||
position === "after" ? afterDecoratorClassName : beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,27 +143,21 @@ function decorateQuietOutlineElement(
|
|||
opacity: OpacityOptions,
|
||||
position: PostionOptions
|
||||
): void {
|
||||
if (content) {
|
||||
const nodeContent = element.querySelector<HTMLElement>(
|
||||
".n-tree-node-content"
|
||||
);
|
||||
if (nodeContent) {
|
||||
nodeContent.dataset.headingDecorator = content;
|
||||
nodeContent.dataset.decoratorOpacity = `${opacity}%`;
|
||||
const nodeContent = element.querySelector<HTMLElement>(
|
||||
".n-tree-node-content"
|
||||
);
|
||||
if (nodeContent) {
|
||||
nodeContent.dataset.headingDecorator = content;
|
||||
nodeContent.dataset.decoratorOpacity = `${opacity}%`;
|
||||
|
||||
//? Remove potential residual class names
|
||||
nodeContent.classList.remove(
|
||||
position === "after"
|
||||
? beforeDecoratorClassName
|
||||
: afterDecoratorClassName
|
||||
);
|
||||
nodeContent.classList.add(
|
||||
quietOutlineHeadingDecoratorClassName,
|
||||
position === "after"
|
||||
? afterDecoratorClassName
|
||||
: beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
//? Remove potential residual class names
|
||||
nodeContent.classList.remove(
|
||||
position === "after" ? beforeDecoratorClassName : afterDecoratorClassName
|
||||
);
|
||||
nodeContent.classList.add(
|
||||
quietOutlineHeadingDecoratorClassName,
|
||||
position === "after" ? afterDecoratorClassName : beforeDecoratorClassName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue