diff --git a/modules/formed-components-fragment-collection-contributor/src/main/resources/com/liferay/fragment/collection/contributor/formed/components/dependencies/mappable-video/index.js b/modules/formed-components-fragment-collection-contributor/src/main/resources/com/liferay/fragment/collection/contributor/formed/components/dependencies/mappable-video/index.js index bdf3aed..a7a0c81 100644 --- a/modules/formed-components-fragment-collection-contributor/src/main/resources/com/liferay/fragment/collection/contributor/formed/components/dependencies/mappable-video/index.js +++ b/modules/formed-components-fragment-collection-contributor/src/main/resources/com/liferay/fragment/collection/contributor/formed/components/dependencies/mappable-video/index.js @@ -18,10 +18,17 @@ const mappableVideo = fragmentElement.querySelector('.mappable-video'); let intervalID; +const resetInterval = () => { + clearInterval(intervalID); + + intervalID = null; +} + const onPlay = (getCurrentTime) => { mappableVideo.classList.add('playing'); + if (intervalID) { - clearInterval(intervalID); + resetInterval(); } intervalID = setInterval(() => { @@ -32,11 +39,13 @@ const onPlay = (getCurrentTime) => { const onPause = () => { mappableVideo.classList.remove('playing'); - clearInterval(intervalID); - - intervalID = null; + resetInterval(); } +Liferay.once('beforeNavigate', function() { + resetInterval(); +}); + const mappableVideoUrlNode = fragmentElement.querySelector('.mappable-url'); if (isEditMode && mappableVideoUrlNode) { diff --git a/release.sh b/release.sh index 8303633..04e08ce 100755 --- a/release.sh +++ b/release.sh @@ -7,6 +7,6 @@ hub release create \ --attach modules/header-components-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.header.components-1.0.0.jar \ --attach modules/integrations-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.integrations-1.0.0.jar \ --attach modules/utilities-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.utilities-1.0.0.jar \ - --message 'v0.0.7' \ - --message 'Fix mappable video when using a non mapped video.' \ - 'v0.0.7' \ No newline at end of file + --message 'v0.0.8' \ + --message 'Cleanup interval for mappable video before navigation.' \ + 'v0.0.8' \ No newline at end of file