mirror of
https://github.com/mathuo/dockview
synced 2025-08-14 05:06:02 +00:00
feat: general cleanup
This commit is contained in:
parent
ee22a08b2e
commit
3b35997b2f
@ -20,5 +20,7 @@ describe('lifecycle', () => {
|
|||||||
|
|
||||||
mutableDisposable.dispose();
|
mutableDisposable.dispose();
|
||||||
expect(disposed).toBe(2);
|
expect(disposed).toBe(2);
|
||||||
|
|
||||||
|
mutableDisposable.dispose();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -94,6 +94,8 @@ export class DefaultTab extends CompositeDisposable implements ITabRenderer {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.addDisposables(this.isDirtyDisposable);
|
||||||
|
|
||||||
this._element = document.createElement('div');
|
this._element = document.createElement('div');
|
||||||
this._element.className = 'default-tab';
|
this._element.className = 'default-tab';
|
||||||
//
|
//
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
export const focusedElement: { element: Element | null } = { element: null };
|
export const focusedElement: { element: Element | null } = { element: null };
|
||||||
|
|
||||||
//TODO somebody could call .stopPropagation() on this - can you do this at the event capture-stage instead?
|
window.addEventListener(
|
||||||
window.addEventListener('focusin', () => {
|
'focusin',
|
||||||
focusedElement.element = document.activeElement;
|
() => {
|
||||||
});
|
focusedElement.element = document.activeElement;
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
focusedElement.element = document.activeElement;
|
focusedElement.element = document.activeElement;
|
||||||
|
@ -275,6 +275,7 @@ export class Gridview implements IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
|
this.disposable.dispose();
|
||||||
this._onDidChange.dispose();
|
this._onDidChange.dispose();
|
||||||
this.root.dispose();
|
this.root.dispose();
|
||||||
}
|
}
|
||||||
|
@ -115,20 +115,7 @@ export class Tab extends CompositeDisposable implements ITab {
|
|||||||
*/
|
*/
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
/**
|
this._onChanged.fire({ kind: MouseEventKind.CLICK, event });
|
||||||
* //TODO mousedown focusing with draggable element (is there a better approach?)
|
|
||||||
*
|
|
||||||
* this mousedown event wants to focus the tab itself but if we call preventDefault()
|
|
||||||
* this would also prevent the dragStart event from firing. To get around this we propagate
|
|
||||||
* the onChanged event during the next tick of the event-loop, allowing the tab element to become
|
|
||||||
* focused on this tick and ensuring the dragstart event is not interrupted
|
|
||||||
*/
|
|
||||||
|
|
||||||
const oldFocus = focusedElement.element as HTMLElement;
|
|
||||||
setTimeout(() => {
|
|
||||||
oldFocus.focus();
|
|
||||||
this._onChanged.fire({ kind: MouseEventKind.CLICK, event });
|
|
||||||
}, 0);
|
|
||||||
}),
|
}),
|
||||||
addDisposableListener(this._element, 'contextmenu', (event) => {
|
addDisposableListener(this._element, 'contextmenu', (event) => {
|
||||||
this._onChanged.fire({
|
this._onChanged.fire({
|
||||||
|
@ -279,7 +279,7 @@ export class SplitviewComponent
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { width, height } =
|
const { width, height } =
|
||||||
this.element.parentElement?.getBoundingClientRect();
|
this.element.parentElement.getBoundingClientRect();
|
||||||
this.layout(width, height);
|
this.layout(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user