Update default embed options in MediaShareEmbed

Changed initial states for keepAspectRatio, showTitle, and responsive options in MediaShareEmbed to improve default embed behavior. Also simplified aspect ratio change logic by removing unit options adjustments.
This commit is contained in:
Yiannis Christodoulou
2026-01-09 09:09:09 +02:00
parent 82314fe4b8
commit 30dad5dc06

View File

@@ -17,12 +17,12 @@ export function MediaShareEmbed(props) {
const onRightBottomRef = useRef(null); const onRightBottomRef = useRef(null);
const [maxHeight, setMaxHeight] = useState(window.innerHeight - 144 + 56); const [maxHeight, setMaxHeight] = useState(window.innerHeight - 144 + 56);
const [keepAspectRatio, setKeepAspectRatio] = useState(false); const [keepAspectRatio, setKeepAspectRatio] = useState(true);
const [showTitle, setShowTitle] = useState(false); const [showTitle, setShowTitle] = useState(true);
const [showRelated, setShowRelated] = useState(true); const [showRelated, setShowRelated] = useState(true);
const [showUserAvatar, setShowUserAvatar] = useState(true); const [showUserAvatar, setShowUserAvatar] = useState(true);
const [linkTitle, setLinkTitle] = useState(true); const [linkTitle, setLinkTitle] = useState(true);
const [responsive, setResponsive] = useState(true); const [responsive, setResponsive] = useState(false);
const [startAt, setStartAt] = useState(false); const [startAt, setStartAt] = useState(false);
const [startTime, setStartTime] = useState('0:00'); const [startTime, setStartTime] = useState('0:00');
const [aspectRatio, setAspectRatio] = useState('16:9'); const [aspectRatio, setAspectRatio] = useState('16:9');
@@ -103,16 +103,9 @@ export function MediaShareEmbed(props) {
const y = arr[1]; const y = arr[1];
setKeepAspectRatio(true); setKeepAspectRatio(true);
setEmbedWidthUnit('px');
setEmbedHeightUnit('px');
setEmbedHeightValue(parseInt((embedWidthValue * y) / x, 10)); setEmbedHeightValue(parseInt((embedWidthValue * y) / x, 10));
setUnitOptions([{ key: 'px', label: 'px' }]);
} else { } else {
setKeepAspectRatio(false); setKeepAspectRatio(false);
setUnitOptions([
{ key: 'px', label: 'px' },
{ key: 'percent', label: '%' },
]);
} }
} }