Closed acamenhas closed 5 years ago
To learn more about how to extend components start from here: https://grapesjs.com/docs/modules/Components.html
The problem with the Video Component that its traits are handled a bit differently so in this case, I'd suggest looking at its source to get a better idea of how they work, but I think at the end this will work for you:
const dc = editor.DomComponents;
dc.addType('video', {
extendFn: ['updateTraits'],
model: {
init() {
this.addMutedTrait();
},
updateTraits() {
this.addMutedTrait();
},
addMutedTrait() {
if (!this.getTrait('muted')) {
this.addTrait({
type: 'checkbox',
name: 'muted',
})
}
},
},
})
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.
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.
Hi,
I need to extends the video type, just to add a new trait/property: muted There is any documentation that can tell me how can i extend an existing type?
Thanks