Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handle moved signal to split panel #301

Merged
merged 4 commits into from
May 11, 2022
Merged

Add handle moved signal to split panel #301

merged 4 commits into from
May 11, 2022

Conversation

afshin
Copy link
Member

@afshin afshin commented Apr 28, 2022

The handleMoved signal is useful for capturing state changes in the layout of a SplitPanel and saving it (e.g. for layout restoration). This PR allows for removing the following code in JupyterLab:

import { ISignal, Signal } from '@lumino/signaling';
import { SplitPanel as SPanel } from '@lumino/widgets';

/**
 * A deprecated split panel that will be removed when the phosphor split panel
 * supports a handle moved signal. See https://github.com/phosphorjs/phosphor/issues/297.
 */
export class SplitPanel extends SPanel {
  /**
   * Emits when the split handle has moved.
   */
  readonly handleMoved: ISignal<any, void> = new Signal<any, void>(this);

  handleEvent(event: Event): void {
    super.handleEvent(event);

    if (event.type === 'mouseup') {
      (this.handleMoved as Signal<any, void>).emit(undefined);
    }
  }
}

https://github.com/jupyterlab/jupyterlab/blob/dbdefed9db9332381fe4104bdf53ec314451951f/packages/settingeditor/src/splitpanel.ts

@afshin afshin changed the title [WIP] Add handle moved signal to split panel Add handle moved signal to split panel Apr 28, 2022
@afshin afshin added the enhancement New feature or request label Apr 28, 2022
@afshin afshin marked this pull request as ready for review April 28, 2022 23:36
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @afshin

@afshin afshin merged commit 9c2948e into jupyterlab:main May 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants