fix(ui): able to drag empty space in tab bar and detach panels

This commit is contained in:
psychedelicious
2025-07-17 13:13:31 +10:00
parent 43db29176a
commit f3478a189a

View File

@@ -6,6 +6,8 @@ import { useEffect } from 'react';
*
* Dockview always sets the draggable flag on its tab elements, even when dnd is disabled. This hook traverses
* up from the provided ref to find the closest tab element and sets its `draggable` attribute to `false`.
*
* TODO: Remove this when https://github.com/mathuo/dockview/pull/961 is shipped.
*/
export const useHackOutDvTabDraggable = (ref: RefObject<HTMLElement>) => {
useEffect(() => {
@@ -18,5 +20,15 @@ export const useHackOutDvTabDraggable = (ref: RefObject<HTMLElement>) => {
return;
}
parentTab.setAttribute('draggable', 'false');
const tabContainer = parentTab.closest('.dv-tabs-and-actions-container');
if (!tabContainer) {
return;
}
const voidContainer = tabContainer.querySelector('.dv-void-container');
if (!voidContainer) {
return;
}
voidContainer.setAttribute('draggable', 'false');
}, [ref]);
};