From 83d11152a011b2ebc752f69c3f83a25a557c25df Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 9 May 2023 17:46:53 +0200 Subject: [PATCH] Merge pull request #21602 from gitstart/addon-measure/disable-in-docs Addon Measure: Deactivate when switching to Docs mode --- code/addons/measure/src/withMeasure.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/addons/measure/src/withMeasure.ts b/code/addons/measure/src/withMeasure.ts index 8a6b2a41489f..4cf105844f55 100644 --- a/code/addons/measure/src/withMeasure.ts +++ b/code/addons/measure/src/withMeasure.ts @@ -46,7 +46,7 @@ export const withMeasure = (StoryFn: StoryFunction, context: StoryCont }); }; - if (measureEnabled) { + if (context.viewMode === 'story' && measureEnabled) { document.addEventListener('pointerover', onPointerOver); init(); window.addEventListener('resize', onResize); @@ -58,7 +58,7 @@ export const withMeasure = (StoryFn: StoryFunction, context: StoryCont window.removeEventListener('resize', onResize); destroy(); }; - }, [measureEnabled]); + }, [measureEnabled, context.viewMode]); return StoryFn(); };