3

The title, in my opinion, is self-explanatory. Basically let’s say a user if filling out an ckeditor richtextfield like so:

#app/models.py
from django.db import models
from ckeditor.fields import RichTextField

class App_Model(models.Model):
    content = RichTextField()

Now let’s say an user left the page. The content will not be saved. I want the content to be saved, whether it be cookies or to the server, so the user can come back and pickup where he left off. How would I do this, preferably in the most simplest way possible.

Thanks.

1 Answers1

1

One way to save the content is by using the CKEditor-AutoSave-Plugin plugin for CKEditor 4, which saves the data in an HTML5 LocalStorage (client-side).

You just need to download and add that plugin to the django-ckeditor module.

Download and unpack the CKEditor-AutoSave-Plugin into your static directory. Make sure that you put the autosave folder from the archive into this directory:

<static-dir>/ckeditor/ckeditor/plugins/autosave

Where <static-dir> refers to the directory for your static files. This could be directly inside your app folder (next to admin.py, apps.py etc). For more details check the Django documentation.

Configure your CKEditor by adding this to your settings.py

CKEDITOR_CONFIGS = {
    'default': {
        'extra_plugins': ['autosave'],  # Use the 'autosave' plugin
        'autosave': {                   # Configuration on the autosave plugin
            'autoLoad': True            # Don't ask for confirmation to restore
        }
    },
}

For more configuration options check the documentation on GitHub.

Kevihiiin
  • 86
  • 3