django-cms / djangocms-bootstrap4

django CMS Bootstrap 4 is a plugin bundle for django CMS providing several components from the popular Bootstrap 4 framework.
https://www.django-cms.org/
Other
82 stars 58 forks source link

Bootstrap4Picture is incompatible with djangocms-text-ckeditors default paste-image handling #115

Closed CaptainChaos closed 3 years ago

CaptainChaos commented 4 years ago

In djangocms_text_ckeditors file picture_save.py, the model djangocms_picture.Picture is try-loaded (which is available since it's a dependency for Bootstrap4Picture). During initialisation, Bootstrap4Picture calls plugin_pool.unregister_plugin(PicturePlugin), so copy-pasting a picture into CKEditor results in a KeyError since a PicturePlugin is created, but not available in the PluginPool.

The first fix which comes to my mind is try-loading Bootstrap4Picture before trying to load djangocms_picture.Picture in picture_save.py

CaptainChaos commented 4 years ago

I just found out about the CKEditor Setting TEXT_SAVE_IMAGE_FUNCTION, maybe it would be better to include an override function for this to djangocms-bootstrap4 and mention it in the readme. For my needs, I'll go this way and create a PR.