fix pin disappearing permanently
This commit is contained in:
13
main.ts
13
main.ts
@@ -77,12 +77,6 @@ export default class TabPinButtonPlugin extends Plugin {
|
||||
if (typeof leaf.setPinned === "function") leaf.setPinned(!pinned);
|
||||
else this.toggleViaViewState(leaf as WorkspaceLeaf, !pinned);
|
||||
this.syncButtonForHeader(header);
|
||||
// hide if pinned
|
||||
if (this.isHeaderPinned(header)) {
|
||||
btn.style.display = "none";
|
||||
} else {
|
||||
btn.style.display = "";
|
||||
}
|
||||
});
|
||||
|
||||
btn.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
@@ -105,6 +99,13 @@ export default class TabPinButtonPlugin extends Plugin {
|
||||
btn.classList.toggle(PINNED_CLASS, isPinned);
|
||||
btn.setAttribute("aria-pressed", isPinned ? "true" : "false");
|
||||
btn.title = isPinned ? "Unpin tab" : "Pin tab";
|
||||
|
||||
// hide if pinned
|
||||
if (this.isHeaderPinned(header)) {
|
||||
btn.style.display = "none";
|
||||
} else {
|
||||
btn.style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
private isHeaderPinned(header: HTMLElement): boolean {
|
||||
|
||||
Reference in New Issue
Block a user