Custom Lexical feature throwing error #9574
Unanswered
DesignyourCode
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi! I have converted this into a discussion, as this is essentially not an issue with payload - most of the API usage is incorrect. E.g. your client feature looks like this: import { createClientFeature } from '@payloadcms/richtext-lexical'
import { RedactedNode, $createRedactedNode, $isRedactedNode } from './nodes/RedactedNode'
export const RedactedFeatureClient = createClientFeature({
key: 'redacted',
feature: {
nodes: [RedactedNode],
commands: {
INSERT_REDACTED_COMMAND: () => $createRedactedNode(),
},
toolbar: {
icon: '🔒',
command: 'INSERT_REDACTED_COMMAND',
},
floatingToolbar: {
icon: '🔒',
command: 'INSERT_REDACTED_COMMAND',
},
slashCommand: {
label: 'Redacted',
command: 'INSERT_REDACTED_COMMAND',
},
},
}) However, most properties here are not real. For example, If I distill the feature down to properties that exist, it would look like that: import { createClientFeature } from '@payloadcms/richtext-lexical/client'
import { RedactedNode } from './nodes/RedactedNode'
export const RedactedFeatureClient = createClientFeature({
nodes: [RedactedNode],
}) I would recommend waiting for the wrapper block PR (#9289) to be merged - that way creating this functionality will be a LOT easier. Should hopefully be done this week |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the Bug
Hi. I am trying to build a custom Lexical feature called Redacted. This should be straight forward as I just want it to essentially wrap the selected content in a span at the moment.
The issue I am encountering from this code:
Link to the code that reproduces this issue
https://github.com/DesignyourCode/redacted-payload-lexical-feature-bug/tree/main
Reproduction Steps
I have created the following repo with the feature I am working. I am working on the website template.
This feature is included in the components/RichText folder and then imported into the content block:
Which area(s) are affected? (Select all that apply)
plugin: richtext-lexical
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions