Skip to content

Commit

Permalink
Merge pull request #701 from contember/fix/playground-text-editor
Browse files Browse the repository at this point in the history
fix(playground): use relative content field name in PlateContentSync
  • Loading branch information
matej21 authored May 13, 2024
2 parents fdf2598 + 98f40e4 commit 98f7097
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const PlateEditor = Component(
onChange={handleEditorOnChange}
normalizeInitialValue
>
<PlateContentSync />
<PlateContentSync field={field} />
<div
ref={containerRef}
className={cn(
Expand Down Expand Up @@ -83,10 +83,14 @@ export const PlateEditor = Component(
'PlateEditor',
)

const PlateContentSync = () => {
const field = useField('data')
const fieldAccessor = field.getAccessor
const fieldValue = field.value
interface PlateContentSyncProps {
field: string | SugarableRelativeSingleField
}

const PlateContentSync = ({ field }: PlateContentSyncProps) => {
const contentField = useField(field)
const fieldAccessor = contentField.getAccessor
const fieldValue = contentField.value
const editor = useEditorRef()

useEffect(() => {
Expand Down

0 comments on commit 98f7097

Please sign in to comment.