Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joshua Brown 13 posts 93 karma points
    Sep 14, 2015 @ 18:21
    Joshua Brown
    0

    Macro rendering error in Rich Text Editor - GetMacroResultAsHtmlForEditor

    I created a new data type to use as a parameter in my macro. It is a Rich Text Editor data type, so I can have text with a link in it. Here are my files:

    Text Editor HTML

    <div ng-controller="Macro.texteditor">
        <ng-form>
            <umb-editor model="textInput"></umb-editor>
        </ng-form>
    </div>
    

    Text Editor Controller

    angular.module("umbraco")
    .controller("Macro.texteditor",
    function ($scope) {
    $scope.textInput = {
        label: 'bodyText',
        description: 'Load some stuff here',
        view: 'rte',
        value: $scope.model.value,
        config: {
            editor: {
                toolbar: ["bold", "italic", "link"],
                stylesheets: ["Editor"],
                dimensions: { height: 400 }
            }
        }
    };
    $scope.$watch('textInput.value', function (newValue, oldValue) {
        $scope.model.value = newValue;
    });
    });
    

    Package Manifest

    {
    propertyEditors: [{
    alias: "TexteditorDataType",
    name: "Text Editor",
    isParameterEditor: true,
    editor: {
    view: "~/App_Plugins/MacroDataTypes/texteditor.html"
    }
    }],
    javascript: [
    "~/App_Plugins/MacroDataTypes/texteditor.controller.js"
    ]
    }
    

    Macro Partial (abridged

    @{
        var div1Body = Model.MacroParameters["paragraph1"].ToString();
    }
    <div class="feature-body">
        @Html.Raw(div1Body)
    </div>
    

    When I add this macro to a page using the Rich Text Editor, I get the following error message:

    Request error: The URL returned a 404 (not found): /umbraco/backoffice/UmbracoApi/Macro/GetMacroResultAsHtmlForEditor

    The error seems to be related to putting a link in the RTE provided by the macro. If I remove the link, the macro renders correctly in the page RTE.

    It still saves correctly and renders in the browser, but I'd like to eliminate the error in the back end if possible. I don't want my client to see error messages that might confuse him.

  • Joshua Brown 13 posts 93 karma points
    Sep 14, 2015 @ 19:20
    Joshua Brown
    0

    Looks like I spoke too soon when I said it renders correctly in the browser. The link I added to the text in the macro RTE is being returned as this:

    {localLink:1169}
    

    Is there a different way I should be getting the input from the macro RTE than @Html.Raw() that will cause the link URL to render correctly?

    EDIT: I fixed this issue by using @Html.Raw(umbraco.template.ParseInternalLinks(div1Body)). But the rendering issue in the content RTE is still happening.

  • Matthew Kirschner 323 posts 611 karma points
    Mar 16, 2016 @ 18:39
    Matthew Kirschner
    0

    I've getting this error with all my macros for that past several months, even after updating to 7.4.1.

    Is anyone else getting this? Again, it only happens in the backoffice RTE, not on the front-end.

  • Matthew Kirschner 323 posts 611 karma points
    Apr 05, 2016 @ 15:03
    Matthew Kirschner
    0

    Figured it out:

    I had a redirect for all requests to html file paths on the frontend. This redirect was not selective enough and was also intercepting backoffice requests. Updating this redirect solved the problem.

Please Sign in or register to post replies

Write your reply to:

Draft