Fix linkpicker overlay issues - manual merge of #3718 to V8
This commit is contained in:
committed by
Sebastiaan Janssen
parent
367fceb3cb
commit
2ac175135a
@@ -56,26 +56,28 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
};
|
||||
|
||||
if (dialogOptions.currentTarget) {
|
||||
$scope.model.target = dialogOptions.currentTarget;
|
||||
// clone the current target so we don't accidentally update the caller's model while manipulating $scope.model.target
|
||||
$scope.model.target = angular.copy(dialogOptions.currentTarget);
|
||||
//if we have a node ID, we fetch the current node to build the form data
|
||||
if ($scope.model.target.id || $scope.model.target.udi) {
|
||||
|
||||
//will be either a udi or an int
|
||||
var id = $scope.model.target.udi ? $scope.model.target.udi : $scope.model.target.id;
|
||||
|
||||
if (!$scope.model.target.path) {
|
||||
|
||||
// is it a content link?
|
||||
if (!$scope.model.target.isMedia) {
|
||||
// get the content path
|
||||
entityResource.getPath(id, "Document").then(function (path) {
|
||||
$scope.model.target.path = path;
|
||||
oneTimeTreeSync.sync();
|
||||
});
|
||||
}
|
||||
|
||||
// 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];
|
||||
});
|
||||
// get the content 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];
|
||||
});
|
||||
}
|
||||
} 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
|
||||
// only do the substring if there's a # or a ?
|
||||
@@ -150,6 +152,12 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
$scope.model.target.url = mediaHelper.resolveFile(media);
|
||||
|
||||
editorService.close();
|
||||
|
||||
// make sure the content tree has nothing highlighted
|
||||
$scope.dialogTreeApi.syncTree({
|
||||
path: "-1",
|
||||
tree: "content"
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
editorService.close();
|
||||
|
||||
Reference in New Issue
Block a user