diff --git a/projects/packages/videopress/changelog/update-videopress-add-not-edition-allowed-notice b/projects/packages/videopress/changelog/update-videopress-add-not-edition-allowed-notice new file mode 100644 index 0000000000000..cc58f79f11079 --- /dev/null +++ b/projects/packages/videopress/changelog/update-videopress-add-not-edition-allowed-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +VideoPress: add a Notice when trying to edit a video that doesn't belong to the site diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx index 28d6ddca25c74..9b9fd933cd0aa 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx @@ -16,11 +16,11 @@ import { __ } from '@wordpress/i18n'; import ChaptersLearnMoreHelper from '../../../../../components/chapters-learn-more-helper'; import IncompleteChaptersNotice from '../../../../../components/incomplete-chapters-notice'; import useChaptersLiveParsing from '../../../../../hooks/use-chapters-live-parsing'; -import { DetailsPanelProps } from '../../types'; import './styles.scss'; /** * Types */ +import type { DetailsPanelProps } from '../../types'; import type React from 'react'; const CHARACTERS_PER_LINE = 31; @@ -62,6 +62,15 @@ export default function DetailsPanel( { return ( + { ! videoBelongToSite && ( + + { __( + 'This video is not owned by this site. You can still embed it and customize the player, but you won’t be able to edit the video.', + 'jetpack-videopress-pkg' + ) } + + ) } +
; } diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx index 3d6791f2b4b9b..4137b507ddb3e 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx @@ -18,20 +18,21 @@ import { /** * Types */ -import type { VideoControlProps } from '../../types'; +import type { PrivacyAndRatingPanelProps } from '../../types'; import type React from 'react'; /** * React component that renders the settings within the privacy and ratings panel. * - * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} - Settings to change video's privacy and ratings. + * @param {PrivacyAndRatingPanelProps} props - Component props. + * @returns {React.ReactElement} Settings to change video's privacy and ratings. */ export default function PrivacyAndRatingSettings( { attributes, setAttributes, privateEnabledForSite, -}: VideoControlProps ): React.ReactElement { + videoBelongToSite, +}: PrivacyAndRatingPanelProps ): React.ReactElement { const { privacySetting, rating, allowDownload, displayEmbed } = attributes; const privacyLabels = { @@ -82,6 +83,7 @@ export default function PrivacyAndRatingSettings( { onChange={ value => { setAttributes( { rating: value } ); } } + disabled={ ! videoBelongToSite } /> { setAttributes( { allowDownload: value } ); } } + disabled={ ! videoBelongToSite } /> ); diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx index ce9ffcaa6425b..951b91d9314bc 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx @@ -535,10 +535,17 @@ export default function VideoPressEdit( { attributes={ attributes } setAttributes={ setAttributes } isGeneratingPoster={ isGeneratingPoster } + videoBelongToSite={ videoBelongToSite } /> diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/types.ts b/projects/packages/videopress/src/client/block-editor/blocks/video/types.ts index c97d650e94a61..2fa3ad7a1736a 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/types.ts +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/types.ts @@ -152,6 +152,11 @@ export type VideoControlProps = { export type PosterPanelProps = VideoControlProps & { isGeneratingPoster?: boolean; + videoBelongToSite?: boolean; +}; + +export type PrivacyAndRatingPanelProps = VideoControlProps & { + videoBelongToSite?: boolean; }; export type VideoEditProps = VideoControlProps;