Rename file modal select and focus filename

This commit is contained in:
Ryan
2025-03-24 16:53:37 -04:00
committed by GitHub
parent 6426f4b924
commit c0dc0ce391
2 changed files with 10 additions and 11 deletions

View File

@@ -1203,6 +1203,16 @@ export function renameFile(oldName, folder) {
window.fileFolder = folder || window.currentFolder || "root";
document.getElementById("newFileName").value = oldName;
document.getElementById("renameFileModal").style.display = "block";
setTimeout(() => {
const input = document.getElementById("newFileName");
input.focus();
const lastDot = oldName.lastIndexOf('.');
if (lastDot > 0) {
input.setSelectionRange(0, lastDot);
} else {
input.select();
}
}, 100);
}
document.addEventListener("DOMContentLoaded", () => {