From 7074cbe29bbba5adb4d74e436ed5a9f7c56e36eb Mon Sep 17 00:00:00 2001 From: hector Date: Fri, 16 Aug 2019 11:43:47 +0800 Subject: [PATCH] Expose focusActiveTerm function to window --- lib/components/header.js | 6 ++++-- lib/containers/hyper.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/components/header.js b/lib/components/header.js index 5d4675e1..67b0bcc6 100644 --- a/lib/components/header.js +++ b/lib/components/header.js @@ -27,11 +27,12 @@ export default class Header extends React.PureComponent { this.props.onChangeTab(active); } - handleHeaderMouseDown(ev) { + handleHeaderMouseDown() { // the hack of all hacks, this prevents the term // iframe from losing focus, for example, when // the user drags the nav around - ev.preventDefault(); + // Fixed by calling window.focusActiveTerm(), thus we can support drag tab + // ev.preventDefault(); // persist start positions of a potential drag motion // to differentiate dragging from clicking @@ -111,6 +112,7 @@ export default class Header extends React.PureComponent {
window.focusActiveTerm()} onDoubleClick={this.handleMaximizeClick} > {!isMac && ( diff --git a/lib/containers/hyper.js b/lib/containers/hyper.js index a49be763..ebea39ad 100644 --- a/lib/containers/hyper.js +++ b/lib/containers/hyper.js @@ -87,6 +87,7 @@ class Hyper extends React.PureComponent { onTermsRef(terms) { this.terms = terms; + window.focusActiveTerm = this.handleFocusActive; } componentDidUpdate(prev) {