aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2021-03-13 16:40:26 -0500
committerusodhi <61431818+usodhi@users.noreply.github.com>2021-03-13 16:40:26 -0500
commit74c8b78c7119e700655338a32c03f2031186b238 (patch)
tree57baf33d9230b7ea6f77addf34becae8faeb63b0 /src/client/views/collections/TabDocView.tsx
parent70a5edc6e9a203141b16fd31ee9a1a26ebae2188 (diff)
parente20a8916483734bb06d08409b6bc804c2391a289 (diff)
minor changes
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index f7e067399..2ead98aa4 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -213,7 +213,6 @@ export class TabDocView extends React.Component<TabDocViewProps> {
}
componentDidMount() {
- const selected = () => SelectionManager.Views().some(v => v.props.Document === this._document);
new _global.ResizeObserver(action((entries: any) => {
for (const entry of entries) {
this._panelWidth = entry.contentRect.width;
@@ -221,7 +220,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
}
})).observe(this.props.glContainer._element[0]);
this.props.glContainer.layoutManager.on("activeContentItemChanged", this.onActiveContentItemChanged);
- this.props.glContainer.tab?.isActive && this.onActiveContentItemChanged();
+ this.props.glContainer.tab?.isActive && this.onActiveContentItemChanged(undefined);
this._tabReaction = reaction(() => ({ selected: this.active(), title: this.tab?.titleElement[0] }),
({ selected, title }) => title && (title.style.backgroundColor = selected ? "white" : ""),
{ fireImmediately: true });
@@ -229,13 +228,15 @@ export class TabDocView extends React.Component<TabDocViewProps> {
componentWillUnmount() {
this._tabReaction?.();
+ this.tab && CollectionDockingView.Instance.tabMap.delete(this.tab);
+
this.props.glContainer.layoutManager.off("activeContentItemChanged", this.onActiveContentItemChanged);
}
@action.bound
- private onActiveContentItemChanged() {
- if (this.props.glContainer.tab && this._isActive !== this.props.glContainer.tab.isActive) {
- this._isActive = this.props.glContainer.tab.isActive;
+ private onActiveContentItemChanged(contentItem: any) {
+ if (!contentItem || (this.stack === contentItem.parent && ((contentItem?.tab === this.tab && !this._isActive) || (contentItem?.tab !== this.tab && this._isActive)))) {
+ this._activated = this._isActive = !contentItem || contentItem?.tab === this.tab;
(CollectionDockingView.Instance as any)._goldenLayout?.isInitialised && CollectionDockingView.Instance.stateChanged();
!this._isActive && this._document && Doc.UnBrushDoc(this._document); // bcz: bad -- trying to simulate a pointer leave event when a new tab is opened up on top of an existing one.
}
@@ -344,6 +345,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
}
render() {
+ this.tab && CollectionDockingView.Instance.tabMap.delete(this.tab);
return (
<div className="collectionDockingView-content" style={{ height: "100%", width: "100%" }} ref={ref => {
if (this._mainCont = ref) {