Skip to content

Commit b47747b

Browse files
frapellpetschki
authored andcommitted
fix(pat contentbrowser): Only close the upload panel when upload was successful. In addition, select the uploaded file right away. fixes gh-1491
1 parent 6c38463 commit b47747b

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/pat/contentbrowser/src/ContentBrowser.svelte

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,26 @@
8383
relativePath: "@@fileUpload",
8484
allowPathSelection: false,
8585
hiddenInputContainer: ".upload-wrapper",
86-
success: (fileupload, obj) => {
87-
updatePreview({
88-
uuid: obj.UID,
89-
action: "add",
90-
});
91-
},
92-
queuecomplete: (fileUpload, obj) => {
93-
contentItems.get({ path: $currentPath, updateCache: true });
86+
success: async (fileupload, obj) => {
87+
await contentItems.get({ path: $currentPath, updateCache: true });
88+
9489
showUpload = false;
90+
91+
const level = $contentItems.find(lvl => lvl.displayPath === $currentPath);
92+
93+
if (level && level.results) {
94+
while (level.load_more){
95+
await contentItems.get({ path: $currentPath, loadMorePath: level.path, page: level.page + 1 });
96+
}
97+
const item = level.results.find(it => it.UID === obj.UID);
98+
if (item){
99+
updatePreview({
100+
data: item,
101+
action: "show",
102+
});
103+
scrollToRight();
104+
}
105+
}
95106
},
96107
});
97108
}

0 commit comments

Comments
 (0)