Skip to content

Commit

Permalink
fixed video block with icon only displaying poster image in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Feb 23, 2024
1 parent b8bb7f3 commit 722b32d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 7 additions & 10 deletions gutenberg/blocks/video/edit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import classnames from 'classnames/dedupe';

import { useBlockProps } from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';
Expand Down Expand Up @@ -48,8 +46,6 @@ function getVideoPoster(url, cb) {
export default function BlockEdit(props) {
const { attributes, setAttributes, isSelected, clientId } = props;

let { className = '' } = props;

const {
type,
video,
Expand All @@ -65,6 +61,8 @@ export default function BlockEdit(props) {
posterHeight,

clickAction,

className,
} = attributes;

// Mount and update.
Expand Down Expand Up @@ -112,11 +110,12 @@ export default function BlockEdit(props) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [className]);

className = classnames('ghostkit-video', className);
className = applyFilters('ghostkit.editor.className', className, props);

const blockProps = useBlockProps({
className,
className: applyFilters(
'ghostkit.editor.className',
'ghostkit-video',
props
),
'data-video-aspect-ratio': videoAspectRatio,
});

Expand All @@ -125,13 +124,11 @@ export default function BlockEdit(props) {
<BackgroundColor
attributes={attributes}
setAttributes={setAttributes}
className={className}
clientId={clientId}
/>
<BlockInspectorControls
attributes={attributes}
setAttributes={setAttributes}
className={className}
isSelected={isSelected}
/>

Expand Down
4 changes: 3 additions & 1 deletion gutenberg/blocks/video/edit/background-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
import { hasClass } from '../../../utils/classes-replacer';

export default function BackgroundColor(props) {
const { attributes, setAttributes, className, clientId } = props;
const { attributes, setAttributes, clientId } = props;
const {
type,
clickAction,
Expand All @@ -21,6 +21,8 @@ export default function BackgroundColor(props) {

fullscreenBackgroundColor,
fullscreenBackgroundGradient,

className,
} = attributes;

const colorGradientSettings = useMultipleOriginColorsAndGradients();
Expand Down
4 changes: 3 additions & 1 deletion gutenberg/blocks/video/edit/inspector-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
const DEFAULT_SIZE_SLUG = 'full';

export default function BlockInspectorControls(props) {
const { attributes, setAttributes, className, isSelected } = props;
const { attributes, setAttributes, isSelected } = props;

const {
type,
Expand Down Expand Up @@ -62,6 +62,8 @@ export default function BlockInspectorControls(props) {
clickAction,
fullscreenBackgroundColor,
fullscreenActionCloseIcon,

className,
} = attributes;

const { editorSettings, posterImage } = useSelect((select) => {
Expand Down

0 comments on commit 722b32d

Please sign in to comment.