mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Fix mapXDispatch and allow plugin to access onWheel (credit: lkzhao) (#578)
* Fix mapXDispatch && allow plugin to access onWheel see https://github.com/zeit/hyperterm/pull/563
This commit is contained in:
parent
cc112b6683
commit
9b42c5ff52
2 changed files with 26 additions and 2 deletions
|
|
@ -65,7 +65,10 @@ export default class Term extends Component {
|
|||
iframeWindow.addEventListener('wheel', this.onWheel);
|
||||
}
|
||||
|
||||
onWheel () {
|
||||
onWheel (e) {
|
||||
if (this.props.onWheel) {
|
||||
this.props.onWheel(e);
|
||||
}
|
||||
this.term.prefs_.set('scrollbar-visible', true);
|
||||
clearTimeout(this.scrollbarsHideTimer);
|
||||
if (!this.scrollMouseEnter) {
|
||||
|
|
|
|||
|
|
@ -266,7 +266,28 @@ export function connect (stateFn, dispatchFn, c, d = {}) {
|
|||
});
|
||||
return ret;
|
||||
},
|
||||
dispatchFn,
|
||||
function (dispatch) {
|
||||
let ret = dispatchFn(dispatch);
|
||||
connectors[name].dispatch.forEach((fn) => {
|
||||
let ret_;
|
||||
|
||||
try {
|
||||
ret_ = fn(dispatch, ret);
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
notify('Plugin error', `${fn._pluginName}: Error occurred in \`map${name}Dispatch\`. Check Developer Tools for details.`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ret_ || 'object' !== typeof ret_) {
|
||||
notify('Plugin error', `${fn._pluginName}: Invalid return value of \`map${name}Dispatch\` (object expected).`);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ret_;
|
||||
});
|
||||
return ret;
|
||||
},
|
||||
c,
|
||||
d
|
||||
)(decorate(Class, name));
|
||||
|
|
|
|||
Loading…
Reference in a new issue