|
1 | | -import {GenericModal, ProgressDialog, ButtonValueDialog} from './dialogs.js'; |
| 1 | +import {GenericModal, ProgressDialog, ButtonValueDialog, InputModal} from './dialogs.js'; |
2 | 2 | import {readUploadedFileAsArrayBuffer} from './utilities.js'; |
3 | 3 | import {saveAs} from 'file-saver'; |
4 | 4 | import JSZip from 'jszip'; |
@@ -321,6 +321,11 @@ class FileDialog extends GenericModal { |
321 | 321 | return selectedItems > 1; |
322 | 322 | } |
323 | 323 |
|
| 324 | + async _prompt(message, defaultValue="") { |
| 325 | + const inputModal = new InputModal("input"); |
| 326 | + return await inputModal.open(message, defaultValue); |
| 327 | + } |
| 328 | + |
324 | 329 | _updateToolbar() { |
325 | 330 | this._setElementEnabled('delButton', this._canPerformWritableFileOperation()); |
326 | 331 | this._setElementEnabled('renameButton', !this._multipleItemsSelected() && this._canPerformWritableFileOperation()); |
@@ -653,7 +658,8 @@ class FileDialog extends GenericModal { |
653 | 658 | return; |
654 | 659 | } |
655 | 660 | oldName = oldName[0]; |
656 | | - let newName = prompt("Enter a new folder name", oldName); |
| 661 | + let newName = await this._prompt("Enter a new name", oldName); |
| 662 | + |
657 | 663 | // If cancelled, do nothing |
658 | 664 | if (!newName) { |
659 | 665 | return; |
@@ -688,7 +694,7 @@ class FileDialog extends GenericModal { |
688 | 694 | async _handleNewFolderButton() { |
689 | 695 | if (this._readOnlyMode) return; |
690 | 696 | // prompt for new folder name |
691 | | - let folderName = prompt("Enter a new folder name"); |
| 697 | + let folderName = await this._prompt("Enter a new folder name"); |
692 | 698 | // If cancelled, do nothing |
693 | 699 | if (!folderName) { |
694 | 700 | return; |
|
0 commit comments