marmelab / aor-rich-text-input

<RichTextInput> component for admin-on-rest, useful for editing HTML code in admin GUIs
MIT License
23 stars 25 forks source link

Empty content on first load #3

Open DjLeChuck opened 7 years ago

DjLeChuck commented 7 years ago

Coming from the listing, the field is empty. After hitting refresh button, the field is filled.

If I log the value received in componentDidMount, I see it's empty the first time and not the second one.

demo

fzaninotto commented 7 years ago

Can't reproduce the issue. Could you provide a simplified test case?

DjLeChuck commented 7 years ago

I'm with the master branch not next, maybe the behaviour is different.

If I'm not wrong next should be available soon, so I can wait and test with it when it's out?

fzaninotto commented 7 years ago

next will be a bit late - expect it end of April.

thomasstreckercc commented 7 years ago

What is the status of this? It seems to be still open as far as I am concerned.

renetalk commented 7 years ago

I solved the problem by using another rich text editor. Even https://github.com/LoicMahieu/aor-tinymce-input has the same problem but the following implementation does work: https://github.com/HurricaneJames/react-tinymce-input

The problem seems to be that the rerendering of the component (happens multiple times on first draw) with changing values for the rich text input is not properly handled by the rich text editors. See https://github.com/instructure-react/react-tinymce/issues/21

pbreah commented 6 years ago

I experienced the same issue, and this is a workaround:

{ props.record.field_name? <RichTextInput source="field_name" /> : null}

it makes sure your data is available before rendering your RichTextInput