fix: drag-to-split — supprimé filtre types + ajout effectAllowed + fallback text/plain
CI / lint (push) Failing after 9s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 29s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled

- dragstart: effectAllowed='move' + double setData (obsigate-tab + text/plain)
- dragenter/dragover: acceptent TOUS les drags (plus de filtre types.includes cassant)
- drop: fallback text/plain si application/obsigate-tab indisponible
- console.debug au lieu de silent catch pour diagnostiquer les erreurs restantes
This commit is contained in:
2026-07-27 22:48:48 -04:00
parent 069d119d03
commit 8aaf19479f
+18 -18
View File
@@ -366,11 +366,14 @@ function createPaneTabManager(paneId) {
this._showTabContextMenu(e.clientX, e.clientY, tab.id); this._showTabContextMenu(e.clientX, e.clientY, tab.id);
}); });
// Drag within same pane // Drag within same pane (+ cross-pane via container drop zone)
el.addEventListener('dragstart', (e) => { el.addEventListener('dragstart', (e) => {
e.dataTransfer.setData('application/obsigate-tab', JSON.stringify({ const payload = JSON.stringify({
paneId: this.paneId, tabId: tab.id, index: idx paneId: this.paneId, tabId: tab.id, index: idx
})); });
e.dataTransfer.setData('application/obsigate-tab', payload);
e.dataTransfer.setData('text/plain', payload); // fallback for browser compat
e.dataTransfer.effectAllowed = 'move';
el.classList.add('dragging'); el.classList.add('dragging');
}); });
el.addEventListener('dragend', () => { el.addEventListener('dragend', () => {
@@ -737,16 +740,12 @@ const PaneManager = {
let _dragCounter = 0; let _dragCounter = 0;
container.addEventListener('dragenter', (e) => { container.addEventListener('dragenter', (e) => {
const types = Array.from(e.dataTransfer.types || []);
if (!types.includes('application/obsigate-tab')) return;
_dragCounter++; _dragCounter++;
e.preventDefault(); e.preventDefault(); // Accept the drop unconditionally
}); });
container.addEventListener('dragover', (e) => { container.addEventListener('dragover', (e) => {
const types = Array.from(e.dataTransfer.types || []); e.preventDefault(); // Required for drop to work
if (!types.includes('application/obsigate-tab')) return;
e.preventDefault();
e.dataTransfer.dropEffect = 'move'; e.dataTransfer.dropEffect = 'move';
// Detect edge zones for drag-to-split (only in single-pane mode) // Detect edge zones for drag-to-split (only in single-pane mode)
@@ -776,7 +775,7 @@ const PaneManager = {
container.addEventListener('dragleave', (e) => { container.addEventListener('dragleave', (e) => {
_dragCounter--; _dragCounter--;
if (_dragCounter > 0) return; // Still inside container (entered a child) if (_dragCounter > 0) return;
container.querySelectorAll('.pane-drop-zone-indicator').forEach(d => d.remove()); container.querySelectorAll('.pane-drop-zone-indicator').forEach(d => d.remove());
const tabBar = container.querySelector('.tab-bar'); const tabBar = container.querySelector('.tab-bar');
if (tabBar) tabBar.classList.remove('drop-target'); if (tabBar) tabBar.classList.remove('drop-target');
@@ -790,11 +789,15 @@ const PaneManager = {
const tabBar = container.querySelector('.tab-bar'); const tabBar = container.querySelector('.tab-bar');
if (tabBar) tabBar.classList.remove('drop-target'); if (tabBar) tabBar.classList.remove('drop-target');
const raw = e.dataTransfer.getData('application/obsigate-tab'); // Try both data formats
let raw = e.dataTransfer.getData('application/obsigate-tab');
if (!raw) raw = e.dataTransfer.getData('text/plain');
if (!raw) return; if (!raw) return;
try { try {
const dragData = JSON.parse(raw); const dragData = JSON.parse(raw);
if (dragData.paneId === paneId) return; // Same pane, let tab handler deal with it if (dragData.paneId == null || dragData.tabId == null) return;
if (dragData.paneId === paneId) return; // Same pane, tab handler deals with it
// Recalculate edge zone from drop coordinates // Recalculate edge zone from drop coordinates
const rect = container.getBoundingClientRect(); const rect = container.getBoundingClientRect();
@@ -803,24 +806,21 @@ const PaneManager = {
const isSingle = !this.isSplit(); const isSingle = !this.isSplit();
if (isSingle && relX > rect.width * 0.72) { if (isSingle && relX > rect.width * 0.72) {
// Dropped on right edge → split right with this tab
this.splitRight(); this.splitRight();
setTimeout(() => { setTimeout(() => {
const newPaneId = this.panes.length - 1; const newPaneId = this.panes.length - 1;
this.transferTab(dragData.paneId, dragData.tabId, newPaneId); this.transferTab(dragData.paneId, dragData.tabId, newPaneId);
}, 150); }, 200);
} else if (isSingle && relY > rect.height * 0.72) { } else if (isSingle && relY > rect.height * 0.72) {
// Dropped on bottom edge → split down with this tab
this.splitDown(); this.splitDown();
setTimeout(() => { setTimeout(() => {
const newPaneId = this.panes.length - 1; const newPaneId = this.panes.length - 1;
this.transferTab(dragData.paneId, dragData.tabId, newPaneId); this.transferTab(dragData.paneId, dragData.tabId, newPaneId);
}, 150); }, 200);
} else { } else {
// Cross-pane transfer (dropped on tab bar or empty area of another pane)
this.transferTab(dragData.paneId, dragData.tabId, paneId); this.transferTab(dragData.paneId, dragData.tabId, paneId);
} }
} catch (e2) { /* ignore */ } } catch (e2) { console.debug('PaneManager drop error:', e2); }
}); });
}, },