Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RichTextInput does not update when its editorOptions prop changes #9289

Merged
merged 6 commits into from
Oct 2, 2023

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Sep 18, 2023

When adding tiptap extensions that relies on the current record, you have to update the editorOptions. However the changes aren't reflected.

This PR solves this by passing the editorOptions as useEditor dependencies

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into some warnings in the console when playing with the story:

Tippy warning

tippy.jsdestroy() was called on an already-destroyed instance. This is a no-op but indicates a potential memory leak.👷‍ This is a development-only message. It will be removed in production.

After selecting a tag (the popup closes) and then moving to the next record.

React warning

Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.
    at RichTextInput (http://localhost:9010/ra-input-rich-text-src-RichTextInput-stories.iframe.bundle.js:1182:25)
    at MyRichTextInput (http://localhost:9010/ra-input-rich-text-src-RichTextInput-stories.iframe.bundle.js:604:73)
    at div

After moving to another record while the popup is still open.

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation with keyboard is functional and the console warnings are gone, so GJ!

However, now, when I select an option in the dropdown list, then the list remains open instead of closing right away. Can you fix this too?

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All errors fixed, nice job! 💪

@slax57 slax57 added this to the 4.14.5 milestone Oct 2, 2023
@slax57 slax57 merged commit 69f63ca into master Oct 2, 2023
9 checks passed
@slax57 slax57 deleted the fix-rich-text-input-editor-options-update branch October 2, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants