Fixed error when resizing browser after pasting embed link

closes https://github.com/TryGhost/Team/issues/749

- resize event listener is created twice when converting a link to an embed card, if we don't clear the older resize event handler before creating a new one then it persists after the component is torn down and the iframe no longer exists
This commit is contained in:
Kevin Ansfield 2021-07-14 14:50:59 +01:00
parent 9bc799258d
commit b3b5ac6cef

View File

@ -329,6 +329,7 @@ export default Component.extend({
},
_setupWindowResizeHandler(iframe) {
window.removeEventListener('resize', this._windowResizeHandler);
this._windowResizeHandler = run.bind(this, this._resizeIframe, iframe);
window.addEventListener('resize', this._windowResizeHandler, {passive: true});
},