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

Function paneDropHandler

public/js/fileListView.js:2714–2879  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

2712}
2713
2714async function paneDropHandler(e) {
2715 if (!window.dualPaneEnabled) return;
2716 if (!isPaneDropTargetAllowed(e.target)) return;
2717 e.preventDefault();
2718 e.currentTarget.classList.remove('fr-pane-drop-target');
2719
2720 const paneKey = e.currentTarget.classList.contains('secondary-pane') ? 'secondary' : 'primary';
2721 const paneState = getPaneState(paneKey);
2722 const targetFolder = paneState?.currentFolder || '';
2723 if (!targetFolder) return;
2724
2725 let dragData = null;
2726 try {
2727 const raw = e.dataTransfer.getData('application/json') || '{}';
2728 dragData = JSON.parse(raw);
2729 } catch (err) {
2730 dragData = null;
2731 }
2732
2733 if (!dragData) return;
2734
2735 const sourceId = String(dragData.sourceId || dragData.sourceSourceId || '').trim();
2736 const destSourceId = getPaneSourceId(paneKey) || getGlobalActiveSourceId();
2737 const crossSource = sourceId && destSourceId && sourceId !== destSourceId;
2738
2739 const scheduleRepair = () => {
2740 try {
2741 const kick = () => { try { repairBlankFolderIcons({ force: true }); } catch (e) {} };
2742 if (typeof queueMicrotask === 'function') queueMicrotask(kick);
2743 setTimeout(kick, 80);
2744 setTimeout(kick, 250);
2745 } catch (e) { /* ignore */ }
2746 };
2747
2748 if (dragData.dragType === 'folder' && dragData.folder) {
2749 const sourceFolder = String(dragData.folder || '').trim();
2750 if (!sourceFolder || sourceFolder === 'root') return;
2751 if (!crossSource && (targetFolder === sourceFolder || targetFolder.startsWith(sourceFolder + '/'))) {
2752 showToast(t('invalid_destination'), 'warning');
2753 return;
2754 }
2755
2756 if (normalizePaneKey(window.activePane) !== paneKey) {
2757 setActivePane(paneKey);
2758 }
2759
2760 const sourceParent = dragData.sourceFolder || parentFolderOf(sourceFolder);
2761 try {
2762 await runTransferJob({
2763 kind: 'folder_move',
2764 payload: {
2765 source: sourceFolder,
2766 destination: targetFolder,
2767 sourceId,
2768 destSourceId
2769 },
2770 progress: {
2771 action: 'Moving',

Callers

nothing calls this directly

Calls 15

isPaneDropTargetAllowedFunction · 0.85
getPaneStateFunction · 0.85
getPaneSourceIdFunction · 0.85
getGlobalActiveSourceIdFunction · 0.85
tFunction · 0.85
normalizePaneKeyFunction · 0.85
setActivePaneFunction · 0.85
runTransferJobFunction · 0.85
loadFileListFunction · 0.85
syncTreeAfterFolderMoveFunction · 0.85
scheduleRepairFunction · 0.85

Tested by

no test coverage detected