widgetAdd(widget) {
        const widget_type = widget.constructor.name;

        let widgets_array;
        let widgets_div;

        if (widget_type === 'ItempoolWidget') {
            widgets_array = this.itempool_widgets;
            widgets_div = this.itempool_div;
        }
        else {
            widgets_array = this.reorderable_widgets;
            widgets_div = this.reorderable_widgets_div;
        }

        widgets_array.push(widget);
        widgets_div.appendChild(widget.render());

        // Codeboxes won't render correctly unless refreshed AFTER appended to the dom
        const codebox = widget.dom_pointer.querySelector('.CodeMirror');
        if (codebox) {
            codebox.CodeMirror.refresh();
        }

        if (widget_type === 'ItemWidget' || widget_type === 'ItempoolWidget') {
            this.itempoolItemChangeAction();
        }
    }
/**
     * Add a widget to the notebook builder form.
     *
     * @param {Widget} widget
     */
Add a widget to the notebook builder form.
@param {Widget} widget
Add a widget to the notebook builder form . @param { Widget } widget
widgetAdd(widget) {
        const widget_type = widget.constructor.name;
        let widgets_array;
        let widgets_div;
        if (widget_type === 'ItempoolWidget') {
            widgets_array = this.itempool_widgets;
            widgets_div = this.itempool_div;
        }
        else {
            widgets_array = this.reorderable_widgets;
            widgets_div = this.reorderable_widgets_div;
        }
        widgets_array.push(widget);
        widgets_div.appendChild(widget.render());
        const codebox = widget.dom_pointer.querySelector('.CodeMirror');
        if (codebox) {
            codebox.CodeMirror.refresh();
        }
        if (widget_type === 'ItemWidget' || widget_type === 'ItempoolWidget') {
            this.itempoolItemChangeAction();
        }
    }
widgetAdd ( widget ) { const widget_type = widget . constructor . name ; let widgets_array ; let widgets_div ; if ( widget_type === 'ItempoolWidget' ) { widgets_array = this . itempool_widgets ; widgets_div = this . itempool_div ; } else { widgets_array = this . reorderable_widgets ; widgets_div = this . reorderable_widgets_div ; } widgets_array . push ( widget ) ; widgets_div . appendChild ( widget . render ( ) ) ; const codebox = widget . dom_pointer . querySelector ( '.CodeMirror' ) ; if ( codebox ) { codebox . CodeMirror . refresh ( ) ; } if ( widget_type === 'ItemWidget' || widget_type === 'ItempoolWidget' ) { this . itempoolItemChangeAction ( ) ; } }
Add a widget to the notebook builder form.
Add a widget to the notebook builder form .
// Codeboxes won't render correctly unless refreshed AFTER appended to the dom