Handle inputRules on Enter #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "castroCrea/patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm creating an inputRule for links
const inputRegexExact = /(https?:\/\/[\w\d./?=#]+)[\s\n]$/;that will create my link at the end of a line when the user hit enter. I didn't reach it but it will be perfect that the Enter trigger the inputRules and go to the line but only for markshttps://user-images.githubusercontent.com/20707343/128224623-c794fe97-8cc5-404e-a677-c096e30dcff9.mov
It work for Heading and block to
https://user-images.githubusercontent.com/20707343/128225481-37324416-6cb3-4636-902a-81d9fc1c4558.mov
I don't like how this blurs the meaning of the matched strings (that
"\n"isn't actually in the document), and it seems like this would be really hard to use correctly, since you have to somehow duplicate all the complexities of the enter key's effect inside your input rule handler, alongside the text-changing effect it has.A better approach might be a regular enter key handler that scans for the text itself, creates the link, and then call through to the default enter handlers.
Pull request closed