@@ -5,6 +5,7 @@ import server from "../services/server.js";
5
5
import type FNote from "../entities/fnote.js" ;
6
6
import type { EventData } from "../components/app_context.js" ;
7
7
import type { Icon } from "./icon_list.js" ;
8
+ import { Dropdown } from "bootstrap" ;
8
9
9
10
const TPL = `
10
11
<div class="note-icon-widget dropdown">
@@ -88,6 +89,7 @@ interface IconToCountCache {
88
89
89
90
export default class NoteIconWidget extends NoteContextAwareWidget {
90
91
92
+ private dropdown ! : bootstrap . Dropdown ;
91
93
private $icon ! : JQuery < HTMLElement > ;
92
94
private $iconList ! : JQuery < HTMLElement > ;
93
95
private $iconCategory ! : JQuery < HTMLElement > ;
@@ -96,6 +98,8 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
96
98
97
99
doRender ( ) {
98
100
this . $widget = $ ( TPL ) ;
101
+ this . dropdown = Dropdown . getOrCreateInstance ( this . $widget . find ( "[data-bs-toggle='dropdown']" ) [ 0 ] ) ;
102
+
99
103
this . $icon = this . $widget . find ( "button.note-icon" ) ;
100
104
this . $iconList = this . $widget . find ( ".icon-list" ) ;
101
105
this . $iconList . on ( "click" , "span" , async ( e ) => {
@@ -130,6 +134,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
130
134
131
135
async refreshWithNote ( note : FNote ) {
132
136
this . $icon . removeClass ( ) . addClass ( `${ note . getIcon ( ) } note-icon` ) ;
137
+ this . dropdown . hide ( ) ;
133
138
}
134
139
135
140
async entitiesReloadedEvent ( { loadResults } : EventData < "entitiesReloaded" > ) {
0 commit comments