Skip to content

Commit

Permalink
[maximized] fix eclipse-theia#6453: send attach/detach messages to wi…
Browse files Browse the repository at this point in the history
…dgets

Allow them to react when the main area panel is moved between the area container and maximized overlay container, or backward.

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Feb 24, 2020
1 parent ae6110d commit 19ee663
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/browser/shell/theia-dock-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { find, toArray, ArrayExt } from '@phosphor/algorithm';
import { TabBar, Widget, DockPanel, Title, DockLayout } from '@phosphor/widgets';
import { Signal } from '@phosphor/signaling';
import { Disposable, DisposableCollection } from '../../common/disposable';
import { MessageLoop } from '../widgets';

const MAXIMIZED_CLASS = 'theia-maximized';

Expand Down Expand Up @@ -140,14 +141,28 @@ export class TheiaDockPanel extends DockPanel {
this.toDisposeOnToggleMaximized.dispose();
return;
}
if (this.isAttached) {
MessageLoop.sendMessage(this, Widget.Msg.BeforeDetach);
this.node.remove();
MessageLoop.sendMessage(this, Widget.Msg.AfterDetach);
}
maximizedElement.style.display = 'block';
this.addClass(MAXIMIZED_CLASS);
MessageLoop.sendMessage(this, Widget.Msg.BeforeAttach);
maximizedElement.appendChild(this.node);
MessageLoop.sendMessage(this, Widget.Msg.AfterAttach);
this.fit();
this.toDisposeOnToggleMaximized.push(Disposable.create(() => {
maximizedElement.style.display = 'none';
this.removeClass(MAXIMIZED_CLASS);
if (this.isAttached) {
MessageLoop.sendMessage(this, Widget.Msg.BeforeDetach);
this.node.remove();
MessageLoop.sendMessage(this, Widget.Msg.AfterDetach);
}
MessageLoop.sendMessage(this, Widget.Msg.BeforeAttach);
areaContainer.appendChild(this.node);
MessageLoop.sendMessage(this, Widget.Msg.AfterAttach);
this.fit();
}));

Expand Down

0 comments on commit 19ee663

Please sign in to comment.