diff --git a/api/js/etemplate/Et2Vfs/Et2VfsSelect.styles.ts b/api/js/etemplate/Et2Vfs/Et2VfsSelect.styles.ts index a9c7a26a50..47fd07104d 100644 --- a/api/js/etemplate/Et2Vfs/Et2VfsSelect.styles.ts +++ b/api/js/etemplate/Et2Vfs/Et2VfsSelect.styles.ts @@ -8,6 +8,7 @@ export default css` et2-dialog::part(body) { display: flex; flex-direction: column; + gap: var(--sl-spacing-small); } .et2_toolbar { diff --git a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.md b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.md index 9e2844cc73..219a25cf48 100644 --- a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.md +++ b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.md @@ -33,7 +33,7 @@ When the user closes the dialog, getComplete() will return the selected files. ```js const dialog = this.et2.getWidgetById("files"); -let files = await dialog.getComplete(); +let [button, files] = await dialog.getComplete(); ``` This is probably the best way to get files (or directories) that you then want to do something with on the client. See diff --git a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts index 92ea84c5d0..a82850f4a7 100644 --- a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts +++ b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts @@ -583,13 +583,22 @@ export class Et2VfsSelectDialog if(file && !file.disabled) { - // Can't select a directory normally, can't select anything in "saveas" - if(file.value.isDir && this.mode != "select-dir" || this.mode == "saveas") + // Can't select a directory normally + if(file.value.isDir && this.mode != "select-dir") { event.preventDefault(); event.stopPropagation(); return; } + // can't select anything in "saveas", but set the file name + else if(this.mode == "saveas") + { + this._filenameNode.value = file.value.name; + event.preventDefault(); + event.stopPropagation(); + this.updateComplete.then(() => this._filenameNode.focus()); + return; + } // Set focus after updating so the value is announced by screen readers //this.updateComplete.then(() => this.displayInput.focus({ preventScroll: true })); }