()
| 3662 | opt.classList.add('inline-rename-active'); |
| 3663 | |
| 3664 | const commit = async () => { |
| 3665 | if (!inlineTreeRenameState || inlineTreeRenameState !== state || state.submitting) return; |
| 3666 | const newName = String(input.value || '').trim(); |
| 3667 | if (!newName || newName === oldName) { |
| 3668 | clearInlineTreeRenameState(); |
| 3669 | return; |
| 3670 | } |
| 3671 | |
| 3672 | state.submitting = true; |
| 3673 | input.disabled = true; |
| 3674 | |
| 3675 | try { |
| 3676 | const result = await renameFolderInline(selectedFolder, newName); |
| 3677 | if (result && result.success) { |
| 3678 | clearInlineTreeRenameState({ restore: false }); |
| 3679 | return; |
| 3680 | } |
| 3681 | } catch (e) { |
| 3682 | console.error('Error renaming folder:', e); |
| 3683 | } |
| 3684 | |
| 3685 | if (inlineTreeRenameState === state) { |
| 3686 | state.submitting = false; |
| 3687 | input.disabled = false; |
| 3688 | focusTreeRenameInput(input); |
| 3689 | } |
| 3690 | }; |
| 3691 | |
| 3692 | const cancel = () => { |
| 3693 | clearInlineTreeRenameState(); |
no test coverage detected