|
1 | 1 | // Wrapper for the Notebook for use in a golden layout container |
2 | | -import React, { Component, MouseEvent, ReactElement } from 'react'; |
| 2 | +import React, { Component, ReactElement } from 'react'; |
3 | 3 | import ReactDOM from 'react-dom'; |
4 | 4 | import memoize from 'memoize-one'; |
5 | 5 | import { connect } from 'react-redux'; |
@@ -178,7 +178,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
178 | 178 | this.handleLinkClick = this.handleLinkClick.bind(this); |
179 | 179 | this.handleLoadSuccess = this.handleLoadSuccess.bind(this); |
180 | 180 | this.handleLoadError = this.handleLoadError.bind(this); |
181 | | - this.handlePanelTabClick = this.handlePanelTabClick.bind(this); |
| 181 | + this.handleTabClick = this.handleTabClick.bind(this); |
182 | 182 | this.handleRenameFile = this.handleRenameFile.bind(this); |
183 | 183 | this.handleResize = this.handleResize.bind(this); |
184 | 184 | this.handleRunCommand = this.handleRunCommand.bind(this); |
@@ -287,7 +287,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
287 | 287 | if (tab != null) this.initTab(tab); |
288 | 288 | this.initNotebookContent(); |
289 | 289 | glEventHub.on(NotebookEvent.RENAME_FILE, this.handleRenameFile); |
290 | | - glContainer.on('tabClicked', this.handlePanelTabClick); |
291 | 290 | } |
292 | 291 |
|
293 | 292 | componentDidUpdate( |
@@ -316,11 +315,10 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
316 | 315 | this.debouncedSavePanelState.flush(); |
317 | 316 | this.pending.cancel(); |
318 | 317 |
|
319 | | - const { glContainer, glEventHub } = this.props; |
| 318 | + const { glEventHub } = this.props; |
320 | 319 |
|
321 | 320 | const { fileMetadata, isPreview } = this.state; |
322 | 321 | glEventHub.off(NotebookEvent.RENAME_FILE, this.handleRenameFile); |
323 | | - glContainer.off('tabClicked', this.handlePanelTabClick); |
324 | 322 | glEventHub.emit(NotebookEvent.UNREGISTER_FILE, fileMetadata, isPreview); |
325 | 323 | } |
326 | 324 |
|
@@ -733,7 +731,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
733 | 731 | /** |
734 | 732 | * @param event The click event from clicking on the link |
735 | 733 | */ |
736 | | - handleLinkClick(event: MouseEvent<HTMLAnchorElement>) { |
| 734 | + handleLinkClick(event: React.MouseEvent<HTMLAnchorElement>) { |
737 | 735 | const { notebooksUrl, session, sessionLanguage } = this.props; |
738 | 736 | const { href } = event.currentTarget; |
739 | 737 | if (!href || !href.startsWith(notebooksUrl)) { |
@@ -957,8 +955,8 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
957 | 955 | }); |
958 | 956 | } |
959 | 957 |
|
960 | | - handlePanelTabClick(e: MouseEvent): void { |
961 | | - log.debug('handlePanelTabClick'); |
| 958 | + handleTabClick(e: MouseEvent): void { |
| 959 | + log.debug('handle NotebookPanel tab click'); |
962 | 960 | this.focus(); |
963 | 961 | if (e.detail === 2) { |
964 | 962 | this.removePreviewStatus(); |
@@ -1173,6 +1171,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> { |
1173 | 1171 | onTab={this.handleTab} |
1174 | 1172 | onResize={this.handleResize} |
1175 | 1173 | onShow={this.handleShow} |
| 1174 | + onTabClicked={this.handleTabClick} |
1176 | 1175 | onTabFocus={this.handleTabFocus} |
1177 | 1176 | onTabBlur={this.handleTabBlur} |
1178 | 1177 | onSessionOpen={this.handleSessionOpened} |
|
0 commit comments