10๐
As said in the docs (http://django-tinymce.readthedocs.io/en/latest/installation.html#configuration), there is the TINYMCE_DEFAULT_CONFIG
setting which can be used to configure the editor. Just look for available options here: https://www.tinymce.com/docs/configure/editor-appearance/.
In your case, I think something like this may work:
TINYMCE_DEFAULT_CONFIG = {
'theme': "simple", # default value
'relative_urls': False, # default value
'width': '100%',
'height': 300
}
Put it in your settings.py
2๐
TINYMCE_DEFAULT_CONFIG dictionary needs to set in the settings.py file.
TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'width' : 758,
'height' : 118,
}
This will change width and height of the tinymce editor.
- [Django]-Encode ImageField in base64 and store it in DB instead of path of the image
- [Django]-User permissions for Django module
- [Django]-ModuleNotFoundError: No module named 'debug_toolbar' Django 3.1
- [Django]-Is there a better way to check if the values of an AJAX request are valid?
- [Django]-Add django class based view to admin site
0๐
I wanted to do exactly this โ change the TinyMCE admin widget size โ but not change the whole/default configuration for all of the widgets. Here was my solution:
class SomeModelClassAdmin(admin.ModelAdmin):
# ...
def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name == "description":
return db_field.formfield(
widget=TinyMCE(
mce_attrs={"height": "200"},
)
)
return super().formfield_for_dbfield(db_field, **kwargs)
TLDR: in your admin.py
, within the model admin class, override formfield_for_dbfield
with the above.
This only changes the height for the model field called description
rather than all admin tinycme widgets. Hope this can be useful! It took me a while to figure it out ๐