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

Add a title to the link node to support titles in markdown #4161

Merged
merged 4 commits into from
Mar 27, 2023

Conversation

themagickoala
Copy link
Contributor

@themagickoala themagickoala commented Mar 20, 2023

We have a use case for supporting titles in link markdown nodes (see markdown spec). We're currently copying source code and modifying it inside our own project, but that's not really sustainable so here's a PR to add it to Lexical.

Note that this doesn't add support for adding the title via the WYSIWYG editor, but it will support adding it in Markdown and then converting back to rich text.

@facebook-github-bot
Copy link
Contributor

Hi @themagickoala!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vercel
Copy link

vercel bot commented Mar 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
lexical ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 22, 2023 at 9:30AM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 22, 2023 at 9:30AM (UTC)

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Copy link
Member

@zurfyx zurfyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! cc @fantactuka if you want to double check the MD stuff

Comment on lines +613 to +614
// TODO Fix nullish on LinkNode
if (str != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this right, it's guaranteed to be null or string no? So we can do !== null instead and drop the TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but this was a copy and paste of target/rel versions, which are also string | null.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this - we can fix it now or we can merge this and fix them all in a separate PR -all good either way for me.

importRegExp: /(?:\[([^[]+)\])(?:\(([^()]+)\))/,
regExp: /(?:\[([^[]+)\])(?:\(([^()]+)\))$/,
importRegExp: /(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"([^"]+)"\s*)?)\))/,
regExp: /(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"([^"]+)"\s*)?)\))$/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance to check if " was escaped in title?

[Text](https://test.com "Title \" with escaped quote")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I'll try and add a test case for that too, and fix the other unit test that's broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, those should both be sorted now.

@themagickoala
Copy link
Contributor Author

@zurfyx can this be merged now?

@themagickoala
Copy link
Contributor Author

@fantactuka @zurfyx I've rebased this to fix the conflict created by my other PR (#4168) so it should be good to merge now I think.

@zurfyx
Copy link
Member

zurfyx commented Mar 27, 2023

Thank you! Sorry for the delay

@zurfyx zurfyx merged commit 2fb4d5a into facebook:main Mar 27, 2023
@acywatson acywatson mentioned this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants