Improvements to RichText Lexical Editor and Internal Links Feature #13883
bentanen
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Currently, the LinkFeature in lexicalEditor groups internal links and external links together. This causes several challenges for developers using Payload CMS's RichText editor:
Lack of rendering support for internal links:
The default RichText component ('@payloadcms/richtext-lexical/react') does not include JSX support for internal links. This means users in the Admin panel can create internal links by default, but these links will not render out-of-the-box. Developers must implement custom converters to handle them.
Difficulty controlling internal link availability:
Since internal links depend on business logic, developers may not want users to create them in every context. Currently, removing internal links requires disabling all link functionality, which also disables external links.
No filtering by collection:
Internal links currently allow any collection to be selected, even if linking to certain collections does not make sense. This creates UX compromises and forces developers to implement workarounds.
Feature whitelisting limitations:
The features array in lexicalEditor acts as a whitelist. Removing a single feature (like LinkFeature) requires re-adding all other features, which is cumbersome.
Suggested Improvements
To improve flexibility and usability, I propose the following enhancements:
Allow LinkFeature to accept props that enable or disable internal and external links independently.
Provide a prop to specify which collections are available when selecting an internal document link.
Allow the features array in lexicalEditor to act as either a whitelist or a blacklist, making it easier to disable individual features without re-adding all others.
These changes would make it simpler for developers to configure RichText behavior according to their business logic, improve UX in the Admin panel, and reduce the need for custom converters.
Beta Was this translation helpful? Give feedback.
All reactions