Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Matt
2023-03-30 06:20:17 -07:00
коммит произвёл GitHub
родитель b5951d3f32
Коммит 8cc7d7ba4a

Просмотреть файл

@@ -1,13 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {useRef} from 'react'; import React, {useRef, useState} from 'react';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import Tippy from '@tippyjs/react'; import Tippy from '@tippyjs/react';
import {Placement} from 'tippy.js'; import {Placement} from 'tippy.js';
import classNames from 'classnames'; import classNames from 'classnames';
import {PunchOutCoordsHeightAndWidth} from '../common/hooks/useMeasurePunchouts'; import {PunchOutCoordsHeightAndWidth} from '../common/hooks/useMeasurePunchouts';
import {useClickOutsideRef} from '../common/hooks/useClickOutsideRef';
import 'tippy.js/dist/tippy.css'; import 'tippy.js/dist/tippy.css';
import 'tippy.js/themes/light-border.css'; import 'tippy.js/themes/light-border.css';
@@ -89,12 +90,15 @@ export const TourTip = ({
}: Props) => { }: Props) => {
const FIRST_STEP_INDEX = 0; const FIRST_STEP_INDEX = 0;
const triggerRef = useRef(null); const triggerRef = useRef(null);
const [useBackdrop, setUseBackdrop] = useState(!hideBackdrop);
const onJump = (event: React.MouseEvent, jumpToStep: number) => { const onJump = (event: React.MouseEvent, jumpToStep: number) => {
if (handleJump) { handleJump?.(event, jumpToStep);
handleJump(event, jumpToStep);
}
}; };
useClickOutsideRef(triggerRef, () => {
setUseBackdrop(false);
});
// This needs to be changed if root-portal node isn't available to maybe body // This needs to be changed if root-portal node isn't available to maybe body
const rootPortal = document.getElementById('root-portal'); const rootPortal = document.getElementById('root-portal');
@@ -210,7 +214,7 @@ export const TourTip = ({
> >
<PulsatingDot/> <PulsatingDot/>
</div> </div>
<TourTipBackdrop {useBackdrop && <TourTipBackdrop
show={show} show={show}
onDismiss={handleDismiss} onDismiss={handleDismiss}
onPunchOut={handlePunchOut} onPunchOut={handlePunchOut}
@@ -218,7 +222,7 @@ export const TourTip = ({
overlayPunchOut={overlayPunchOut} overlayPunchOut={overlayPunchOut}
appendTo={rootPortal!} appendTo={rootPortal!}
transparent={hideBackdrop} transparent={hideBackdrop}
/> />}
{show && ( {show && (
<Tippy <Tippy
showOnCreate={show} showOnCreate={show}