MCPcopy Create free account
hub / github.com/error311/FileRise / startInlineRenameForFileRow

Function startInlineRenameForFileRow

public/js/fileListView.js:789–909  ·  view source on GitHub ↗
(row, file, folder)

Source from the content-addressed store, hash-verified

787}
788
789function startInlineRenameForFileRow(row, file, folder) {
790 if (!row || !file) return false;
791 if (window.viewMode !== 'table') return false;
792
793 const nameCell = row.querySelector('.file-name-cell');
794 if (!nameCell) return false;
795
796 clearInlineRenameState();
797 hideHoverPreview();
798
799 const oldName = file.name || '';
800 const originalHtml = nameCell.innerHTML;
801
802 nameCell.textContent = '';
803
804 const input = document.createElement('input');
805 input.type = 'text';
806 input.value = oldName;
807 input.className = 'inline-rename-input form-control';
808 input.setAttribute('aria-label', t('rename') || 'Rename');
809 input.style.width = '100%';
810 input.style.maxWidth = '100%';
811 input.style.fontSize = 'inherit';
812 input.style.padding = '2px 6px';
813 input.style.height = 'auto';
814 input.style.boxSizing = 'border-box';
815
816 nameCell.appendChild(input);
817
818 const state = {
819 type: 'file',
820 row,
821 input,
822 nameCell,
823 originalHtml,
824 oldName,
825 folder: folder || window.currentFolder || 'root',
826 submitting: false,
827 prevDraggable: row.getAttribute('draggable')
828 };
829 inlineRenameState = state;
830 row.setAttribute('draggable', 'false');
831 row.classList.add('inline-rename-active');
832
833 const commit = async () => {
834 if (!inlineRenameState || inlineRenameState !== state || state.submitting) return;
835 const newName = String(input.value || '').trim();
836 if (!newName || newName === oldName) {
837 clearInlineRenameState();
838 return;
839 }
840
841 state.submitting = true;
842 input.disabled = true;
843
844 try {
845 const res = await fetch(withBase('/api/file/renameFile.php'), {
846 method: 'POST',

Callers 1

Calls 6

clearInlineRenameStateFunction · 0.85
hideHoverPreviewFunction · 0.85
tFunction · 0.85
focusRenameInputFunction · 0.85
commitFunction · 0.70
cancelFunction · 0.70

Tested by

no test coverage detected