From e7b16b0dafc80eb60c9dd7c760aca7992d0b15f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 3 Feb 2023 09:22:12 +0100 Subject: [PATCH] fix(etherpad) fix CORS issues Avoid modifying the iframe. We don't really need to bubble up mouse events anymore since the Etherpad frame won't overlap with the toolbar or filmstrip, so when the user moves over those areas it will just show up. --- modules/UI/etherpad/Etherpad.js | 53 --------------------------------- 1 file changed, 53 deletions(-) diff --git a/modules/UI/etherpad/Etherpad.js b/modules/UI/etherpad/Etherpad.js index 9207c64118..3a516219d9 100644 --- a/modules/UI/etherpad/Etherpad.js +++ b/modules/UI/etherpad/Etherpad.js @@ -8,39 +8,6 @@ import Filmstrip from '../videolayout/Filmstrip'; import LargeContainer from '../videolayout/LargeContainer'; import VideoLayout from '../videolayout/VideoLayout'; -/** - * - */ -function bubbleIframeMouseMove(iframe) { - const existingOnMouseMove = iframe.contentWindow.onmousemove; - - iframe.contentWindow.onmousemove = function(e) { - if (existingOnMouseMove) { - existingOnMouseMove(e); - } - const evt = document.createEvent('MouseEvents'); - const boundingClientRect = iframe.getBoundingClientRect(); - - evt.initMouseEvent( - 'mousemove', - true, // bubbles - false, // not cancelable - window, - e.detail, - e.screenX, - e.screenY, - e.clientX + boundingClientRect.left, - e.clientY + boundingClientRect.top, - e.ctrlKey, - e.altKey, - e.shiftKey, - e.metaKey, - e.button, - null // no related element - ); - iframe.dispatchEvent(evt); - }; -} /** * Default Etherpad frame width. @@ -76,26 +43,6 @@ class Etherpad extends LargeContainer { this.container.appendChild(iframe); - iframe.onload = function() { - // eslint-disable-next-line no-self-assign - document.domain = document.domain; - bubbleIframeMouseMove(iframe); - - setTimeout(() => { - const doc = iframe.contentDocument; - - // the iframes inside of the etherpad are - // not yet loaded when the etherpad iframe is loaded - const outer = doc.getElementsByName('ace_outer')[0]; - - bubbleIframeMouseMove(outer); - - const inner = doc.getElementsByName('ace_inner')[0]; - - bubbleIframeMouseMove(inner); - }, 2000); - }; - this.iframe = iframe; }