Reputation: 241
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.
Upvotes: 0
Views: 1885
Reputation: 21
Want to describe the issue I faced, maybe it helps someone. So when I had to add powerpaste in self hosted mode I spent a lot of time before I decided just add direct link to plugins with API_key. And it helps. But on the next day it stop working because of MIME type. And only external_plugins setup helps me. I don't know how it can be possible everything was fine in evening and then in morning not working. So my config looks like
external_plugins: {
powerpaste:
'https://cdn.tiny.cloud/1/API_KEY/tinymce/7.2.1-75/plugins/powerpaste/plugin.min.js'
},
Upvotes: 0
Reputation: 13746
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.
Upvotes: 2