瀏覽代碼

make `getWidgetElement()` always return single elem

wangweimin 3 年之前
父節點
當前提交
364059ae8a
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      webiojs/src/models/output.ts

+ 3 - 0
webiojs/src/models/output.ts

@@ -280,6 +280,9 @@ export function getWidgetElement(spec: any) {
         throw Error("Unknown type in getWidgetElement() :" + spec.type);
 
     let elem = type2widget[spec.type].get_element(spec);
+    if (elem.length != 1)
+        elem = $(document.createElement('div')).append(elem);
+
     if (spec.style) {
         // add style attribute
         let old_style = elem.attr('style') || '';