field-editors icon indicating copy to clipboard operation
field-editors copied to clipboard

feat: allow MultipleEntryReferenceEditor to render children prop

Open nerdess opened this issue 1 year ago • 3 comments

The commit message is a bit misleading. This is about offering the ability to extend the body of an MultipleReferenceEditor entry with custom React elements.

Check storyboard > Multiple Entry > Custom Children.

The content "Some custom children..." has been added using the new optional renderCustomChildren prop.

Bildschirmfoto 2024-05-23 um 14 54 52
<MultipleEntryReferenceEditor
    renderCustomChildren={() => {
      return <>Some custom children. Anything can be rendered here!</>;
    }}
    viewType="link"
    sdk={sdk}
    isInitiallyDisabled={isInitiallyDisabled}
    parameters={{
      instance: instanceParams || {
        showCreateEntityAction: true,
        showLinkEntityAction: true,
      },
  }}
/>

I was missing this feature when developing a custom Contentul app. Might be useful for others.

nerdess avatar May 23 '24 13:05 nerdess

Hi @nerdess. MultipleEntryReferenceEditor component have renderCustomCard prop that has similar functionality. I believe you can achive the same result with it.

Please refer to the Storybook: https://contentful-field-editors.netlify.app/?path=/story/editors-multiple-entry--custom-card

colomolo avatar Jun 13 '24 13:06 colomolo

@colomolo Yeah I am aware of renderCustomCard and I started with it but faced limitations. It's been half a year since I did that amendment, if I remember correctly it was like this: with just popping in the children I did have the correct header out-of-the-box and also the drag/drop functionality of the list. I did not have to rebuild all that.

nerdess avatar Jun 13 '24 13:06 nerdess

Marking pull request as stale since there was no activity for 30 days

github-actions[bot] avatar Jul 14 '24 07:07 github-actions[bot]

@colomolo It's been a while but would there be an interest in this PR if I fix the tests?

nerdess avatar Mar 08 '25 16:03 nerdess

Hi @nerdess. Thanks for getting back to this. We discussed this today and as there were no other requests for this functionality, we agreed to avoid adding it as for now. Sorry for a long turnaround.

colomolo avatar Mar 19 '25 18:03 colomolo

I will close this now. Please feel free to reach out with any other questions.

colomolo avatar Apr 01 '25 16:04 colomolo