Merge branch 'rasmusjp-fix/linkpicker-url-empty' into dev-v7
This commit is contained in:
@@ -40,11 +40,18 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
|
||||
// if a link exists, get the properties to build the anchor name list
|
||||
contentResource.getById(id).then(function (resp) {
|
||||
$scope.anchorValues = tinyMceService.getAnchorNames(JSON.stringify(resp.properties));
|
||||
$scope.model.target.url = resp.urls[0];
|
||||
$scope.target.url = resp.urls[0];
|
||||
});
|
||||
} else if ($scope.target.url.length) {
|
||||
// a url but no id/udi indicates an external link - trim the url to remove the anchor/qs
|
||||
$scope.target.url = $scope.model.url.substring(0, $scope.model.url.search(/(#|\?)/));
|
||||
// a url but no id/udi indicates an external link - trim the url to remove the anchor/qs
|
||||
// only do the substring if there's a # or a ?
|
||||
var indexOfAnchor = $scope.target.url.search(/(#|\?)/);
|
||||
if (indexOfAnchor > -1) {
|
||||
// populate the anchor
|
||||
$scope.target.anchor = $scope.target.url.substring(indexOfAnchor);
|
||||
// then rewrite the model and populate the link
|
||||
$scope.target.url = $scope.target.url.substring(0, indexOfAnchor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +88,7 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
|
||||
} else {
|
||||
contentResource.getById(args.node.id).then(function (resp) {
|
||||
$scope.anchorValues = tinyMceService.getAnchorNames(JSON.stringify(resp.properties));
|
||||
$scope.model.target.url = resp.urls[0];
|
||||
$scope.target.url = resp.urls[0];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
|
||||
function ($scope, eventsService, dialogService, entityResource, contentResource, mediaHelper, userService, localizationService, tinyMceService) {
|
||||
var dialogOptions = $scope.model;
|
||||
|
||||
var anchorPattern = /<a id=\\"(.*?)\\">/gi;
|
||||
|
||||
var searchText = "Search...";
|
||||
localizationService.localize("general_search").then(function (value) {
|
||||
searchText = value + "...";
|
||||
@@ -52,8 +50,15 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
|
||||
$scope.model.target.url = resp.urls[0];
|
||||
});
|
||||
} else if ($scope.model.target.url.length) {
|
||||
// a url but no id/udi indicates an external link - trim the url to remove the anchor/qs
|
||||
$scope.model.target.url = $scope.model.target.url.substring(0, $scope.model.target.url.search(/(#|\?)/));
|
||||
// a url but no id/udi indicates an external link - trim the url to remove the anchor/qs
|
||||
// only do the substring if there's a # or a ?
|
||||
var indexOfAnchor = $scope.model.target.url.search(/(#|\?)/);
|
||||
if (indexOfAnchor > -1) {
|
||||
// populate the anchor
|
||||
$scope.model.target.anchor = $scope.model.target.url.substring(indexOfAnchor);
|
||||
// then rewrite the model and populate the link
|
||||
$scope.model.target.url = $scope.model.target.url.substring(0, indexOfAnchor);
|
||||
}
|
||||
}
|
||||
} else if (dialogOptions.anchors) {
|
||||
$scope.anchorValues = dialogOptions.anchors;
|
||||
|
||||
Reference in New Issue
Block a user