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
Auto link feature #303
Labels
Type: Feature
The issue or pullrequest is a new feature
Comments
Interested ! |
I think this might be what you need (or at least close): inputRules ({ type }) {
return [
markInputRule(
/(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*))\s$/g,
type,
matches => {
return { href: matches[1] }
}
),
]
} |
I got this error
|
Here is the full code of our plugin: import { markInputRule } from 'tiptap-commands'
import { Link } from 'tiptap-extensions'
/**
* Plugin for the tiptap editor that sets link targets as blank and allows
* to manually enter URLs as text.
*
* @see https://github.com/heyscrumpy/tiptap/blob/master/packages/tiptap-extensions/src/marks/Link.js
*/
export default class BlankAutoLink extends Link {
get schema () {
return {
...super.schema,
toDOM: node => ['a', {
...node.attrs,
rel: 'noopener noreferrer nofollow',
target: '_blank',
}, 0],
}
}
inputRules ({ type }) {
return [
markInputRule(
/(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*))\s$/g,
type,
matches => {
return { href: matches[1] }
}
),
]
}
} |
Hi @clemishow Got same issue here. |
A solution seems to be here: #337 (comment) ✌️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I cannot reproduce this behaviour with my code. It always create a new block.
Can someone help me ?
The text was updated successfully, but these errors were encountered: