@@ -6,6 +6,7 @@ import {EditableText} from './EditableText';
66import { useDarkBackground } from './backgroundColor' ;
77import { useContentElementEditorState } from './useContentElementEditorState' ;
88import { useI18n } from './i18n' ;
9+ import { useTheme } from '../entryState' ;
910import { isBlankEditableTextValue } from './utils/blank' ;
1011
1112import styles from './Figure.module.css' ;
@@ -32,6 +33,9 @@ export function Figure({
3233 const { isSelected, isEditable} = useContentElementEditorState ( ) ;
3334 const [ isEditingCaption , setIsEditingCaption ] = useState ( false ) ;
3435 const { t} = useI18n ( { locale : 'ui' } ) ;
36+ const theme = useTheme ( ) ;
37+
38+ const captionAbove = ( theme . options . figureCaptionPosition === 'above' ) ;
3539
3640 caption = useMemo (
3741 ( ) => typeof caption === 'string' ?
@@ -43,7 +47,7 @@ export function Figure({
4347 if ( ! isBlankEditableTextValue ( caption ) || isEditable ) {
4448 return (
4549 < figure className = { classNames ( styles . root , { [ styles . invert ] : ! darkBackground } ) } >
46- { children }
50+ { ! captionAbove && children }
4751
4852 { isBlankEditableTextValue ( caption ) && isSelected && ! isEditingCaption && addCaptionButtonVisible &&
4953 < ActionButton position = { addCaptionButtonPosition }
@@ -63,6 +67,8 @@ export function Figure({
6367 hyphens = "none"
6468 placeholder = { t ( 'pageflow_scrolled.inline_editing.type_text' ) } />
6569 </ figcaption > }
70+
71+ { captionAbove && children }
6672 </ figure >
6773 ) ;
6874 }
0 commit comments