How to implement a (WYMEditor-based) text editor plugin for django CMS 3.0

644 views Asked by At

django CMS before version 3 included WYMeditor and TinyMCE as options; now text editing plugins have been spun out from the core. The only one so far provided is for CKeditor.

I have begun trying to implement a WYMeditor-based text plugin for django CMS 3.0.

My work so far: https://github.com/evildmp/djangocms-text-wymeditor

I also want to document this, because other people will likely need to do the same for their preferred editor: https://github.com/divio/django-cms/pull/1883

The code I have produced so far manages to launch the WYMeditor, but the two most obvious so far are:

  • nothing is saved on hitting Save
  • it's looking for JS files in weird places (e.g. /static/admin/js/lang/en.js, when nothing as far as I can tell has told it to look in /static/admin)

I am wondering which of these three strategies is likely to be most successful:

  • start by trying to replicate the functionality of the text plugin code from django CMS 2.x (what I have been doing so far)
  • start by trying to follow the example in the djangocms-text-ckeditor plugin
  • start by getting a working WYM widget for a textarea, and then trying to create a django CMS plugin based on that
2

There are 2 answers

0
Wes Winham On

nothing is saved on hitting Save

Do you have the class wymupdate on your Save button? That is required in order to automatically update your HTML based on your editing upon form submission.

it's looking for JS files in weird places

It looks like you're setting STATIC_URL based on settings.STATIC_URL. That's likely where the /static/admin path is coming from.

As far as strategies, I would say your current strategy of trying to replicate the functionality from Django CMS 2.x is the way to go. I'm certainly not a Django-CMS expert, however.

0
Wes Winham On

An answer to the root of your question, which I interpret as "How can I use WYMeditor with Django CMS 3", is to just use djangocms_wymeditor_plugin. This worked against the Beta version of Django CMS 3 that was available a couple months ago, so is likely to still work.