21294 Posts in 5734 Topics by 2602 members
| Go to End | Next > | |
| Author | Topic: | 1424 Views |
-
Can wysiwyg editor be modified to allow all tags?

23 January 2012 at 11:16pm
Hi everyone
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?
-
Re: Can wysiwyg editor be modified 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.
-
Re: Can wysiwyg editor be modified to allow all tags?

24 January 2012 at 2:01am
Hi,
http://www.tinymce.com/wiki.php/Configuration:valid_elements
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
Johannes
-
Re: Can wysiwyg editor be modified to allow all tags?

24 January 2012 at 8:07am
Thanks Johannes
I have looked through the tintmce wiki and identified the following which are not present in standard Silverstripe configuration
form[action|accept|accept-charset|enctype|method],
option[disabled|label|selected|value],
script[src|type],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 ?
Paul
-
Re: Can wysiwyg editor be modified to allow all tags?

24 January 2012 at 10:06am
Hi,
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!
Johannes
-
Re: Can wysiwyg editor be modified to allow all tags?

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.
Paul
-
Re: Can wysiwyg editor be modified to allow all tags?

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
form[action|accept|accept-charset|enctype|method],
option[disabled|label|selected|value],
script[src|type],
select[disabled|multiple|name|size],
input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type<button?checkbox?file?hidden?image?password?radi
o?reset?submit?text|value],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" />
<p>Show me
<select name="colour">
<option value="Red">Red</option>
<option value="Blue">Blue</option>
</select></p>
</form>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>
</form>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?
Paul
most of it seems to work
-
Re: Can wysiwyg editor be modified to allow all tags?

25 January 2012 at 10:28pm
Problem solved. I had a Homer Simpson moment. I forgot to flush the cache. "Dohhhhh"
| 1424 Views | ||
| Go to Top | Next > |

