diff --git a/packages/xod-client-browser/src/containers/App.jsx b/packages/xod-client-browser/src/containers/App.jsx index bf5622b93..2282072dc 100644 --- a/packages/xod-client-browser/src/containers/App.jsx +++ b/packages/xod-client-browser/src/containers/App.jsx @@ -54,17 +54,6 @@ class App extends client.App { props.actions.openProject(props.tutorialProject); props.actions.fetchGrant(); - - document.addEventListener('keydown', event => { - // Prevent selecting all contents with "Ctrl+a" or "Command+a" - // Ctrl+a or Command+a - const key = event.keyCode || event.which; - const mod = event.metaKey || event.ctrlKey; - if (mod && key === 65 && !client.isInputTarget(event)) { - event.preventDefault(); - this.props.actions.selectAll(); - } - }); } onDocumentClick(e) { diff --git a/packages/xod-client/src/core/containers/App.jsx b/packages/xod-client/src/core/containers/App.jsx index 99781703d..49c9e7f00 100644 --- a/packages/xod-client/src/core/containers/App.jsx +++ b/packages/xod-client/src/core/containers/App.jsx @@ -11,6 +11,7 @@ import { transpile, } from 'xod-arduino'; +import { isInputTarget } from '../../utils/browser'; import { lowercaseKebabMask } from '../../utils/inputFormatting'; import sanctuaryPropType from '../../utils/sanctuaryPropType'; @@ -32,6 +33,17 @@ export default class App extends React.Component { this.transformProjectForTranspiler = this.transformProjectForTranspiler.bind( this ); + + document.addEventListener('keydown', event => { + // Prevent selecting all contents with "Ctrl+a" or "Command+a" + // Ctrl+a or Command+a + const key = event.keyCode || event.which; + const mod = event.metaKey || event.ctrlKey; + if (mod && key === 65 && !isInputTarget(event)) { + event.preventDefault(); + this.props.actions.selectAll(); + } + }); } componentDidMount() { document.addEventListener('cut', this.props.actions.cutEntities); @@ -138,6 +150,7 @@ App.propTypes = { popups: PropTypes.objectOf(PropTypes.bool), popupsData: PropTypes.objectOf(PropTypes.object), actions: PropTypes.shape({ + selectAll: PropTypes.func.isRequired, updateCompileLimit: PropTypes.func.isRequired, createProject: PropTypes.func.isRequired, updateProjectMeta: PropTypes.func.isRequired,