Search code examples
djangotinymcerich-text-editor

Size of the HTMLFields tinyMCE in Django


I've just recently success to install tinyMCE the text editor and to use the HTMLField. The HTMLFIELDD in Django admin

But as you can see the area is not that big and I would like to make it bigger. I also have another question but this one is less important, I put all the tool in my editor but I can't see "code sample" so I'm wondering is there any tips to add it?


Solution

  • In setting.py just add:

    TINYMCE_DEFAULT_CONFIG = {
        'plugins': "table,xhtmlxtras,paste,searchreplace",
        'theme': "advanced",
        "theme_advanced_buttons3_add" : "cite,abbr",
        'cleanup_on_startup': True,
        'custom_undo_redo_levels': 10,
        'theme_advanced_buttons1': "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        'theme_advanced_buttons2': "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        'theme_advanced_buttons3': "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        'theme_advanced_buttons4': "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        'extended_valid_elements': "iframe[src|title|width|height|allowfullscreen|frameborder|webkitAllowFullScreen|mozallowfullscreen|allowFullScreen]",
        'theme_advanced_toolbar_location': "top",
        'theme_advanced_toolbar_align': "left",
        'theme_advanced_statusbar_location': "bottom",
        'theme_advanced_resizing': True,
    }