diff --git a/lib/components/term.js b/lib/components/term.js index ea57b4b0..b259f0fb 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -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) { diff --git a/lib/utils/plugins.js b/lib/utils/plugins.js index da178f54..c38aecde 100644 --- a/lib/utils/plugins.js +++ b/lib/utils/plugins.js @@ -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));