How to modify the draggable property of a defined component #6203
Answered
by
artf
maxming2333
asked this question in
Q&A
-
I am using the grapesjs-mjml plug-in, I tried the following methods, but the modification cannot be completed. const componentType = editor.Components.getType('mj-image');
const { model } = componentType;
model.prototype.defaults.draggable = '.new-draggable-selector'; // The setting here does not take effect. It seems to be a read-only attribute. editor.on('block:drag:start', (block) => {
const type = block.attributes.id;
if (type === 'mj-image') {
block.set('draggable', '.new-draggable-selector'); // This seems to be the attribute that sets the block, not the component.
}
}); I have added several new custom components. I hope |
Beta Was this translation helpful? Give feedback.
Answered by
artf
Oct 9, 2024
Replies: 1 comment 1 reply
-
You can update defined components with your default properties. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
maxming2333
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
You can update defined components with your default properties.