Prevent modifying specific image components
I have a use case where I would like to make some specific components completely locked down (i.e. not resizable, not draggable, not copyable, not removable, etc). I have this mostly working, but I'm having a problem with images - I cannot seem to prevent the double-click functionality that opens the asset manager modal and allows the image source to be changed. Is it possible to prevent that modal from opening when double-clicking an image?
I've tried setting the component's "editable" attribute to false component.set({editable: false});, but that does not seem to give the desired behavior. In fact, it looks like the editable attribute is false by default on all image components, but I could be wrong about that. I would be happy to work on this feature myself and submit a pull request if you'd like.
Thanks!
Yeah, you're right, I use editable only for text components, but what you're asking actually make sense. I'd be happy to accept your PR.
You should add editable: true, to the model https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/ComponentImage.js
and then check it in the view here https://github.com/artf/grapesjs/blob/dev/src/dom_components/view/ComponentImageView.js#L44
...
if (editor && this.model.get('editable')) {
...
}
Thanks @artf! Here's the pull request: https://github.com/artf/grapesjs/pull/496
Merged https://github.com/artf/grapesjs/pull/496 👍
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.