Umbraco appends an extra newline character on macro parameters
Hi,
I have encountered at rather annoying problem with the rendering of a .Net user-control hosted inside an umbraco page (as a macro).
When I render my user-control on a vanilla .aspx page it works fine.
When I render the same user-control via a macro on a umbraco page the rendered html and javascript is not the same and I get javascript errors because the parameters passed by umbraco now contains a newline character at the end, thus breaking my javascript string literals.
The user-control is inserted and configured via the rich-text editor.
I can probably make a work-around by trimming all macro values, but it would be nice if umbraco did not append the extra newline character.
Is this a known issue and are there other workarounds?
If someone knows where in the source code it might happen I will take a look at it and try to come up with a patch.
I have found it successful to set the use of Tidy in umbracoSettings.config to false.
<!-- clean editor content with use of tidy --> <TidyEditorContent>False</TidyEditorContent>
This removes the offending /r/n characters from macro parameters.
BEWARE: Removing TIDY from RTE makes it
possible for editor to place all kinds of weird and outdated HTML
elements in the RTE field, which could also be invalid and therefore in
worst case break a page layout.
I guess though it is a solution, many do come with knock on effects... Use with caution.
Umbraco appends an extra newline character on macro parameters
Hi,
I have encountered at rather annoying problem with the rendering of a .Net user-control hosted inside an umbraco page (as a macro).
When I render my user-control on a vanilla .aspx page it works fine.
When I render the same user-control via a macro on a umbraco page the rendered html and javascript is not the same and I get javascript errors because the parameters passed by umbraco now contains a newline character at the end, thus breaking my javascript string literals.
The user-control is inserted and configured via the rich-text editor.
I can probably make a work-around by trimming all macro values, but it would be nice if umbraco did not append the extra newline character.
Is this a known issue and are there other workarounds?
If someone knows where in the source code it might happen I will take a look at it and try to come up with a patch.
Cheers,
Nis
Aargg ... it is not umbraco playing tricks on me, but rather the richtext editor.
Viewing the html inside the richtext editor reveals a number of \r\n characters inserted inside the macro parameter values.
Removing them and saving just re-inserts them.
I guess the richtext editor is not always the best way to "host" your macros.
Again, does anybody have a good work-around for this issue?
Cheers,
Nis
Hi Nils,
I just encountered the same problem and it seems we are not alone: http://our.umbraco.org/forum/developers/xslt/3240-dreaded-rn-has-re-appeared?p=3
I managed with a replace, as a workaround:
Hey all...
I have found it successful to set the use of Tidy in umbracoSettings.config to false.
This removes the offending /r/n characters from macro parameters.
BEWARE: Removing TIDY from RTE makes it possible for editor to place all kinds of weird and outdated HTML elements in the RTE field, which could also be invalid and therefore in worst case break a page layout.
I guess though it is a solution, many do come with knock on effects... Use with caution.
Cheers
Josh
is working on a reply...