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:
dragonish 2025-06-20 21:02:04 +08:00
parent f640b8e515
commit 5aaa0605e5
No known key found for this signature in database
GPG key ID: 6F42FA9E807A5177
3 changed files with 38 additions and 52 deletions

View file

@ -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
);
}
/**

View file

@ -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
);
}
}

View file

@ -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
);
}
}