Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Content Editor Discussions

Forum for content editors and CMS users.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

turn off validation tinymce html editor in SS3


Reply

4 Posts   1547 Views

Avatar
Molodoi

24 January 2013 at 3:38am Community Member, 6 Posts

Hi everybody,

I would to know "How can i turning off html validation in tinymce editor in Silverstripe 3?".

I want to add all HTML5 (<article>... and more) as the html code below directly into my HTML editor :

... some html ...
<input checked type="radio" name="slider" id="slide1" />
<input type="radio" name="slider" id="slide2" />
<input type="radio" name="slider" id="slide3" />
<input type="radio" name="slider" id="slide4" />
<div id="slides">
   <div id="overflow">
      <div class="inner">
         <article>
            <img src="images/slide/slide01.jpg" alt="#"/>
         </article>
         <article>
            <img src="images/slide/slide02.jpg" alt="#" />
         </article>
         <article>
            <img src="images/slide/slide03.jpg" alt="#" />
         </article>
         <article>
            <img src="images/slide/slide04.jpg" alt="#" />
         </article>
      </div>
   </div>
</div>
   
<div id="controls">
<label for="slide1"></label>
<label for="slide2"></label>
<label for="slide3"></label>
<label for="slide4"></label>
</div>
      
<div id="active">
<label for="slide1"></label>
<label for="slide2"></label>
<label for="slide3"></label>
<label for="slide4"></label>
</div>
<br />
... some html ...

Does anyone have an idea?

Thanks a lot

Matt ; )

Avatar
Molodoi

24 January 2013 at 4:35am Community Member, 6 Posts

First way, but not complete

In framework/admin/_config.php

In HtmlEditorConfig::get('cms')->setOptions(array(...

Replace : 'valid_elements' => "@[id|class|... some constraints...",
By : 'valid_elements' => "*

  • ",

    And replace : 'extended_valid_elements' => "img[class|src|... some constraints...",
    By : 'extended_valid_elements' => "*

  • ",

    That's a funky baby hacks, but, i'm always blocked for insert this blocks :

    <div id="controls">
    <label for="slide1"></label>
    <label for="slide2"></label>
    <label for="slide3"></label>
    <label for="slide4"></label>
    </div>

    <div id="active">
    <label for="slide1"></label>
    <label for="slide2"></label>
    <label for="slide3"></label>
    <label for="slide4"></label>
    </div>

    Does anyone have an idea?

Avatar
Molodoi

24 January 2013 at 6:10am Community Member, 6 Posts

Please, help me tinymce make me crazy :D

Avatar
Molodoi

24 January 2013 at 6:18am Community Member, 6 Posts

HtmlEditorConfig::get('cms')->setOption('formats', 'none');
HtmlEditorConfig::get('cms')->setOption('valid_children', '*

  • ');
    HtmlEditorConfig::get('cms')->setOption('convert_newlines_to_brs', 'false');
    HtmlEditorConfig::get('cms')->setOption('force_br_newlines', 'false');
    HtmlEditorConfig::get('cms')->setOption('force_p_newlines', 'false');
    HtmlEditorConfig::get('cms')->setOption('remove_linebreaks', 'false');
    HtmlEditorConfig::get('cms')->setOption('apply_source_formatting', 'false');

    HtmlEditorConfig::get('cms')->setOption('cleanup_on_startup', 'false');
    HtmlEditorConfig::get('cms')->setOption('trim_span_elements', 'false');
    HtmlEditorConfig::get('cms')->setOption('verify_html', 'false');
    HtmlEditorConfig::get('cms')->setOption('cleanup', 'false');
    HtmlEditorConfig::get('cms')->setOption('convert_urls', 'false');

    HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste','false');
    HtmlEditorConfig::get('cms')->setOption('paste_remove_styles','false');
    HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit','false');
    HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes','false');
    HtmlEditorConfig::get('cms')->setOption('cleanup','false');

    There's no solution