my problem is that every time i want to insert a code snippet into Ritch TextEditor data type, i have to edit the html and insert manually the <pre> tag, handling also the html encoding.
It would be greate to have a macro that handles the this for me every time i want to use Prettify4Umbraco. I have started building the macro by myself but i have encurred into a problem posted here
Without the ability to handle breaklines and quotes into macros, i cannot integrate the Prettify4Umbraco. or maybe i'm doing something wrong.
Can you please help, providing me any good hint? it would be great to heve this feature into this package. I would be happy to share the macro once is done.
What you need is a style like: Name: pre Alias:pre
Then you can use this style in TinyMCE. Just select the text, and start typing in your code. Like you, I sometimes also need to use the html view to get the whitespace right if I copy paste some code, but mostly it works just fine.
Hello Morten! Thank you very much for your tip. It's definitely a better solution than the one i was trying to implement. Thank you.
I got just one problem: everytime i press the save or save and publish button, all the text inside the <pre> tags gets additional <br /> for every breakline.
example: if I write into the RTE :
<p>this is a normal text</p> <pre>string a ="sample code";<br /></pre> <p>this is a normale text</p>
and press the save button, the text becomes:
<p>this is a normal text</p> <pre>string a ="sample code";<br /><br /></pre> <p>this is a normale text</p>
if i press it again, it becomes:
<p>this is a normal text</p> <pre>string a ="sample code";<br /><br /><br /><br /></pre> <p>this is a normale text</p>
Can you please help me again? thank you very much.
macro for Prettify4Umbraco.
Hello and thanks fot this package.
my problem is that every time i want to insert a code snippet into Ritch TextEditor data type, i have to edit the html and insert manually the <pre> tag, handling also the html encoding.
It would be greate to have a macro that handles the this for me every time i want to use Prettify4Umbraco.
I have started building the macro by myself but i have encurred into a problem posted here
Without the ability to handle breaklines and quotes into macros, i cannot integrate the Prettify4Umbraco.
or maybe i'm doing something wrong.
Can you please help, providing me any good hint? it would be great to heve this feature into this package. I would be happy to share the macro once is done.
Thank you.
Hi myro.
There should be no need for a macro. What I have done is just add a style to the style dropdown. Follow the guide here:
http://our.umbraco.org/wiki/how-tos/customizing-the-wysiwyg-rich-text-editor-(tinymce)/add-styles-to-the-drop-down-menu-for-editors-to-use
What you need is a style like:
Name: pre
Alias:pre
Then you can use this style in TinyMCE. Just select the text, and start typing in your code. Like you, I sometimes also need to use the html view to get the whitespace right if I copy paste some code, but mostly it works just fine.
Hello Morten!
Thank you very much for your tip. It's definitely a better solution than the one i was trying to implement. Thank you.
I got just one problem:
everytime i press the save or save and publish button, all the text inside the <pre> tags gets additional <br /> for every breakline.
example:
if I write into the RTE :
<p>this is a normal text</p>
<pre>string a ="sample code";<br /></pre>
<p>this is a normale text</p>
and press the save button, the text becomes:
<p>this is a normal text</p>
<pre>string a ="sample code";<br /><br /></pre>
<p>this is a normale text</p>
if i press it again, it becomes:
<p>this is a normal text</p>
<pre>string a ="sample code";<br /><br /><br /><br /></pre>
<p>this is a normale text</p>
Can you please help me again?
thank you very much.
Hi Myro
It should not be necessary with the <br/> in the first place. I write my code like this:
I don't know then....
Even I paste your sample code from the RTE's HTML, and then i press twice time the button publish, the RTE's HTML becomes:
<p>blah</p>
<pre>public void test()<br /><br />{<br /><br /> string blah = "blah";<br /><br />}<br /><br /></pre>
<p>blah</p>
I'm using: umbraco v 4.0.3 (Assembly version: 1.0.3625.27276)
can you please post me your umbraco's version?
I can see that I am actually using umbraco v 4.0.2.1 (Assembly version: 1.0.3441.17657)
I don't know if that makes any difference in this matter.
I see that this problem happens mostly when using the RTE in FireFox. Looks like a TinyMCE browser's compatibility problem.
I' ve found this fix: http://sourceforge.net/tracker/index.php?func=detail&aid=2671750&group_id=103281&atid=738747
I will try to implement that plug in into umbraco, and I if it works i will post here the solution.
Thank you again for you time.
@myro (and anyone who has this problem)...
The multiple line-break issue seems to be caused by tidy in the Umbraco Settings - So set tidy to false ie:
Hope this helps ;)
J
is working on a reply...