ho to change style of added dom element
I added text h2 title: var domc = editor.DomComponents; var comp1 = domc.addComponent({ tagName: 'h2', type:'text', removable: true, // Can't remove it draggable: true, // Can't move it copyable: true, // Disable copy/past content: title, // Text inside component style: { color: 'red' }, attributes: { title: 'title',id:'header' } });
I need to change the color after adding item. How do I change the color and background css?
You can make use of this listener
editor.on('component:add', function(model) {
// ... put some check logic
model.set('style', { color: 'blue' });
})
What I am struggling with is with changing values of DOM Components after reloading of the Canvas. var comps = editor.DomComponents; var hType = comps.getType('div'); I am trying to get the exact component by ID not by Type var mmodel = hType.model; error- does not work mmodel.set('style', { color: $("Color").val() });
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.