diff --git a/lib/index.js b/lib/index.js index b315ae1..e6f5ec6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -188,17 +188,18 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'addEvents', value: function addEvents(type) { + var iframeDocument = document.getElementById('modal-editor-frame').contentWindow.document; switch (type) { case 'mouse': { - document.addEventListener('mousemove', this.onMouseOrTouchMove); - document.addEventListener('mouseup', this.onInteractionEnd); + iframeDocument.addEventListener('mousemove', this.onMouseOrTouchMove); + iframeDocument.addEventListener('mouseup', this.onInteractionEnd); break; } case 'touch': { - document.addEventListener('touchmove', this.onMouseOrTouchMove); - document.addEventListener('touchend', this.onInteractionEnd); + iframeDocument.addEventListener('touchmove', this.onMouseOrTouchMove); + iframeDocument.addEventListener('touchend', this.onInteractionEnd); break; } default: // nothing @@ -207,10 +208,11 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'removeEvents', value: function removeEvents() { - document.removeEventListener('mousemove', this.onMouseOrTouchMove); - document.removeEventListener('mouseup', this.onInteractionEnd); - document.removeEventListener('touchmove', this.onMouseOrTouchMove); - document.removeEventListener('touchend', this.onInteractionEnd); + var iframeDocument = document.getElementById('modal-editor-frame').contentWindow.document; + iframeDocument.removeEventListener('mousemove', this.onMouseOrTouchMove); + iframeDocument.removeEventListener('mouseup', this.onInteractionEnd); + iframeDocument.removeEventListener('touchmove', this.onMouseOrTouchMove); + iframeDocument.removeEventListener('touchend', this.onInteractionEnd); } }, { key: 'updateSliderValue',