<script type="text/javascript" src="{{ TINYMCE_JS_URL }}"></script>

<script type="text/javascript">
    tinyMCE.init({
        mode: "none",
        theme: "advanced",
        language: "en",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_buttons1: "fullscreen,|,formatselect,|,bold,italic,|,sub,sup,|,bullist,numlist,|,anchor,link,unlink,|,code",
        theme_advanced_buttons2: "",
        theme_advanced_buttons3: "",
        theme_advanced_path: false,
        theme_advanced_blockformats: "p,h2,h3",
        theme_advanced_resizing: true,
        width: '680',
        height: '300',
        {% if TINYMCE_CONTENT_CSS_URL %}content_css: "{{ TINYMCE_CONTENT_CSS_URL }}",{% endif %}
        {% if TINYMCE_LINK_LIST_URL %}external_link_list_url: "{{ TINYMCE_LINK_LIST_URL }}",{% endif %}
        plugins: "fullscreen,paste",
        paste_auto_cleanup_on_paste : true,
        relative_urls: false
    });

    contentblock_init_handlers.push(function(){
        $('.order-machine textarea[class=item-richtext-tinymce], #frontend_editor textarea[class=item-richtext-tinymce]').each(function(){
            feincms_richtext_add_tinymce($(this));
        });
    });

    function feincms_richtext_remove_tinymce(field) {
        tinyMCE.execCommand('mceRemoveControl', false, field.attr("id"));
    }

    function feincms_richtext_add_tinymce(field) {
        tinyMCE.execCommand('mceAddControl', false, field.attr("id"));
    }
</script>
