From 595c60327e7fe08f8edd65c1bacfbd501bc54a2d Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Fri, 8 Nov 2024 15:02:28 +0200 Subject: [PATCH] Merge pull request #21737 from overleaf/dp-eq-preview-beta-badge-v2 Update split test badge for math preview tooltip V3 GitOrigin-RevId: 9ff41f5bc68ba6cd4d7a1c7e8d5f1f725369c02a --- .../components/math-preview-tooltip.tsx | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/components/math-preview-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/math-preview-tooltip.tsx index a605b1d94a..73258eccb2 100644 --- a/services/web/frontend/js/features/source-editor/components/math-preview-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/math-preview-tooltip.tsx @@ -12,9 +12,8 @@ import OLModal, { OLModalTitle, } from '@/features/ui/components/ol/ol-modal' import MaterialIcon from '@/shared/components/material-icon' -import SplitTestBadge from '@/shared/components/split-test-badge' import useEventListener from '@/shared/hooks/use-event-listener' -import { FC, useCallback, useEffect, useRef, useState } from 'react' +import { FC, useCallback, useLayoutEffect, useRef, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { useCodeMirrorStateContext, @@ -86,7 +85,7 @@ const MathPreviewTooltip: FC<{ mathContent: HTMLDivElement }> = ({ useEventListener('keydown', keyDownListener) - useEffect(() => { + useLayoutEffect(() => { if (mathRef.current) { mathRef.current.replaceChildren(mathContent) } @@ -96,10 +95,8 @@ const MathPreviewTooltip: FC<{ mathContent: HTMLDivElement }> = ({ <>
- + + @@ -217,4 +214,21 @@ const MathPreviewTooltip: FC<{ mathContent: HTMLDivElement }> = ({ ) } +// Temporary SplitTest badge for just this component that always shows +// as in beta and doesn't have a tooltip +const CustomSplitTestBadge: FC = () => { + return ( + + } + bs5={} + /> + + ) +} + export default MathPreviewTooltipContainer