Skip to content

Commit eac1828

Browse files
committed
Improve types for toolbar
1 parent 382222b commit eac1828

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

modules/toolbar.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ class Toolbar extends Module<ToolbarProps> {
162162
option = input.querySelector(`option[value="${value}"]`);
163163
}
164164
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;
169169
} else {
170170
option.selected = true;
171171
}
@@ -214,24 +214,22 @@ function addControls(
214214
// @ts-expect-error
215215
groups = [groups];
216216
}
217-
groups.forEach(controls => {
217+
groups.forEach((controls: any) => {
218218
const group = document.createElement('span');
219219
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);
224228
} 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);
232230
}
233-
});
234-
}
231+
}
232+
});
235233
container.appendChild(group);
236234
});
237235
}

0 commit comments

Comments
 (0)