diff --git a/packages/jaen-pages/src/containers/fields/ChoiceField/index.tsx b/packages/jaen-pages/src/containers/fields/ChoiceField/index.tsx index 5ec3f417..9b498963 100644 --- a/packages/jaen-pages/src/containers/fields/ChoiceField/index.tsx +++ b/packages/jaen-pages/src/containers/fields/ChoiceField/index.tsx @@ -48,7 +48,8 @@ const ChoiceField: React.FC = ({ onRenderPopover, onRender, initValue, - fieldName + fieldName, + ...props }) => { const dispatch = useAppDispatch() @@ -58,7 +59,7 @@ const ChoiceField: React.FC = ({ const field = {initValue, fieldName, block} const {jaenPageContext} = useTemplate() - const pageId = jaenPageContext.id + const pageId = props.pageId || jaenPageContext.id const register = () => dispatch(registerPageField({pageId, field})) const unregister = () => dispatch(unregisterPageField({pageId, field})) diff --git a/packages/jaen-pages/src/containers/fields/ImageField/index.tsx b/packages/jaen-pages/src/containers/fields/ImageField/index.tsx index 9fd794f8..0cb52867 100644 --- a/packages/jaen-pages/src/containers/fields/ImageField/index.tsx +++ b/packages/jaen-pages/src/containers/fields/ImageField/index.tsx @@ -36,7 +36,7 @@ const ImageField: React.FC = ({ const dispatch = useAppDispatch() const isEditing = useAppSelector(state => state.options.isEditing) const {jaenPageContext} = useTemplate() - const pageId = jaenPageContext.id + const pageId = props.pageId || jaenPageContext.id const page = usePage(pageId) diff --git a/packages/jaen-pages/src/containers/fields/TextField/index.tsx b/packages/jaen-pages/src/containers/fields/TextField/index.tsx index 77e052fc..13374bc2 100644 --- a/packages/jaen-pages/src/containers/fields/TextField/index.tsx +++ b/packages/jaen-pages/src/containers/fields/TextField/index.tsx @@ -28,12 +28,13 @@ const TextField: React.FC = ({ rtf = true, toolbar = 'balloon', fieldName, - initValue + initValue, + ...props }) => { const dispatch = useAppDispatch() const isEditing = useAppSelector(state => state.options.isEditing) const {jaenPageContext} = useTemplate() - const pageId = jaenPageContext.id + const pageId = props.pageId || jaenPageContext.id const {block, updatedFieldName} = useBlock(fieldName) fieldName = updatedFieldName diff --git a/packages/jaen-pages/src/types.ts b/packages/jaen-pages/src/types.ts index 1b411872..bd3ae671 100644 --- a/packages/jaen-pages/src/types.ts +++ b/packages/jaen-pages/src/types.ts @@ -16,6 +16,10 @@ export type StreamBlockIdentifier = { export type FieldIdentifier = { initValue: any fieldName: string + /** + * Override the default pageId for the field. + */ + pageId?: string } export type BlockIdentifier = {