Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change default linkType to internal in Lexical #10444

Closed
cbratschi opened this issue Jan 8, 2025 · 2 comments · Fixed by #10498
Closed

Cannot change default linkType to internal in Lexical #10444

cbratschi opened this issue Jan 8, 2025 · 2 comments · Fixed by #10498
Assignees
Labels
plugin: richtext-lexical @payloadcms/richtext-lexical

Comments

@cbratschi
Copy link

Describe the Bug

I tried this code to modify the order of the radio buttons and to set the default linkType to 'internal':

                            const fields = defaultFields.map(field => {
                                //modify link type
                                if (field.name === 'linkType') {
                                    const radio = field as RadioField;

                                    return <RadioField>{
                                        ...radio,

                                        //use internal by default
                                        defaultValue: 'internal',

                                        //change order
                                        options: [
                                            radio.options[1],
                                            radio.options[0]
                                        ]
                                    };
                                }

                                return field as Field;
                            });

However, Payload always uses 'custom' as default value:

https://github.com/payloadcms/payload/blob/main/packages/richtext-lexical/src/features/link/markdownTransformer.ts#L39

Most of our links are internal and it would be much better to start with an internal link.

Link to the code that reproduces this issue

https://github.com/cbratschi/payload

Reproduction Steps

See above.

Which area(s) are affected? (Select all that apply)

plugin: richtext-lexical

Environment Info

Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.13.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16
@cbratschi cbratschi added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 8, 2025
@AlessioGr AlessioGr self-assigned this Jan 10, 2025
@AlessioGr AlessioGr added status: verified If an issue has been reproduced plugin: richtext-lexical @payloadcms/richtext-lexical labels Jan 10, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 10, 2025
AlessioGr added a commit that referenced this issue Jan 10, 2025
@github-actions github-actions bot removed the status: verified If an issue has been reproduced label Jan 10, 2025
Copy link
Contributor

🚀 This is included in version v3.16.0

Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: richtext-lexical @payloadcms/richtext-lexical
Projects
None yet
2 participants