2019-11-06 03:43:39 -07:00
|
|
|
define(["loading", "scripts/editorsidebar"], function (loading) {
|
2018-10-22 15:05:09 -07:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function reload(context, itemId) {
|
2019-11-06 03:43:39 -07:00
|
|
|
loading.show();
|
|
|
|
|
|
|
|
if (itemId) {
|
|
|
|
require(["metadataEditor"], function (metadataEditor) {
|
|
|
|
metadataEditor.embed(context.querySelector(".editPageInnerContent"), itemId, ApiClient.serverInfo().Id);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
context.querySelector(".editPageInnerContent").innerHTML = "";
|
|
|
|
loading.hide();
|
|
|
|
}
|
2018-10-22 15:05:09 -07:00
|
|
|
}
|
2019-11-06 03:43:39 -07:00
|
|
|
|
|
|
|
return function (view, params) {
|
|
|
|
view.addEventListener("viewshow", function () {
|
|
|
|
reload(this, MetadataEditor.getCurrentItemId());
|
|
|
|
});
|
|
|
|
MetadataEditor.setCurrentItemId(null);
|
|
|
|
view.querySelector(".libraryTree").addEventListener("itemclicked", function (event) {
|
2018-10-22 15:05:09 -07:00
|
|
|
var data = event.detail;
|
2019-11-06 03:43:39 -07:00
|
|
|
|
|
|
|
if (data.id != MetadataEditor.getCurrentItemId()) {
|
|
|
|
MetadataEditor.setCurrentItemId(data.id);
|
|
|
|
reload(view, data.id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|