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 ability to validate Link and Embedded url #1378

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maxpeterson
Copy link

Thanks for providing a great library @jpuri

I needed the ability to validate the links so I have created this PR to add config options to validate the urls input for Link and Embedded

  • Add linkValidator config options to provide functions to validate Link target
  • Adds valid/invalid classes to Link modal title and target
  • Disable Add Link button when not target valid
  • Add embedValidator config options to provide functions to validate Embedded url
  • Adds valid/invalid classes to Embedded modal link, width and height
  • Disable Add Embedded button when link not valid

This is partly based on #355, however it does not provide "allowRelative" link functionality nor prepends links with 'https://'. Both should be possible with a combination of the new linkValidator and the existing linkCallback

Possibly related to #483

heightValid,
widthValid,
} = this.state;
console.log('heightValid', heightValid);

Choose a reason for hiding this comment

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

Log should be removed

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 7f61272

@@ -104,6 +104,7 @@ export default "{\n" +
" component: undefined,\n" +
" popupClassName: undefined,\n" +
" embedCallback: undefined,\n" +
" embedValidator: undefined,\n" +

Choose a reason for hiding this comment

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

linkValidator field is missing in this file

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 7f61272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants