23367 Posts in 18143 Topics by 2863 members
|Go to End||Next >|
23 January 2012 at 11:16pm
Whilst searching the forum I found a couple of post that said that the wysiwyg editor can be modified to allow all tags. However the posts are quite old and the link they point to is not there any more.
Can anyone tell me how to modify the wysiwig editor to allow all tags?
24 January 2012 at 1:51am
I have been doing some more digging and I think that the wysiwyg editor setting can be modified by putting a
HtmlEditorConfig:: expression in the silverstripe/cms/config.php file.
My problem now is that I cannot figure out what goes after the :: to allow all html tags in the editor.
I have looked at the tnymce web site but cannot work it out from there. I think it is aimed more at professional developers.
Any help gratefully received.
24 January 2012 at 2:01am
There is a sample for "Full XHTML rule set". I gues you could also use * as a wildcard to allow really everything, even invalid markup, but I havn't tried it.
The way you set this for all HTMLEditor Fields with in the cms is by overriding the option in your mysite/_config.php.
You can also define a separate config. For example for special users.
HtmlEditorConfig::get('cms')->setOption('valid_elements', "a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|la.........<and so on>");
SSBits has a nice post about the configuration here.
Hope that helps
24 January 2012 at 8:07am
I have looked through the tintmce wiki and identified the following which are not present in standard Silverstripe configuration
I had already seen the ssbits site and article is interesting but seems to focus on adding functions (buttons) to editor whilst I am looking to expand functionality of html editor.
Re the config.php file: can I just add the list above to the existing HtmlEditorConfig::get('cms') statement in silverstripe/cms/config.php or should I add a HtmlEditorConfig::get('cms') statement to silverstripe/mysite/config.php ?
24 January 2012 at 10:06am
you should always, if possible, use the mysite/_config.php that way your changes don't get lost in case of a silverstripe update.
The SSbits article does not talk about valid_elements but I thought it might give you an idea on how to set options.
If you use a HtmlEditorConfig::get('cms')->setOption('valid_elements', .... statement in your mysite/_config.php it will overwrite the settings from cms/_config.php. So you need to specify all tags again, not just add yours!
25 January 2012 at 2:57am
Many thanks Johannes
I copied HtmlEditorConfig from cms/_config.php and pasted it into mysite/_config.php, then added the additional attributes I wanted and its working just fine.
25 January 2012 at 2:32pm Last edited: 25 January 2012 2:32pm
Sorry but I have hit a problem again.
I copied the HtmlEditorConfig:: code in the silverstripe/cms/config.php file and pasted it into the mysite/_config.php file
I the amended the HtmlEditorConfig:: in mysite/_config.php as follows
I have checked to make sure that there are no duplications inside [ ] of each element.
If I put the following code
<form action="url" method="get">
<input name="type" type="hidden" value="home" />
into the html editor and then press insert, it puts the "Show me" on the page and the dropdown box but no options to pick from. If I go back and look at page in the html editor I find that wysiwyg has dropped the <option value= element and it now looks like this.
<form> <input name="type" type="hidden" value="home" />
<p>Show me <select name="gender"> red blue </select></p>
I have been through the http://www.tinymce.com/wiki.php/Configuration:valid_elements but cannot identify any other elements that I need to add or amend.
Am I missing something obvious or have I done something wrong?
most of it seems to work
25 January 2012 at 10:28pm
Problem solved. I had a Homer Simpson moment. I forgot to flush the cache. "Dohhhhh"
|Go to Top||Next >|