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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow URLs with custom protocols to be linkable using Link plugin #14304

Closed
mikkicom opened this issue May 31, 2023 · 5 comments 路 Fixed by #15819
Closed

Allow URLs with custom protocols to be linkable using Link plugin #14304

mikkicom opened this issue May 31, 2023 · 5 comments 路 Fixed by #15819
Assignees
Labels
domain:integration-dx This issue reports a problem with the developer experience when integrating CKEditor into a system. intro Good first ticket. package:link squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@mikkicom
Copy link

mikkicom commented May 31, 2023

馃摑 Provide a description of the improvement

The improvement I'd like to propose is adding the ability to customize which URL protocols the Link plugin considers safe so that URLs using them are properly linked in the Link Balloon and take the user to the intended destination upon clicking.

How the feature works now and what you'd like to change?

Currently, the Link Balloon relies a SAFE_URL regex to determine if a link, upon click, should take the user to the set URL, or to #

const SAFE_URL = /^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;

Because the list of "safe" protocols are baked into the SAFE_URL regex, URLs using uncommon protocols such as tel, cannot be linked.

In order to address this, there could be an option added to the link configuration that might look something like this:

<CKEditor
  config={{
    link: {
      safeUrlProtocols: 'https?|ftps?|mailto|tel' // or alternatively ['http', 'ftp', 'mailto', 'tel']
    }
  }}
/>

With this approach, the regex currently used to determine if a URL is safe might be replaced with a function that receives safeUrlProtocols to dynamically build and return a regex.

馃搩 Other details

  • Browser: All
  • OS: All
  • CKEditor version: All
  • Installed CKEditor plugins: Link, AutoLink

If you'd like to see this improvement implemented, add a 馃憤 reaction to this post.

@mikkicom mikkicom added the type:improvement This issue reports a possible enhancement of an existing feature. label May 31, 2023
@mikkicom mikkicom changed the title Allow customizable protocols in the Link Balloon Allow custom protocols in Link plugin SAFE_URL regex May 31, 2023
@Witoso Witoso added package:link squad:core Issue to be handled by the Core team. domain:integration-dx This issue reports a problem with the developer experience when integrating CKEditor into a system. labels Jun 1, 2023
@Witoso
Copy link
Member

Witoso commented Jun 1, 2023

Thanks for the detailed request, we will gather the interest for it.

@Witoso Witoso added the intro Good first ticket. label Jun 1, 2023
@mikkicom mikkicom changed the title Allow custom protocols in Link plugin SAFE_URL regex Allow URLs with custom protocols to be linkable using Link plugin Jun 1, 2023
@martynawierzbicka martynawierzbicka added the support:2 An issue reported by a commercially licensed client. label Jun 2, 2023
@Witoso
Copy link
Member

Witoso commented Jun 30, 2023

Another case that could be added, mentioned in #11855, is sms.

@Witoso
Copy link
Member

Witoso commented Sep 28, 2023

+13 馃憤 for tel: #1019.

@Witoso
Copy link
Member

Witoso commented Nov 14, 2023

+43 馃憤 from #8248

@arglgruml
Copy link

+1
AFAIU ckeditor is used in OpenProject. We need to link to different internal applications. These use custom URL schemes.

https://community.openproject.org/projects/openproject/work_packages/52674/activity

DawidKossowski pushed a commit that referenced this issue Feb 27, 2024
Feature (link): Added the ability to specify allowed URL protocols by introducing the `link.allowedProtocols` configuration property. Closes #14304.
@DawidKossowski DawidKossowski added squad:collaboration Issue to be handled by the Collaboration team. and removed squad:core Issue to be handled by the Core team. labels Feb 27, 2024
@CKEditorBot CKEditorBot added this to the iteration 72 milestone Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:integration-dx This issue reports a problem with the developer experience when integrating CKEditor into a system. intro Good first ticket. package:link squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants