Skip to content

Commit 40e0fab

Browse files
committed
FileSelectDialog: use cropped image and reload structure view
1 parent 7589275 commit 40e0fab

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

client/browser/BrowserEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function EditorForm(props) {
5454
if (response.ok) {
5555
const content = await response.json();
5656
if ('file_info' in content) {
57-
settings.selectFile(file_info);
57+
settings.selectFile(content.file_info);
5858
} else if ('form_html' in content) {
5959
setFormHtml(content.form_html);
6060
} else {

client/browser/FileSelectDialog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ export default function FileSelectDialog(props) {
7575
const dialog = ref.current?.closest('dialog');
7676

7777
useEffect(() => {
78-
getStructure();
79-
}, []);
78+
if (!uploadedFile) {
79+
getStructure();
80+
}
81+
}, [uploadedFile]);
8082

8183
useEffect(() => {
8284
if (!dialog) {

finder/api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def change(self, request, file_id):
200200
form_class = file.get_form_class()
201201
form = form_class(instance=file, data=request.POST, renderer=FormRenderer())
202202
if form.is_valid():
203-
form.save()
203+
file = form.save()
204204
return {'file_info': file.as_dict}
205205
else:
206206
return {'form_html': mark_safe(strip_spaces_between_tags(form.as_div()))}

0 commit comments

Comments
 (0)