Browse Source

Checking for inputs on the main document as well as the frame. Fix for #2422

pull/2756/head
Matthew Day 6 years ago
parent
commit
1582740c61
  1. 6
      src/canvas/index.js
  2. 6
      src/canvas/view/CanvasView.js

6
src/canvas/index.js

@ -552,8 +552,12 @@ export default () => {
*/
isInputFocused() {
const doc = this.getDocument();
const frame = this.getFrameEl();
const toIgnore = ['body', ...this.getConfig().notTextable];
const focused = doc && doc.activeElement;
const docActive = frame && document.activeElement === frame;
const focused = docActive
? doc && doc.activeElement
: document.activeElement;
return focused && !toIgnore.some(item => focused.matches(item));
},

6
src/canvas/view/CanvasView.js

@ -92,7 +92,11 @@ export default Backbone.View.extend({
const { em } = this;
const key = getKeyChar(ev);
if (key === ' ' && em.getZoomDecimal() !== 1) {
if (
key === ' ' &&
em.getZoomDecimal() !== 1 &&
!em.get('Canvas').isInputFocused()
) {
this.preventDefault(ev);
em.get('Editor').runCommand('core:canvas-move');
}

Loading…
Cancel
Save