@@ -5,6 +5,7 @@ import server from "../services/server.js";
55import type FNote from "../entities/fnote.js" ;
66import type { EventData } from "../components/app_context.js" ;
77import type { Icon } from "./icon_list.js" ;
8+ import { Dropdown } from "bootstrap" ;
89
910const TPL = `
1011<div class="note-icon-widget dropdown">
@@ -88,6 +89,7 @@ interface IconToCountCache {
8889
8990export 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