Skip to content

Commit feb756d

Browse files
committed
fix(EditorToolbar): map dropdown items recursively to support kind
1 parent 4e1e426 commit feb756d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/runtime/components/EditorToolbar.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,24 @@ function getDropdownProps(item: EditorToolbarDropdownItem) {
271271
})
272272
}
273273
274-
function mapDropdownItem(item: EditorToolbarDropdownChildItem) {
275-
// If it's a separator or label (no 'kind' property), return as is
274+
function mapDropdownItem(item: EditorToolbarDropdownChildItem): any {
275+
// Recursively map children if present
276+
const children = 'children' in item && Array.isArray(item.children)
277+
? item.children.map(mapDropdownItem)
278+
: undefined
279+
280+
// If it's a separator or label (no 'kind' property), return with mapped children
276281
if (!('kind' in item)) {
277-
return item
282+
return children ? { ...item, children } : item
278283
}
279284
280285
const editorToolbarItem = item as EditorToolbarDropdownChildItem
281286
return {
282287
...editorToolbarItem,
288+
...(children && { children }),
283289
active: isActive(editorToolbarItem),
284290
disabled: isDisabled(editorToolbarItem),
285-
onClick: (e: MouseEvent) => onClick(e, editorToolbarItem)
291+
onSelect: (e: Event) => onClick(e as MouseEvent, editorToolbarItem)
286292
}
287293
}
288294

0 commit comments

Comments
 (0)