Quill: Allow relative links

Created on 17 Dec 2015  路  7Comments  路  Source: quilljs/quill

Currently, relative links aren't allowed. Even if a user inputs a relative link, e.g. they do not add the http:// part, the link is forced to include it.

Allowing relative links would be useful, at least on my site.

I suggest that we add some option like 'forceAbsolute'. What do you think?

In the meantime, I've forked the repo and created this commit. I didn't create a pull request yet because I couldn't figure out how to do the CSS. I'm familiar with stylus, but not with your build chain that generates the CSS for dist. Here's the CSS that's needed:

npm: quill/dist/quill.base.css

.ql-link-tooltip div.hint {
  display: none;
}
.ql-link-tooltip.editing div.hint {
  display: block;
  color: silver;
}

Most helpful comment

Relative links are allowed in the 1.0 beta preview, but further customization is also allowed with:

var Link = Quill.import('formats/link');
Link.sanitize = function(url) {
  // change / sanitize url
  return url;
};

All 7 comments

My current thought is just to make the link sanitizer customizable. Other folks want it to recognize mailto addresses, force https, etc so allowing the sanitizer to be overwritten would solve all of this.

+1

+1

@jhchen Are you suggesting you're going to allow a customizable link sanitizer? Or shall I? I'm happy to do it. Do you have any particular direction?

+1

Relative links are allowed in the 1.0 beta preview, but further customization is also allowed with:

var Link = Quill.import('formats/link');
Link.sanitize = function(url) {
  // change / sanitize url
  return url;
};

Piggy-backing on this issue to suggest making the default link handling smarter regarding "likely" relative or non-relative URLs

See #1412 for a suggested heuristic - things starting with ./ or / should be relative, things with no spaces but otherwise following *.* are probably global, etc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Softvision-MariusComan picture Softvision-MariusComan  路  3Comments

aletorrado picture aletorrado  路  3Comments

GildedHonour picture GildedHonour  路  3Comments

Yves-K picture Yves-K  路  3Comments

CHR15- picture CHR15-  路  3Comments