djangotinymcedjango-tinymce

Add plugins (power paste) in TinyMce django


Hi I am trying to add paste plugin in TinyMce in my django app. Here is the setting.py configuration.

   TINYMCE_DEFAULT_CONFIG = {
"toolbar": 'mobileequationeditor',
'height': 360,
'width': 1120,
'cleanup_on_startup': True,
'custom_undo_redo_levels': 20,
'selector': 'textarea',
'theme': 'modern',
'plugins':"powerpaste",
'toolbar1': '''
       fullscreen preview bold italic underline | fontselect,
       fontsizeselect  | forecolor backcolor | alignleft alignright |
       aligncenter alignjustify | indent outdent | bullist numlist table |
       | link image media | codesample | MathJax |
       ''',
'toolbar2': '''
       visualblocks visualchars |
       charmap hr pagebreak nonbreaking anchor |  code |
       ''',
'contextmenu': 'formats | link image',
'menubar': True,
'statusbar': True,
}

When I open the model in admin there is an error saying

Failed to load plugin: powerpaste from url https://website.com/static/tinymce/js/tinymce/plugins/powerpaste/plugin.min.js

I have tried collectstatic but no new static was collected. Where can I get plugin.min.js and where should I put it.

My static file configuration in setting.py is

STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles')
STATIC_URL = '/static/'

I am running these in production.

What's the solution? The thing is I want to copy images from word file directly into the RichTextField.


Solution

  • PowerPaste is a commercial plugin so it is not part of the freely accessible TinyMCE bundle. You would need to purchase PowerPaste in order to get access to the plugin at which point you can download it and add it to your project.

    If you choose to do this I would suggest placing the PowerPaste code in a separate place from the rest of your TinyMCE code and use external_plugins to load it via the TinyMCE configuration. This will allow you to update the core TinyMCE editor code without accidentally deleting the PowerPaste code.