Bjarke Berg
2019-06-25 13:18:15 +02:00
parent 1994194656
commit 9f45d41a4a
3 changed files with 14 additions and 9 deletions

View File

@@ -187,8 +187,10 @@ function entityResource($q, $http, umbRequestHelper) {
$http.post(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetAnchors",
{ rteContent: rteContent })),
'GetAnchors'),
{
rteContent: rteContent
}),
'Failed to anchors data for rte content ' + rteContent);
},

View File

@@ -12,7 +12,7 @@
function openLinkPicker(editor, currentTarget, anchorElement) {
entityResource.getAnchors($scope.model.value).then(function(anchorValues) {
entityResource.getAnchors(JSON.stringify($scope.model.value)).then(function(anchorValues) {
vm.linkPickerOverlay = {
view: "linkpicker",
currentTarget: currentTarget,

View File

@@ -276,20 +276,23 @@ namespace Umbraco.Web.Editors
[HttpGet]
public UrlAndAnchors GetUrlAndAnchors(int id)
public UrlAndAnchors GetUrlAndAnchors([FromUri]int id)
{
var x = GetResultForId(id, UmbracoEntityTypes.Document);
var url = Umbraco.Url(id);
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEs(id);
return new UrlAndAnchors(url, anchorValues);
}
[HttpPost]
public IEnumerable<string> GetAnchors(string rteContent)
public class AnchorsModel
{
public string RteContent { get; set; }
}
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEContent(rteContent);
[HttpGet]
[HttpPost]
public IEnumerable<string> GetAnchors(AnchorsModel model)
{
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEContent(model.RteContent);
return anchorValues;
}