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

Function startInlineRenameForFolderRow

public/js/fileListView.js:911–1019  ·  view source on GitHub ↗
(row, folderPath)

Source from the content-addressed store, hash-verified

909}
910
911function startInlineRenameForFolderRow(row, folderPath) {
912 if (!row || !folderPath) return false;
913 if (window.viewMode !== 'table') return false;
914
915 const wrap = row.querySelector('.folder-row-inner');
916 const nameSpan = row.querySelector('.folder-row-name');
917 if (!wrap || !nameSpan) return false;
918
919 clearInlineRenameState();
920 hideHoverPreview();
921
922 const oldName = nameSpan.textContent || (String(folderPath).split('/').pop() || '');
923 const originalName = oldName;
924
925 const input = document.createElement('input');
926 input.type = 'text';
927 input.value = oldName;
928 input.className = 'inline-rename-input form-control';
929 input.setAttribute('aria-label', t('rename_folder') || 'Rename folder');
930 input.style.width = '100%';
931 input.style.maxWidth = '100%';
932 input.style.fontSize = 'inherit';
933 input.style.padding = '2px 6px';
934 input.style.height = 'auto';
935 input.style.boxSizing = 'border-box';
936
937 const metaSpan = wrap.querySelector('.folder-row-meta');
938 nameSpan.style.display = 'none';
939 if (metaSpan) {
940 wrap.insertBefore(input, metaSpan);
941 } else {
942 wrap.appendChild(input);
943 }
944
945 const state = {
946 type: 'folder',
947 row,
948 input,
949 nameSpan,
950 originalName,
951 folderPath,
952 submitting: false,
953 prevDraggable: row.getAttribute('draggable')
954 };
955 inlineRenameState = state;
956 row.setAttribute('draggable', 'false');
957 row.classList.add('inline-rename-active');
958
959 const commit = async () => {
960 if (!inlineRenameState || inlineRenameState !== state || state.submitting) return;
961 const newName = String(input.value || '').trim();
962 if (!newName || newName === oldName) {
963 clearInlineRenameState();
964 return;
965 }
966
967 state.submitting = true;
968 input.disabled = true;

Callers 2

fileListView.jsFile · 0.85
injectInlineFolderRowsFunction · 0.85

Calls 7

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

Tested by

no test coverage detected