Skip to content

Commit

Permalink
Accept array like (e.g. Fluent) for createButton container
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanceylan committed Oct 16, 2024
1 parent 726cafb commit 969e494
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/corelib/src/ui/widgets/toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fluent, IconClassName, iconClassName } from "../../base";
import { Fluent, IconClassName, iconClassName, isArrayLike } from "../../base";
import { Decorators } from "../../types/decorators";
import { Widget } from "./widget";

Expand Down Expand Up @@ -110,7 +110,11 @@ export class Toolbar<P extends ToolbarOptions = ToolbarOptions> extends Widget<P

declare protected mouseTrap: any;

createButton(container: ParentNode, tb: ToolButton): HTMLElement {
createButton(container: ParentNode | ArrayLike<ParentNode>, tb: ToolButton): HTMLElement {

if (isArrayLike(container)) {
container = container[0];
}

if (tb.separator === 'right' || tb.separator === 'both') {
container.appendChild(<div class="separator" />);
Expand Down

0 comments on commit 969e494

Please sign in to comment.