mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-13 11:54:57 -05:00
fix(ui): able to drag empty space in tab bar and detach panels
This commit is contained in:
@@ -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]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user