Skip to content

Commit

Permalink
CHG: 链接支持 mailto 和 tel
Browse files Browse the repository at this point in the history
  • Loading branch information
biallo committed Aug 14, 2018
1 parent 50173c2 commit 6406a90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/simditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4217,7 +4217,7 @@ LinkPopover = (function(superClass) {
return;
}
val = _this.urlEl.val();
if (!(/^(http|https|ftp|ftps|file)?:\/\/|^\//ig.test(val) || !val)) {
if (!(/^(http|https|ftp|ftps|file)?:\/\/|^(mailto|tel)?:|^\//ig.test(val) || !val)) {
val = 'http://' + val;
}
_this.target.attr('href', val);
Expand Down
2 changes: 1 addition & 1 deletion site/assets/scripts/simditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4217,7 +4217,7 @@ LinkPopover = (function(superClass) {
return;
}
val = _this.urlEl.val();
if (!(/^(http|https|ftp|ftps|file)?:\/\/|^\//ig.test(val) || !val)) {
if (!(/^(http|https|ftp|ftps|file)?:\/\/|^(mailto|tel)?:|^\//ig.test(val) || !val)) {
val = 'http://' + val;
}
_this.target.attr('href', val);
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/link.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LinkPopover extends Popover
return if e.which == 13

val = @urlEl.val()
val = 'http://' + val unless /^(http|https|ftp|ftps|file)?:\/\/|^\//ig.test(val) or !val
val = 'http://' + val unless /^(http|https|ftp|ftps|file)?:\/\/|^(mailto|tel)?:|^\//ig.test(val) or !val

@target.attr 'href', val
@editor.inputManager.throttledValueChanged()
Expand Down

0 comments on commit 6406a90

Please sign in to comment.