I'm running 4.6 and just starting to post a few blogs. Some of them contain code examples and I'd like to embed these into the rich text editor in TinyMCE.
Thus far I am unable to find a walk through on this. Can anyone point me in the direction of an example?
This is pretty standard functionality so I'm surprised I am unable to find anything concrete.
You can't do this with the default configuration of TinyMce. I guess you could try to disable tidy in the umbracoSetting.config file.
There are some downsides to this though. For instance all kind of bad markup is allowed in there without being stripped.
Something in the back of my mind tells me that there has been made some clever workaround for this but must admit I can't remember right now.
Another approach could be to make a Codesnippet repository where you create a folder in the content tree at the root level and then create a document type called "Codesnippet" and add a textfield multiple property to it where you can paste the code as you like.
Then you can create a macro based on XSLT for instance and then give it a parameter of contentPicker, which makes it possible for you to select the codesnippet you wish to place in your text through a macro.
I thought I saw a post on this recently but I can't seem to find it.
Another alternative might be to find a TinyMCE plugin that's already created for this and add it to Umbraco. There's a wiki article on how to Add YouTube Button to TinyMCE - the same steps can be used to add any plugin.
I did see one Insert Code plugin that looks promising, RJ_InsertCode. The only thing is it requires PHP which I don't have on my dev machine so I'm not able to fully test at the moment, but it looks like it would work. If you do end up trying, one thing I ran into is you need to copy/rename editor_plugin.js to editor_plugin_src.js
Embedding code in TinyMCE
Hi,
I'm running 4.6 and just starting to post a few blogs. Some of them contain code examples and I'd like to embed these into the rich text editor in TinyMCE.
Thus far I am unable to find a walk through on this. Can anyone point me in the direction of an example?
This is pretty standard functionality so I'm surprised I am unable to find anything concrete.
Thanks.
Hi Greyhound
You can't do this with the default configuration of TinyMce. I guess you could try to disable tidy in the umbracoSetting.config file.
There are some downsides to this though. For instance all kind of bad markup is allowed in there without being stripped.
Something in the back of my mind tells me that there has been made some clever workaround for this but must admit I can't remember right now.
Another approach could be to make a Codesnippet repository where you create a folder in the content tree at the root level and then create a document type called "Codesnippet" and add a textfield multiple property to it where you can paste the code as you like.
Then you can create a macro based on XSLT for instance and then give it a parameter of contentPicker, which makes it possible for you to select the codesnippet you wish to place in your text through a macro.
Does this make sense?
/Jan
Hi Jan,
Thank you kindly for the information.
The approach you suggest does make sense, its not ideal from an end user perspective but as its for my own site I can cope with that!
Thanks again.
Hi,
I thought I saw a post on this recently but I can't seem to find it.
Another alternative might be to find a TinyMCE plugin that's already created for this and add it to Umbraco. There's a wiki article on how to Add YouTube Button to TinyMCE - the same steps can be used to add any plugin.
I did see one Insert Code plugin that looks promising, RJ_InsertCode. The only thing is it requires PHP which I don't have on my dev machine so I'm not able to fully test at the moment, but it looks like it would work. If you do end up trying, one thing I ran into is you need to copy/rename editor_plugin.js to editor_plugin_src.js
Hope this might help,
Tom
is working on a reply...