feat: support custom plate plugins and custom toolbars#1464
feat: support custom plate plugins and custom toolbars#1464KCLAnthonyDiaz wants to merge 3 commits intocontentful:masterfrom
Conversation
Adds access to the current SDK instance should a plugin require that Adds access to the restricted marks configuration should a plugin require that
Makes sure to not touch the default test and default Storybook implementation since custom addons are an op-in
|
Thank you so much for the great work KCLAnthonyDiaz. While we appreciate the contribution, unfortunately, we won't be moving forward with this PR. The need for supporting custom plugins in the Rich Text has been brought up a few times internally, and the team explored the topic. We hope to work on it in the future but have yet to make concrete plans. The main issue with your approach here is that it exposes the internals of a 3rd-party library - Plate - that we have no control over and can't guarantee backward compatibility once exposed to customers. For example, the RT editor currently is on Plate v18.x, but the latest version is v23.x as of today. In theory, any of these version bumps could break existing plugins. That can be a painful experience trying to keep up with these upgrades (which we try to do often). It's something we want our users to avoid dealing with. Ideally, we want to abstract away the internal complexity and offer Contentful's own way of defining plugins in the future. Thank you for your understanding. |
Description
Replaces #702
Adds 2 new props to the Rich text Editor:
customPluginscustomToolbarsThese properties aim to make it more simple to add custom Plate plugins and add custom Toolbar elements to the existing Rich Text editors without needing to maintain a separate, modified, fork of the Rich text editor perpetually.
Notes
ctflRichTextAddon, that will attempt to load up a custom toolbar and plugin from the specified export name. Currently, the examplelipsumplugin is the only one that exists.Screenshots
Default Rich Text Editor in Storybook (Unchanged default behavior confirmation):
Rich Text Editor with custom features enabled in Storybook:
Rendered custom Plate plugin contents in Storybook: