This macro works perfectly on a template, however, whenever I try to insert "html" into the textstring property of the macro, I receive an error when saving the page node. This isn't the first time I've had issues inserting html into a macro in TinyMCE and received an error. The html I was inserting was a very simple <a href>
Error 1:
All my content disappears and it is replace with: [tidy error]
Error 2:
Server Error in '/' Application.
Length cannot be less than zero. Parameter name: length
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
I've been doing the same trick several times without encoutering this issue...not that I think this matters but out of curiosity what version of Umbraco do you experience this on?
I tried this and found that the problem seems to happen when htmlCode contains reserved html characters (e.g. htmlCode is '[%%stringvalue%%]'). As a workaround you can try to enter this directly into the html code of your TinyMCI code in such format:
I fixed this by making some changes to the /umbraco_client/tiny_mce3/tiny_mce_src.js file. I posted the updated file on my website and you can download it here: http://www.tadasolutions.com/downloads/tiny_mce_src.js.
Let me know if this solves your issue -- it worked wonderfully for me.
Inserting html into TinyMCE with a macro not working.
I recently created a macro that allows users to pull the value of a query key into the TinyMCE content. There are two properties on the macro.
Code:
This macro works perfectly on a template, however, whenever I try to insert "html" into the textstring property of the macro, I receive an error when saving the page node. This isn't the first time I've had issues inserting html into a macro in TinyMCE and received an error. The html I was inserting was a very simple <a href>
Error 1:
All my content disappears and it is replace with: [tidy error]
Error 2:
Has anybody else had troubles with this? It doesn't seem to matter if I use ascii codes for the html and/or if I use single quotes vs. double quotes.
Any thoughts?
Thanks!
Hi Kaifish
I've been doing the same trick several times without encoutering this issue...not that I think this matters but out of curiosity what version of Umbraco do you experience this on?
/Jan
I've experienced it on multiple installations. It seems to be an issue on all 4.5+ versions.
Did you ever find a solution for this issue? I'm experiencing the same issue on a 4.7 install.
I tried this and found that the problem seems to happen when htmlCode contains reserved html characters (e.g. htmlCode is '[%%stringvalue%%]'). As a workaround you can try to enter this directly into the html code of your TinyMCI code in such format:
umb_htmlcode="&lt;span&gt;[%%stringvalue%%]&lt;/span&gt;"
And add decoding to your xslt, e.g.:
<msxml:script language="C#" implements-prefix="scripts">
<msxml:assembly name="System.Web" />
public static string HtmlDecode(string html) {
return System.Web.HttpUtility.HtmlDecode(html);
}
msxml:script>
...
<xsl:value-of select="scripts:HtmlDecode($formattedCode)" disable-output-escaping="yes"/>
The solution looks quite ugly, but I still couldn't find any other one.
Also, note, that it's important that special characters should be encoded twice, so that e.g. '<' becomes not '<' but '&lt;' and like that.
Thanks for the suggestion. I found the same to be true, however, I can't trust my end users to correctly encode the html.
You can find issue and solution here:
http://umbraco.codeplex.com/workitem/30620
How do i apply this fix? I'm not sure which file i need to modify?
Can someone help?
Thanks
Chris
I fixed this by making some changes to the /umbraco_client/tiny_mce3/tiny_mce_src.js file. I posted the updated file on my website and you can download it here: http://www.tadasolutions.com/downloads/tiny_mce_src.js.
Let me know if this solves your issue -- it worked wonderfully for me.
is working on a reply...