From b2db5ec118e335ab6b8eb1a592b05c8068bc80f0 Mon Sep 17 00:00:00 2001 From: Alius Date: Thu, 30 Mar 2023 13:19:50 +0300 Subject: [PATCH] Update h5peditor-semantic-structure.js --- scripts/h5peditor-semantic-structure.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/h5peditor-semantic-structure.js b/scripts/h5peditor-semantic-structure.js index 6f4b1cf7..f1b77596 100644 --- a/scripts/h5peditor-semantic-structure.js +++ b/scripts/h5peditor-semantic-structure.js @@ -206,8 +206,13 @@ H5PEditor.SemanticStructure = (function ($) { * @param {jQuery} $container */ self.appendTo = function ($container) { - // Use first widget by default - changeWidget(widgets[0].name); + if (widgets.name) { + changeWidget(widgets.name); + } else if (typeof widgets[0] === "object") { + changeWidget(widgets[0].name); + } else { + // + } $wrapper.appendTo($container); };