From 72ac0d1a810a050618df3250c42fe0ece3fe27f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Souza?= Date: Wed, 7 Feb 2024 15:43:32 -0300 Subject: [PATCH 1/2] fix snapshot on safari --- .../presentation-menu/component.jsx | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx index 7b1961a4bb..a177385920 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx @@ -12,7 +12,7 @@ import Styled from './styles'; import BBBMenu from '/imports/ui/components/common/menu/component'; import TooltipContainer from '/imports/ui/components/common/tooltip/container'; import { ACTIONS } from '/imports/ui/components/layout/enums'; -import browserInfo from '/imports/utils/browserInfo'; +import deviceInfo from '/imports/utils/deviceInfo'; import AppService from '/imports/ui/components/app/service'; const intlMessages = defineMessages({ @@ -280,9 +280,9 @@ const PresentationMenu = (props) => { ); } - const { isSafari } = browserInfo; + const { isIos } = deviceInfo; - if (!isSafari && allowSnapshotOfCurrentSlide) { + if (allowSnapshotOfCurrentSlide) { menuItems.push( { key: 'list-item-screenshot', @@ -322,18 +322,38 @@ const PresentationMenu = (props) => { && shape.y >= 0, ); const svgElem = await tldrawAPI.getSvg(shapes.map((shape) => shape.id)); - const width = svgElem?.width?.baseVal?.value ?? window.screen.width; - const height = svgElem?.height?.baseVal?.value ?? window.screen.height; - const data = await toPng(svgElem, { width, height, backgroundColor: '#FFF' }); + // workaround for ios + if (isIos) { + svgElem.setAttribute('width', backgroundShape.props.w); + svgElem.setAttribute('height', backgroundShape.props.h); + svgElem.setAttribute('viewBox', `1 1 ${backgroundShape.props.w} ${backgroundShape.props.h}`); - const anchor = document.createElement('a'); - anchor.href = data; - anchor.setAttribute( - 'download', - `${elementName}_${meetingName}_${new Date().toISOString()}.png`, - ); - anchor.click(); + const svgString = new XMLSerializer().serializeToString(svgElem); + const blob = new Blob([svgString], { type: 'image/svg+xml' }); + + const data = URL.createObjectURL(blob); + const anchor = document.createElement('a'); + anchor.href = data; + anchor.setAttribute( + 'download', + `${elementName}_${meetingName}_${new Date().toISOString()}.svg`, + ); + anchor.click(); + } else { + const width = svgElem?.width?.baseVal?.value ?? window.screen.width; + const height = svgElem?.height?.baseVal?.value ?? window.screen.height; + + const data = await toPng(svgElem, { width, height, backgroundColor: '#FFF' }); + + const anchor = document.createElement('a'); + anchor.href = data; + anchor.setAttribute( + 'download', + `${elementName}_${meetingName}_${new Date().toISOString()}.png`, + ); + anchor.click(); + } setState({ loading: false, From ac7be81352d940bab8d212168ce6a9549998edca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Souza?= Date: Fri, 16 Feb 2024 09:39:58 -0300 Subject: [PATCH 2/2] fix presentation menu z-index --- bigbluebutton-html5/imports/ui/components/presentation/styles.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/styles.js b/bigbluebutton-html5/imports/ui/components/presentation/styles.js index bd91bfceaa..c33dd0e1ea 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/styles.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/styles.js @@ -125,7 +125,6 @@ const PresentationContainer = styled.div` left: 0; right: 0; bottom: 0; - z-index: 1; `; const Presentation = styled.div`