From 12e44e3aca4d9ea7296b76fdd392ac236f691dc7 Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Fri, 14 Jun 2024 13:22:00 +0200 Subject: [PATCH] Fix using default property --- scripts/h5peditor-library.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/h5peditor-library.js b/scripts/h5peditor-library.js index 259acb80..7f1023c0 100644 --- a/scripts/h5peditor-library.js +++ b/scripts/h5peditor-library.js @@ -37,6 +37,7 @@ ns.Library = function (parent, field, params, setValue) { this.changes = []; this.optionsLoaded = false; this.library = parent.library + '/' + field.name; + this.setValue = setValue; this.passReadies = true; parent.ready(function () { @@ -321,7 +322,20 @@ ns.Library.prototype.librariesLoaded = function (libList) { self.change(); self.runChangeCallback = false; } + // Load default library. + if (typeof this.params === 'string') { + const library = this.params; + + this.params = { + params: {} + }; + this.setValue(this.field, this.params); + + this.$select.val(library); + this.$select.change(); + } + if (this.params.library !== undefined) { self.loadLibrary(this.params.library, true); }