-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Rich text input using Plate.js in forms #144
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprisingly little code in here that isn't from plate. There are a few problems with how the rich text input works.
- Adding text or rich input without pressing enter to create a new "group" of text doesn't make the form not pristine. You're not allowed to press the submit button.
- Adding rich input without creating a new "group" in the same field makes it so the media isn't saved in the input, only in our files.
- You have to click off a rich input field to update the form pristine state, meaning you can't edit a rich input field then click submit, you have to click off first.
- I'm guessing it's not that easy to delete uploaded media from our files when they're deleted in the rich input, but also add that if possible.
| }); | ||
| })() | ||
| ) : ( | ||
| <span>Pick a date</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untranslated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, cannot translate this because
- The next-intl context is unavailable, so the translations are missing as well
- We cannot get the context, because the components must be rendered synchronously to work with Plate.js HTML serialization.
The lack of translations only affects exported files. I've added a comment about this where appropriate.
| ) : ( | ||
| <div className='flex h-7 w-full items-center gap-2 whitespace-nowrap text-muted-foreground text-sm'> | ||
| <RadicalIcon className='size-6 text-muted-foreground/80' /> | ||
| <div>Add a Tex equation</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untranslated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, cannot translate this because
- The next-intl context is unavailable, so the translations are missing as well
- We cannot get the context, because the components must be rendered synchronously to work with Plate.js HTML serialization.
The lack of translations only affects exported files. I've added a comment about this where appropriate.
Must use debounced onChange here, because if we process the content on every keypress, the input becomes extremely laggy
PR guidelines/tips:
components/ui/platedo not a need thorough review. These files come from Plate and have been slightly adjusted to make them i18n-compatible and I've made them fit our code style guidelines more.