Switched member email editor to use BASIC_NODES instead of DEFAULT_NODES #25662
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ref https://linear.app/ghost/issue/NY-849/editor-should-be-restricted
The Koenig editor that we're using in the member welcome emails modal is currently unrestricted, which allows for any and all cards to be used. It doesn't have the plugins necessary to insert them, but if you paste content from a post into the editor, it will try to include the cards and make the editor largely unusable.
This fixes that by restricting the allowed nodes to only the
BASIC_NODESdefined in@tryghost/koenig-lexical, which only includes basic text formatting (bold, italics), lists, links, and the TK node.Remaining Issues
This solves much of the problem, but there are some bits that this doesn't completely solve:
BASIC_NODESincludes the TK card, which we arguably don't want hereBASIC_NODESdoesn't includeextended-text, so any sites that have already created welcome emails (luckily only local/internal ones) will throw an error when trying to load the content from the DB, since it hasextended-textnodes in it.Path Forward
I think ultimately we'll want to create our own list of valid nodes in keonig-lexical for this specific use-case. That allows us to tailor the editor to our exact needs, so we can e.g. remove the TK node, and eventually add Headings, Buttons, etc.