I can't seem to find any way to hange editor size in TinyMCE. I edit posts on my site in Django administration and to make it easier I looked for a better editor than just a textfield. I succesfully installed TinyMCE, but the editor is tiny, which makes editing very annoying.
Here's how it looks like.
Here is my models.py
from django.db import models
from tinymce.models import HTMLField
class Post(models.Model):
title = models.CharField(max_length=140)
# body = models.TextField()
date = models.DateTimeField()
body = HTMLField()
def __str__(self):
return self.title
Here is my admin.py:
from django.contrib import admin
from blog.models import Post
admin.site.register(Post)
And here is my urls.py:
from django.conf.urls import url, include
from django.views.generic import ListView, DetailView
from .models import Post
urlpatterns = [
url(r'^$', ListView.as_view(
queryset=Post.objects.all().order_by("-date")[:25],
template_name='blog/blog.html')),
url(r'^(?P<pk>\d+)$',
DetailView.as_view(model=Post,
template_name='blog/post.html')),
]
I've been trying and googling for the past 2 hours, but I can't figure it out.
Can anyone help me? Thanks.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With