fetch anchors for existing links

This commit is contained in:
Nathan Woulfe
2018-06-17 19:46:07 +10:00
parent ef580558b1
commit 9f90c99350
2 changed files with 10 additions and 8 deletions

View File

@@ -34,8 +34,10 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController",
});
}
contentResource.getNiceUrl(id).then(function (url) {
$scope.target.url = url;
// 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];
});
}
}

View File

@@ -42,14 +42,14 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
$scope.dialogTreeEventHandler.syncTree({ path: $scope.model.target.path, tree: "content" });
});
}
contentResource.getNiceUrl(id).then(function (url) {
$scope.model.target.url = url;
// 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];
});
}
}
if (dialogOptions.anchors) {
} else if (dialogOptions.anchors) {
$scope.anchorValues = dialogOptions.anchors;
}