diff --git a/package.json b/package.json index ba8feb2ef1..2512f0544a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@entrylabs/entry", "title": "EntryJS", "description": "JavaScript library for visual programming", - "version": "4.0.5", + "version": "4.0.6", "main": "dist/entry.min.js", "homepage": "https://playentry.org", "author": { diff --git a/src/class/engine.js b/src/class/engine.js index d4eb3f2902..2afef65681 100644 --- a/src/class/engine.js +++ b/src/class/engine.js @@ -1046,23 +1046,31 @@ Entry.Engine = class Engine { } if (window.top !== window.self) { - window.top.addEventListener('pointermove', this.copyEvent); - window.top.addEventListener('pointerdown', this.copyEvent); - window.top.addEventListener('pointerup', this.copyEvent); - window.top.addEventListener('pointerupoutside', this.copyEvent); - window.top.addEventListener('pointercancel', this.copyEvent); - window.top.addEventListener('mouseup', this.copyEvent); - window.top.addEventListener('mousemove', this.copyEvent); + if (Entry.iframeDomAccess === 'direct') { + window.top.addEventListener('pointermove', this.copyEvent); + window.top.addEventListener('pointerdown', this.copyEvent); + window.top.addEventListener('pointerup', this.copyEvent); + window.top.addEventListener('pointerupoutside', this.copyEvent); + window.top.addEventListener('pointercancel', this.copyEvent); + window.top.addEventListener('mouseup', this.copyEvent); + window.top.addEventListener('mousemove', this.copyEvent); + } else if (Entry.iframeDomAccess === 'message') { + window.top.postMessage({ type: 'toggleFullScreen', value: 'addEvent' }, '*'); + } } } else { if (window.top !== window.self) { - window.top.removeEventListener('pointermove', this.copyEvent); - window.top.removeEventListener('pointerdown', this.copyEvent); - window.top.removeEventListener('pointerup', this.copyEvent); - window.top.removeEventListener('pointerupoutside', this.copyEvent); - window.top.removeEventListener('pointercancel', this.copyEvent); - window.top.removeEventListener('mouseup', this.copyEvent); - window.top.removeEventListener('mousemove', this.copyEvent); + if (Entry.iframeDomAccess === 'direct') { + window.top.removeEventListener('pointermove', this.copyEvent); + window.top.removeEventListener('pointerdown', this.copyEvent); + window.top.removeEventListener('pointerup', this.copyEvent); + window.top.removeEventListener('pointerupoutside', this.copyEvent); + window.top.removeEventListener('pointercancel', this.copyEvent); + window.top.removeEventListener('mouseup', this.copyEvent); + window.top.removeEventListener('mousemove', this.copyEvent); + } else if (Entry.iframeDomAccess === 'message') { + window.top.postMessage({ type: 'toggleFullScreen', value: 'removeEvent' }, '*'); + } } this.popup.remove(); this.popup = null; diff --git a/src/util/init.js b/src/util/init.js index de4cb2fd8e..33257d5d45 100644 --- a/src/util/init.js +++ b/src/util/init.js @@ -573,6 +573,12 @@ Entry.parseOptions = function (options) { this.exportObjectEnable = true; } + this.iframeDomAccess = options.iframeDomAccess; + if (this.iframeDomAccess === undefined) { + //direct, message, none + this.iframeDomAccess = 'direct'; + } + this.hasVariableManager = options.hasvariablemanager; if (!(this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable)) { this.hasVariableManager = false;