Skip to content

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

@mikkicom

Description

@mikkicom

📝 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.

Metadata

Metadata

Assignees

Labels

domain:integration-dxThis issue reports a problem with the developer experience when integrating CKEditor into a system.introGood first ticket.package:linksquad:collaborationIssue to be handled by the Collaboration team.support:2An issue reported by a commercially licensed client.type:improvementThis issue reports a possible enhancement of an existing feature.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions