Skip to content

Conversation

@ZeroWave022
Copy link
Member

@ZeroWave022 ZeroWave022 commented Aug 7, 2025

  • Adds Plate.js and Plate UI components to support rich text input
  • Custom upload logic for files (images, video, etc)
  • Adds an EditorField to accept rich text input in forms
  • Implements saving of rich text in PostgreSQL for groups, events, rules and news articles

PR guidelines/tips:

  • Do not start reviewing this before all features that may need rich text input are merged into dev, and before this branch is updated with dev after that change. This means we should merge news, events, groups and rules before merging this PR.
  • This is not a 15k lines PR. Most files come from Plate and do not need extensive review.
  • All files in components/ui/plate do 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.
    • Exceptions: Please take a look if you find any untranslated strings, but all of them should be fine now.
    • If there are any bugs related to these components because some feature doesn't work, just letting me know what doesn't work will be more than enough. I'm not expecting any debugging to be done by any reviewer(s) here because of the amount of code/files
  • Please test the features of the editor, especially uploading of various media, using your own files and using links.
    • The code here has been modified to use our S3 service. Some modifications have been made to how these items are saved and loaded. I have done some testing, but more of it won't hurt.

@ZeroWave022 ZeroWave022 changed the title feat: Plate rich input feat: Rich text input using Plate.js in forms Aug 7, 2025
@ZeroWave022 ZeroWave022 marked this pull request as ready for review August 8, 2025 22:31
@ZeroWave022 ZeroWave022 marked this pull request as draft September 29, 2025 19:06
@ZeroWave022 ZeroWave022 marked this pull request as ready for review October 9, 2025 00:01
Copy link
Member

@seandreassen seandreassen left a 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>
Copy link
Member

Choose a reason for hiding this comment

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

Untranslated

Copy link
Member Author

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

  1. The next-intl context is unavailable, so the translations are missing as well
  2. 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>
Copy link
Member

Choose a reason for hiding this comment

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

Untranslated

Copy link
Member Author

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

  1. The next-intl context is unavailable, so the translations are missing as well
  2. 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.

@ZeroWave022 ZeroWave022 merged commit 542b855 into dev Oct 12, 2025
5 checks passed
@ZeroWave022 ZeroWave022 deleted the feat/plate-rich-input branch October 12, 2025 14:10
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