21310 Posts in 5739 Topics by 2604 members
General Questions
SilverStripe Forums » General Questions » HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 2193 Views |
-
HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

11 June 2010 at 10:58am Last edited: 11 June 2010 11:00am
I am trying to add markup such as <acronym> and <dfn> via the HTML Source Editor. These are valid, standard HTML phrase elements which are very helpful in making your content more meaningful.
Same story with <span> attributes such as "lang": for example, markup such as
<span lang="fr">bonjour</span>
becomes
<span>bonjour</span>
after saving with "Insert"and reopening the text.
In an identical editing sequence things work perfectly with more common tags - <div>s, <p>s etc., which are saved.
Any idea what's happening here ? Is there any good reason why some tags are not allowed by SilverStripe's HTML Source Editor ?
Thanks!
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

11 June 2010 at 12:37pm
Its todo with the configuration of TinyMCE within SS. You can set the elements which you allow. See http://doc.silverstripe.org/htmleditorconfig#customizing_allowed_html
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

11 June 2010 at 9:10pm
Thanks a lot, your prompt reply has been greatly appreciated.
I followed your instructions, everything is OK now. Apologies, I should have checked the documentation in the first place...
If you are the developer and the editor of the site (my case), this limitation might seem a little impractical at first. Once you consider the separation of these two roles, it makes perfect sense.
Thanks again!
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

15 June 2010 at 4:56am Last edited: 17 June 2010 10:46am
I tried to disable the HTML Editor by putting the following code in mysite _config.php:
HtmlEditorConfig::get('cms')->setOption('verify_html', 'false');
But when I input code in the page via the editor, it acts erratically (for identical input the saved output varies during different attempts). In all cases the onsubmit/onreset options of the "<form>" tag get rejected. My code starts with
<form id="contact" method="post" onsubmit="return validateForm()" onreset="clearMessages();" action="/fr/contact">
after saving, it becomes
<form id="contact" method="post" validateForm()" action="/fr/contact">
Prior to attempting to disable HTML Editor I wanted to extend the valid elements by adding the following to the 'valid_elements' array via the HtmlEditorConfig::get('cms')->setOptions method:
form[id|method|onsubmit|onreset|action],input[id|name|style|type],label[for],textarea[id|name|rows|style]
in both _config.php files (mysite and cms) and had similar problems.
Any idea what I might be doing wrong?
I am using SS 2.4.0. Needless to say the field I am trying to edit is defined as HTMLText in my page class definition...
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

19 February 2011 at 12:25am Last edited: 19 February 2011 12:39am
I've got a problem where if I add a style to a <p> tag it vanishes when I update the page from the source editor.
I think the documentation has changed since Willr's post. The link there goes to the Class: HtmlEditorConfig page, and I searched for 'element', 'attribute', 'custom' and 'allow' on the page and page source but couldn't find anything relevant there.
I found a list of 'valid_elements' in HtmlEditorConfig::get('cms')->setOptions() (/cms/_config.php) - just trying to work out the significance of # and - before elements with lists of attributes in there.
e.g.
#p[id|dir|class|align|style]
-h1[id|dir|class|align|style]Would love to RTFM but I'm struggling to find my way around it! Can anyone give me any pointers?
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

19 February 2011 at 12:38am
My mistake it was an <img> tag that was losing the style, and adding 'style' after 'img' in the 'valid_elements' list I mentioned in my last post (in /cms/_config.php) sorted it out.
-
Re: HTML Source Editor stripping valid HTML tags (<acronym>, <dfn>,...)

19 February 2011 at 3:01am Last edited: 19 February 2011 3:01am
Would love to RTFM but I'm struggling to find my way around it! Can anyone give me any pointers?
Have a look at the tinymce documentation:
http://tinymce.moxiecode.com/wiki.php/Configuration:valid_elementsCheers
Christian
| 2193 Views | ||
|
Page:
1
|
Go to Top |



