@@ -162,10 +162,10 @@ class Toolbar extends Module<ToolbarProps> {
162
162
option = input . querySelector ( `option[value="${ value } "]` ) ;
163
163
}
164
164
if ( option == null ) {
165
- if ( input instanceof HTMLSelectElement ) {
166
- input . value = '' ; // TODO make configurable?
167
- input . selectedIndex = - 1 ;
168
- }
165
+ // @ts -expect-error TODO fix me later
166
+ input . value = '' ; // TODO make configurable?
167
+ // @ts -expect-error TODO fix me later
168
+ input . selectedIndex = - 1 ;
169
169
} else {
170
170
option . selected = true ;
171
171
}
@@ -214,24 +214,22 @@ function addControls(
214
214
// @ts -expect-error
215
215
groups = [ groups ] ;
216
216
}
217
- groups . forEach ( controls => {
217
+ groups . forEach ( ( controls : any ) => {
218
218
const group = document . createElement ( 'span' ) ;
219
219
group . classList . add ( 'ql-formats' ) ;
220
- if ( Array . isArray ( controls ) ) {
221
- controls . forEach ( control => {
222
- if ( typeof control === 'string' ) {
223
- addButton ( group , control ) ;
220
+ controls . forEach ( ( control : any ) => {
221
+ if ( typeof control === 'string' ) {
222
+ addButton ( group , control ) ;
223
+ } else {
224
+ const format = Object . keys ( control ) [ 0 ] ;
225
+ const value = control [ format ] ;
226
+ if ( Array . isArray ( value ) ) {
227
+ addSelect ( group , format , value ) ;
224
228
} else {
225
- const format = Object . keys ( control ) [ 0 ] ;
226
- const value = control [ format ] ;
227
- if ( Array . isArray ( value ) ) {
228
- addSelect ( group , format , value ) ;
229
- } else {
230
- addButton ( group , format , value ) ;
231
- }
229
+ addButton ( group , format , value ) ;
232
230
}
233
- } ) ;
234
- }
231
+ }
232
+ } ) ;
235
233
container . appendChild ( group ) ;
236
234
} ) ;
237
235
}
0 commit comments