Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 4ac57c6

Browse files
committed
fix(client): note icon not hiding after switching notes (closes #964)
1 parent 06e1b0f commit 4ac57c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/public/app/widgets/note_icon.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import server from "../services/server.js";
55
import type FNote from "../entities/fnote.js";
66
import type { EventData } from "../components/app_context.js";
77
import type { Icon } from "./icon_list.js";
8+
import { Dropdown } from "bootstrap";
89

910
const TPL = `
1011
<div class="note-icon-widget dropdown">
@@ -88,6 +89,7 @@ interface IconToCountCache {
8889

8990
export default class NoteIconWidget extends NoteContextAwareWidget {
9091

92+
private dropdown!: bootstrap.Dropdown;
9193
private $icon!: JQuery<HTMLElement>;
9294
private $iconList!: JQuery<HTMLElement>;
9395
private $iconCategory!: JQuery<HTMLElement>;
@@ -96,6 +98,8 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
9698

9799
doRender() {
98100
this.$widget = $(TPL);
101+
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
102+
99103
this.$icon = this.$widget.find("button.note-icon");
100104
this.$iconList = this.$widget.find(".icon-list");
101105
this.$iconList.on("click", "span", async (e) => {
@@ -130,6 +134,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
130134

131135
async refreshWithNote(note: FNote) {
132136
this.$icon.removeClass().addClass(`${note.getIcon()} note-icon`);
137+
this.dropdown.hide();
133138
}
134139

135140
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {

0 commit comments

Comments
 (0)