-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Automatically add a protocol to a link #4858
Comments
Hi, thanks for the report. I have talked with @mlewand and we consider it as a valid feature request. Currently, if a user doesn't provide a protocol, he won't be able to visit a link. The question is how it should be implemented? It might be simply configuration option which allows adding a protocol by default if it's not provided. Related - https://github.com/ckeditor/ckeditor5-link/issues/187. |
Correct me if i wrong, now i have ability to add attributes using decorators, provide callback function and check url. Actually, i can change href attribute overwriting it, but i don't have access to url. |
Interesting case, but I think that decorators can't handle this now and I'd like to keep that feature reasonably simple, not to duplicate things that you can do by using converters directly. Because, in fact, link decorators are sugar for converters. There's a new guide (not published yet in the official docs) which you may find interesting. You can start here: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/deep-dive/ui/conversion-introduction.html but the meat is here: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/deep-dive/ui/conversion-extending-output.html#adding-a-css-class-to-certain-inline-elements. It's about adding classes, but you can probably imagine adding the protocols this way too. This will happen on data retrieval only, so it's not perfect, but it's fairly quick. The other option is to use a model postfixer to listen to attribute application in the model and just change the URL. This still isn't perfect, because it happens in a way that isn't transparent to the user, but it'll do the job. |
Things to consider:
|
Feature (link): Introduced the `config.link.defaultProtocol` option for automatically adding it to the links when it's not provided by the user in the link form. Closes #4858.
Is this a bug report or feature request?
🆕 Feature request
The plugin should give an option for adding a protocol to a link automatically if a user doesn't provide it.
If you'd like to see this feature implemented, add 👍 to this post.
The text was updated successfully, but these errors were encountered: