2022-06-01 00:52:37 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
|
|
|
import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component';
|
2022-05-26 07:25:53 +08:00
|
|
|
import {
|
|
|
|
HUNDRED_PERCENT,
|
|
|
|
MAX_PERCENT,
|
|
|
|
STEP,
|
2022-06-01 00:52:37 +08:00
|
|
|
} from '/imports/utils/slideCalcUtils';
|
|
|
|
import Styled from './styles';
|
|
|
|
import ZoomTool from './zoom-tool/component';
|
|
|
|
import TooltipContainer from '/imports/ui/components/common/tooltip/container';
|
|
|
|
import KEY_CODES from '/imports/utils/keyCodes';
|
2022-05-26 07:25:53 +08:00
|
|
|
|
2022-06-01 00:52:37 +08:00
|
|
|
import ToolbarMenuItem from '/imports/ui/components/whiteboard/whiteboard-toolbar/toolbar-menu-item/component';
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2017-02-17 06:14:10 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
previousSlideLabel: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.prevSlideLabel',
|
|
|
|
description: 'Previous slide button label',
|
2017-02-17 06:14:10 +08:00
|
|
|
},
|
2019-06-06 23:04:02 +08:00
|
|
|
previousSlideDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.prevSlideDesc',
|
|
|
|
description: 'Aria description for when switching to previous slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
2017-02-17 06:14:10 +08:00
|
|
|
nextSlideLabel: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.nextSlideLabel',
|
|
|
|
description: 'Next slide button label',
|
2017-02-17 06:14:10 +08:00
|
|
|
},
|
2019-06-06 23:04:02 +08:00
|
|
|
nextSlideDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.nextSlideDesc',
|
|
|
|
description: 'Aria description for when switching to next slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
|
|
|
noNextSlideDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.noNextSlideDesc',
|
|
|
|
description: '',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
|
|
|
noPrevSlideDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.noPrevSlideDesc',
|
|
|
|
description: '',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
|
|
|
skipSlideLabel: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.skipSlideLabel',
|
|
|
|
description: 'Aria label for when switching to a specific slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
|
|
|
skipSlideDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.skipSlideDesc',
|
|
|
|
description: 'Aria description for when switching to a specific slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
2017-11-17 23:54:23 +08:00
|
|
|
goToSlide: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.goToSlide',
|
|
|
|
description: 'button for slide select',
|
2017-11-14 18:41:51 +08:00
|
|
|
},
|
2019-03-12 00:21:12 +08:00
|
|
|
selectLabel: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.selectLabel',
|
|
|
|
description: 'slide select label',
|
2019-03-12 00:21:12 +08:00
|
|
|
},
|
2018-10-25 01:54:19 +08:00
|
|
|
fitToWidth: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.fitToWidth',
|
|
|
|
description: 'button for fit to width',
|
2018-10-24 04:34:09 +08:00
|
|
|
},
|
2019-06-06 23:04:02 +08:00
|
|
|
fitToWidthDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.fitWidthDesc',
|
|
|
|
description: 'Aria description to display the whole width of the slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
2019-03-11 01:21:48 +08:00
|
|
|
fitToPage: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.fitToPage',
|
|
|
|
description: 'button label for fit to width',
|
2019-03-11 01:21:48 +08:00
|
|
|
},
|
2019-06-06 23:04:02 +08:00
|
|
|
fitToPageDesc: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentation.presentationToolbar.fitScreenDesc',
|
|
|
|
description: 'Aria description to display the whole slide',
|
2019-06-06 23:04:02 +08:00
|
|
|
},
|
2019-02-14 20:03:25 +08:00
|
|
|
presentationLabel: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.presentationUploder.title',
|
|
|
|
description: 'presentation area element label',
|
2022-05-26 07:25:53 +08:00
|
|
|
},
|
|
|
|
toolbarMultiUserOn: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.whiteboard.toolbar.multiUserOn',
|
|
|
|
description: 'Whiteboard toolbar turn multi-user on menu',
|
2022-05-26 07:25:53 +08:00
|
|
|
},
|
|
|
|
toolbarMultiUserOff: {
|
2022-06-01 00:52:37 +08:00
|
|
|
id: 'app.whiteboard.toolbar.multiUserOff',
|
|
|
|
description: 'Whiteboard toolbar turn multi-user off menu',
|
2019-02-14 20:03:25 +08:00
|
|
|
},
|
2017-02-17 06:14:10 +08:00
|
|
|
});
|
|
|
|
|
2019-06-13 02:40:58 +08:00
|
|
|
class PresentationToolbar extends PureComponent {
|
2016-08-03 06:55:20 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2018-04-12 04:05:30 +08:00
|
|
|
this.handleSkipToSlideChange = this.handleSkipToSlideChange.bind(this);
|
2018-08-23 01:49:33 +08:00
|
|
|
this.change = this.change.bind(this);
|
2019-06-06 23:04:02 +08:00
|
|
|
this.renderAriaDescs = this.renderAriaDescs.bind(this);
|
2019-04-13 11:48:21 +08:00
|
|
|
this.switchSlide = this.switchSlide.bind(this);
|
2019-07-18 08:30:28 +08:00
|
|
|
this.nextSlideHandler = this.nextSlideHandler.bind(this);
|
|
|
|
this.previousSlideHandler = this.previousSlideHandler.bind(this);
|
2021-10-07 22:09:05 +08:00
|
|
|
this.fullscreenToggleHandler = this.fullscreenToggleHandler.bind(this);
|
2022-05-26 07:25:53 +08:00
|
|
|
this.handleSwitchWhiteboardMode =
|
|
|
|
this.handleSwitchWhiteboardMode.bind(this);
|
2018-04-12 04:05:30 +08:00
|
|
|
}
|
|
|
|
|
2019-04-13 11:48:21 +08:00
|
|
|
componentDidMount() {
|
2022-06-01 00:52:37 +08:00
|
|
|
document.addEventListener('keydown', this.switchSlide);
|
2019-04-13 11:48:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
2022-06-01 00:52:37 +08:00
|
|
|
document.removeEventListener('keydown', this.switchSlide);
|
2019-04-13 11:48:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
switchSlide(event) {
|
|
|
|
const { target, which } = event;
|
2022-06-01 00:52:37 +08:00
|
|
|
const isBody = target.nodeName === 'BODY';
|
2019-04-13 11:48:21 +08:00
|
|
|
|
|
|
|
if (isBody) {
|
2019-09-19 07:29:09 +08:00
|
|
|
switch (which) {
|
|
|
|
case KEY_CODES.ARROW_LEFT:
|
2019-11-27 06:00:28 +08:00
|
|
|
case KEY_CODES.PAGE_UP:
|
2019-09-19 07:29:09 +08:00
|
|
|
this.previousSlideHandler();
|
|
|
|
break;
|
|
|
|
case KEY_CODES.ARROW_RIGHT:
|
2019-11-27 06:00:28 +08:00
|
|
|
case KEY_CODES.PAGE_DOWN:
|
2019-09-19 07:29:09 +08:00
|
|
|
this.nextSlideHandler();
|
|
|
|
break;
|
2021-10-07 22:09:05 +08:00
|
|
|
case KEY_CODES.ENTER:
|
|
|
|
this.fullscreenToggleHandler();
|
|
|
|
break;
|
2019-09-19 07:29:09 +08:00
|
|
|
default:
|
2019-09-19 01:00:33 +08:00
|
|
|
}
|
2019-04-13 11:48:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-12 04:05:30 +08:00
|
|
|
handleSkipToSlideChange(event) {
|
2022-05-26 07:25:53 +08:00
|
|
|
const { skipToSlide, podId } = this.props;
|
2018-12-22 00:03:55 +08:00
|
|
|
const requestedSlideNum = Number.parseInt(event.target.value, 10);
|
2021-12-01 20:56:55 +08:00
|
|
|
|
|
|
|
if (event) event.currentTarget.blur();
|
2022-05-19 03:35:42 +08:00
|
|
|
skipToSlide(requestedSlideNum, podId);
|
2016-08-03 06:55:20 +08:00
|
|
|
}
|
|
|
|
|
2021-12-01 20:56:55 +08:00
|
|
|
nextSlideHandler(event) {
|
2022-05-26 07:25:53 +08:00
|
|
|
const { nextSlide, currentSlideNum, numberOfSlides, podId } = this.props;
|
2019-07-18 08:30:28 +08:00
|
|
|
|
2021-12-01 20:56:55 +08:00
|
|
|
if (event) event.currentTarget.blur();
|
2019-07-18 08:30:28 +08:00
|
|
|
nextSlide(currentSlideNum, numberOfSlides, podId);
|
|
|
|
}
|
|
|
|
|
2021-12-01 20:56:55 +08:00
|
|
|
previousSlideHandler(event) {
|
2022-05-26 07:25:53 +08:00
|
|
|
const { previousSlide, currentSlideNum, podId } = this.props;
|
2019-07-18 08:30:28 +08:00
|
|
|
|
2021-12-01 20:56:55 +08:00
|
|
|
if (event) event.currentTarget.blur();
|
2019-07-18 08:30:28 +08:00
|
|
|
previousSlide(currentSlideNum, podId);
|
2016-08-03 06:55:20 +08:00
|
|
|
}
|
|
|
|
|
2021-10-07 22:09:05 +08:00
|
|
|
fullscreenToggleHandler() {
|
|
|
|
const {
|
|
|
|
fullscreenElementId,
|
|
|
|
isFullscreen,
|
|
|
|
layoutContextDispatch,
|
|
|
|
fullscreenAction,
|
2022-02-04 21:57:54 +08:00
|
|
|
fullscreenRef,
|
|
|
|
handleToggleFullScreen,
|
2021-10-07 22:09:05 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2022-02-04 21:57:54 +08:00
|
|
|
handleToggleFullScreen(fullscreenRef);
|
2022-06-01 00:52:37 +08:00
|
|
|
const newElement = isFullscreen ? '' : fullscreenElementId;
|
2021-10-07 22:09:05 +08:00
|
|
|
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: fullscreenAction,
|
|
|
|
value: {
|
|
|
|
element: newElement,
|
2022-06-01 00:52:37 +08:00
|
|
|
group: '',
|
2021-10-07 22:09:05 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-08-23 01:49:33 +08:00
|
|
|
change(value) {
|
2018-12-22 00:03:55 +08:00
|
|
|
const { zoomChanger } = this.props;
|
|
|
|
zoomChanger(value);
|
2018-08-23 01:49:33 +08:00
|
|
|
}
|
|
|
|
|
2019-06-06 23:04:02 +08:00
|
|
|
renderAriaDescs() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
return (
|
|
|
|
<div hidden>
|
|
|
|
{/* Aria description's for toolbar buttons */}
|
|
|
|
<div id="prevSlideDesc">
|
|
|
|
{intl.formatMessage(intlMessages.previousSlideDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="noPrevSlideDesc">
|
|
|
|
{intl.formatMessage(intlMessages.noPrevSlideDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="nextSlideDesc">
|
|
|
|
{intl.formatMessage(intlMessages.nextSlideDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="noNextSlideDesc">
|
|
|
|
{intl.formatMessage(intlMessages.noNextSlideDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="skipSlideDesc">
|
|
|
|
{intl.formatMessage(intlMessages.skipSlideDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="fitWidthDesc">
|
|
|
|
{intl.formatMessage(intlMessages.fitToWidthDesc)}
|
|
|
|
</div>
|
|
|
|
<div id="fitPageDesc">
|
|
|
|
{intl.formatMessage(intlMessages.fitToPageDesc)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-11-14 18:41:51 +08:00
|
|
|
renderSkipSlideOpts(numberOfSlides) {
|
|
|
|
// Fill drop down menu with all the slides in presentation
|
|
|
|
const { intl } = this.props;
|
|
|
|
const optionList = [];
|
|
|
|
for (let i = 1; i <= numberOfSlides; i += 1) {
|
2022-05-26 07:25:53 +08:00
|
|
|
optionList.push(
|
|
|
|
<option value={i} key={i}>
|
|
|
|
{intl.formatMessage(intlMessages.goToSlide, { 0: i })}
|
|
|
|
</option>
|
|
|
|
);
|
2017-11-14 18:41:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return optionList;
|
|
|
|
}
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2022-05-26 07:25:53 +08:00
|
|
|
handleSwitchWhiteboardMode() {
|
|
|
|
const {
|
|
|
|
multiUser,
|
|
|
|
whiteboardId,
|
|
|
|
removeWhiteboardGlobalAccess,
|
|
|
|
addWhiteboardGlobalAccess,
|
|
|
|
} = this.props;
|
|
|
|
if (multiUser) {
|
|
|
|
return removeWhiteboardGlobalAccess(whiteboardId);
|
|
|
|
}
|
|
|
|
addWhiteboardGlobalAccess(whiteboardId);
|
|
|
|
}
|
|
|
|
|
2016-08-03 06:55:20 +08:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
currentSlideNum,
|
|
|
|
numberOfSlides,
|
2018-12-22 00:03:55 +08:00
|
|
|
fitToWidthHandler,
|
2019-03-11 01:21:48 +08:00
|
|
|
fitToWidth,
|
2017-02-17 06:14:10 +08:00
|
|
|
intl,
|
2018-08-23 01:49:33 +08:00
|
|
|
zoom,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected,
|
2020-01-11 03:00:06 +08:00
|
|
|
isPollingEnabled,
|
|
|
|
amIPresenter,
|
|
|
|
currentSlidHasContent,
|
|
|
|
parseCurrentSlideContent,
|
2020-01-11 04:18:43 +08:00
|
|
|
startPoll,
|
|
|
|
currentSlide,
|
2022-06-07 04:30:34 +08:00
|
|
|
slidePosition,
|
|
|
|
tldrawAPI,
|
2021-08-04 19:42:38 +08:00
|
|
|
toolbarWidth,
|
2022-05-26 07:25:53 +08:00
|
|
|
multiUserSize,
|
|
|
|
multiUser,
|
2022-06-16 03:46:06 +08:00
|
|
|
isZoomed,
|
2016-08-03 06:55:20 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2021-04-01 01:13:36 +08:00
|
|
|
const { isMobile } = deviceInfo;
|
2019-03-12 00:21:12 +08:00
|
|
|
|
2022-05-19 03:35:42 +08:00
|
|
|
const startOfSlides = !(currentSlideNum > 1);
|
|
|
|
const endOfSlides = !(currentSlideNum < numberOfSlides);
|
2019-06-06 23:04:02 +08:00
|
|
|
|
|
|
|
const prevSlideAriaLabel = startOfSlides
|
|
|
|
? intl.formatMessage(intlMessages.previousSlideLabel)
|
2022-05-26 07:25:53 +08:00
|
|
|
: `${intl.formatMessage(intlMessages.previousSlideLabel)} (${
|
|
|
|
currentSlideNum <= 1 ? "" : currentSlideNum - 1
|
|
|
|
})`;
|
2019-06-06 23:04:02 +08:00
|
|
|
|
|
|
|
const nextSlideAriaLabel = endOfSlides
|
|
|
|
? intl.formatMessage(intlMessages.nextSlideLabel)
|
2022-05-26 07:25:53 +08:00
|
|
|
: `${intl.formatMessage(intlMessages.nextSlideLabel)} (${
|
|
|
|
currentSlideNum >= 1 ? currentSlideNum + 1 : ""
|
|
|
|
})`;
|
2022-05-19 03:35:42 +08:00
|
|
|
|
2016-08-03 06:55:20 +08:00
|
|
|
return (
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.PresentationToolbarWrapper
|
|
|
|
id="presentationToolbarWrapper"
|
2022-05-26 07:25:53 +08:00
|
|
|
>
|
2019-06-06 23:04:02 +08:00
|
|
|
{this.renderAriaDescs()}
|
2020-01-11 03:00:06 +08:00
|
|
|
{
|
|
|
|
<div>
|
2022-05-26 07:25:53 +08:00
|
|
|
{isPollingEnabled ? (
|
|
|
|
<Styled.QuickPollButton
|
|
|
|
{...{
|
|
|
|
currentSlidHasContent,
|
|
|
|
intl,
|
|
|
|
amIPresenter,
|
|
|
|
parseCurrentSlideContent,
|
|
|
|
startPoll,
|
|
|
|
currentSlide,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : null}
|
2020-01-11 03:00:06 +08:00
|
|
|
</div>
|
|
|
|
}
|
2018-08-23 01:49:33 +08:00
|
|
|
{
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.PresentationSlideControls>
|
|
|
|
<Styled.PrevSlideButton
|
2018-08-23 01:49:33 +08:00
|
|
|
role="button"
|
2019-06-06 23:04:02 +08:00
|
|
|
aria-label={prevSlideAriaLabel}
|
2022-05-26 07:25:53 +08:00
|
|
|
aria-describedby={
|
|
|
|
startOfSlides ? "noPrevSlideDesc" : "prevSlideDesc"
|
|
|
|
}
|
2019-06-27 00:29:34 +08:00
|
|
|
disabled={startOfSlides || !isMeteorConnected}
|
2018-08-23 01:49:33 +08:00
|
|
|
color="default"
|
|
|
|
icon="left_arrow"
|
|
|
|
size="md"
|
2022-05-19 03:35:42 +08:00
|
|
|
onClick={this.previousSlideHandler}
|
2018-08-23 01:49:33 +08:00
|
|
|
label={intl.formatMessage(intlMessages.previousSlideLabel)}
|
|
|
|
hideLabel
|
2020-01-29 03:25:27 +08:00
|
|
|
data-test="prevSlide"
|
2018-08-23 01:49:33 +08:00
|
|
|
/>
|
2019-03-12 00:21:12 +08:00
|
|
|
|
2022-05-26 07:25:53 +08:00
|
|
|
<TooltipContainer
|
|
|
|
title={intl.formatMessage(intlMessages.selectLabel)}
|
|
|
|
>
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.SkipSlideSelect
|
2019-03-12 00:21:12 +08:00
|
|
|
id="skipSlide"
|
2019-06-06 23:04:02 +08:00
|
|
|
aria-label={intl.formatMessage(intlMessages.skipSlideLabel)}
|
2019-03-12 00:21:12 +08:00
|
|
|
aria-describedby="skipSlideDesc"
|
|
|
|
aria-live="polite"
|
|
|
|
aria-relevant="all"
|
2019-06-27 00:29:34 +08:00
|
|
|
disabled={!isMeteorConnected}
|
2022-05-19 03:35:42 +08:00
|
|
|
value={currentSlideNum}
|
2019-03-12 00:21:12 +08:00
|
|
|
onChange={this.handleSkipToSlideChange}
|
2020-01-29 03:25:27 +08:00
|
|
|
data-test="skipSlide"
|
2019-03-12 00:21:12 +08:00
|
|
|
>
|
|
|
|
{this.renderSkipSlideOpts(numberOfSlides)}
|
2021-11-08 21:09:56 +08:00
|
|
|
</Styled.SkipSlideSelect>
|
2020-07-23 06:08:55 +08:00
|
|
|
</TooltipContainer>
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.NextSlideButton
|
2018-08-23 01:49:33 +08:00
|
|
|
role="button"
|
2019-06-06 23:04:02 +08:00
|
|
|
aria-label={nextSlideAriaLabel}
|
2022-05-26 07:25:53 +08:00
|
|
|
aria-describedby={
|
2022-06-01 00:52:37 +08:00
|
|
|
endOfSlides ? 'noNextSlideDesc' : 'nextSlideDesc'
|
2022-05-26 07:25:53 +08:00
|
|
|
}
|
2019-07-24 03:56:39 +08:00
|
|
|
disabled={endOfSlides || !isMeteorConnected}
|
2018-08-23 01:49:33 +08:00
|
|
|
color="default"
|
|
|
|
icon="right_arrow"
|
|
|
|
size="md"
|
2022-05-19 03:35:42 +08:00
|
|
|
onClick={this.nextSlideHandler}
|
2018-08-23 01:49:33 +08:00
|
|
|
label={intl.formatMessage(intlMessages.nextSlideLabel)}
|
|
|
|
hideLabel
|
2020-01-29 03:25:27 +08:00
|
|
|
data-test="nextSlide"
|
2018-08-23 01:49:33 +08:00
|
|
|
/>
|
2021-11-08 21:09:56 +08:00
|
|
|
</Styled.PresentationSlideControls>
|
2018-08-23 01:49:33 +08:00
|
|
|
}
|
|
|
|
{
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.PresentationZoomControls>
|
2022-05-26 07:25:53 +08:00
|
|
|
<Styled.WBAccessButton
|
|
|
|
role="button"
|
|
|
|
aria-label={
|
|
|
|
multiUser
|
|
|
|
? intl.formatMessage(intlMessages.toolbarMultiUserOff)
|
|
|
|
: intl.formatMessage(intlMessages.toolbarMultiUserOn)
|
|
|
|
}
|
|
|
|
color="default"
|
|
|
|
disabled={!isMeteorConnected}
|
2022-06-01 00:52:37 +08:00
|
|
|
icon={multiUser ? 'multi_whiteboard' : 'whiteboard'}
|
2022-05-26 07:25:53 +08:00
|
|
|
size="md"
|
|
|
|
circle={false}
|
|
|
|
onClick={() => this.handleSwitchWhiteboardMode(!multiUser)}
|
|
|
|
label={
|
|
|
|
multiUser
|
|
|
|
? intl.formatMessage(intlMessages.toolbarMultiUserOff)
|
|
|
|
: intl.formatMessage(intlMessages.toolbarMultiUserOn)
|
|
|
|
}
|
|
|
|
hideLabel
|
|
|
|
/>
|
|
|
|
{multiUser ? (
|
|
|
|
<Styled.MultiUserTool>{multiUserSize}</Styled.MultiUserTool>
|
|
|
|
) : (
|
|
|
|
<Styled.MUTPlaceholder />
|
|
|
|
)}
|
|
|
|
{!isMobile ? (
|
|
|
|
<TooltipContainer>
|
2022-05-16 10:35:17 +08:00
|
|
|
<ZoomTool
|
2022-06-07 04:30:34 +08:00
|
|
|
slidePosition={slidePosition}
|
|
|
|
zoomValue={tldrawAPI?.getPageState()?.camera?.zoom}
|
2022-05-19 03:35:42 +08:00
|
|
|
currentSlideNum={currentSlideNum}
|
2022-05-16 10:35:17 +08:00
|
|
|
change={this.change}
|
|
|
|
minBound={0.1}
|
|
|
|
maxBound={5}
|
|
|
|
step={STEP}
|
|
|
|
isMeteorConnected={isMeteorConnected}
|
2022-06-07 04:30:34 +08:00
|
|
|
tldrawAPI={tldrawAPI}
|
2022-06-16 03:46:06 +08:00
|
|
|
isZoomed={isZoomed}
|
2022-05-16 10:35:17 +08:00
|
|
|
/>
|
2022-05-26 07:25:53 +08:00
|
|
|
</TooltipContainer>
|
|
|
|
) : null}
|
2021-11-08 21:09:56 +08:00
|
|
|
<Styled.FitToWidthButton
|
2019-02-12 21:35:52 +08:00
|
|
|
role="button"
|
2022-06-01 00:52:37 +08:00
|
|
|
aria-describedby={fitToWidth ? 'fitPageDesc' : 'fitWidthDesc'}
|
2022-05-26 07:25:53 +08:00
|
|
|
aria-label={
|
|
|
|
fitToWidth
|
|
|
|
? `${intl.formatMessage(
|
|
|
|
intlMessages.presentationLabel
|
|
|
|
)} ${intl.formatMessage(intlMessages.fitToPage)}`
|
|
|
|
: `${intl.formatMessage(
|
|
|
|
intlMessages.presentationLabel
|
|
|
|
)} ${intl.formatMessage(intlMessages.fitToWidth)}`
|
2019-06-06 23:04:02 +08:00
|
|
|
}
|
2019-02-12 21:35:52 +08:00
|
|
|
color="default"
|
2019-06-27 00:29:34 +08:00
|
|
|
disabled={!isMeteorConnected}
|
2019-02-12 21:35:52 +08:00
|
|
|
icon="fit_to_width"
|
|
|
|
size="md"
|
|
|
|
circle={false}
|
2022-05-16 10:35:17 +08:00
|
|
|
onClick={() => this.props.tldrawAPI.zoomToFit()}
|
|
|
|
label={intl.formatMessage(intlMessages.fitToPage)}
|
2019-02-12 21:35:52 +08:00
|
|
|
hideLabel
|
|
|
|
/>
|
2021-11-08 21:09:56 +08:00
|
|
|
</Styled.PresentationZoomControls>
|
2018-08-23 01:49:33 +08:00
|
|
|
}
|
2021-11-08 21:09:56 +08:00
|
|
|
</Styled.PresentationToolbarWrapper>
|
2016-08-03 06:55:20 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-02-17 06:14:10 +08:00
|
|
|
|
2017-08-21 08:16:39 +08:00
|
|
|
PresentationToolbar.propTypes = {
|
2019-07-18 08:30:28 +08:00
|
|
|
// The Id for the current pod. Should always be default pod
|
|
|
|
podId: PropTypes.string.isRequired,
|
2017-08-21 08:16:39 +08:00
|
|
|
// Number of current slide being displayed
|
|
|
|
currentSlideNum: PropTypes.number.isRequired,
|
|
|
|
// Total number of slides in this presentation
|
|
|
|
numberOfSlides: PropTypes.number.isRequired,
|
|
|
|
// Actions required for the presenter toolbar
|
2019-07-18 08:30:28 +08:00
|
|
|
nextSlide: PropTypes.func.isRequired,
|
|
|
|
previousSlide: PropTypes.func.isRequired,
|
|
|
|
skipToSlide: PropTypes.func.isRequired,
|
2017-09-26 07:45:44 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-03-11 01:21:48 +08:00
|
|
|
zoomChanger: PropTypes.func.isRequired,
|
|
|
|
fitToWidthHandler: PropTypes.func.isRequired,
|
|
|
|
fitToWidth: PropTypes.bool.isRequired,
|
|
|
|
zoom: PropTypes.number.isRequired,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected: PropTypes.bool.isRequired,
|
2021-10-07 22:09:05 +08:00
|
|
|
fullscreenElementId: PropTypes.string.isRequired,
|
|
|
|
fullscreenAction: PropTypes.string.isRequired,
|
|
|
|
isFullscreen: PropTypes.bool.isRequired,
|
|
|
|
layoutContextDispatch: PropTypes.func.isRequired,
|
2017-08-21 08:16:39 +08:00
|
|
|
};
|
|
|
|
|
2017-09-26 07:45:44 +08:00
|
|
|
export default injectWbResizeEvent(injectIntl(PresentationToolbar));
|