0

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.

Prashant Pandey
  • 221
  • 3
  • 16
  • Have you read [this](https://www.tiny.cloud/docs/plugins/powerpaste/#self-hostedinstallation)? It's not in the plugins folder by default, so you need to put it there yourself. Check your tinymce folder. – dirkgroten Nov 14 '19 at 11:25
  • You can also put this file in one of your own static folders and add the path to the [`TINYMCE_EXTRA_MEDIA`](https://django-tinymce.readthedocs.io/en/latest/installation.html#configuration) setting. – dirkgroten Nov 14 '19 at 11:27
  • But the problem is where can I get this file from? The above article says that TinyMce can be downloaded with Webpack and Browserify but in case of installation with django pip where can I get the plugin.min.js file? – Prashant Pandey Nov 14 '19 at 11:37
  • You need to buy the pro bundle or buy it separately [here](https://apps.tiny.cloud/products/powerpaste/) – dirkgroten Nov 14 '19 at 11:40
  • Do you know any other free plugin which can be used to copy paste images from a word file – Prashant Pandey Nov 15 '19 at 05:54

1 Answers1

1

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.

Michael Fromin
  • 13,131
  • 2
  • 20
  • 31