Skip to content

Commit

Permalink
fix(hyperlink): fix bug of regex test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbobell committed Feb 3, 2017
1 parent 957801f commit db3b297
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/dialog/hyperlink/hyperlink.ctrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
angular.module('kityminderEditor')
.controller('hyperlink.ctrl', function ($scope, $modalInstance, link) {

$scope.R_URL = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
var urlRegex = '^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$';
$scope.R_URL = new RegExp(urlRegex, 'i');

$scope.url = link.url || '';
$scope.title = link.title || '';
Expand Down

0 comments on commit db3b297

Please sign in to comment.