[Question] Is it possible to extract the updated properties in events
Question
Hello,
I am wondering if it is possible to react on property updates.
I have tried to use the built-in events, but its not clear to me how I am supposed to extract the required information from the model.
For example when I handle the event component:styleUpdate:font-family then I get a model with alot of information, but not exactly which font-family is the new one.
It would be awesome, if it was possible to have the updated html node and the updated css properties for further processing.
Answers (3)
You can do it in this way:
editor.on('component:styleUpdate:font-family', component => {
console.log('updated component', component, 'font-family new value', component.getStyle()['font-family']);
});
Thanks for your answer. That would mean that I had to write for every single an event handler. Isn't there a more generic way to solve this issue?
That would mean that I had to write for every single an event handler.
Every single what? property? In that case you can try this:
editor.on('component:styleUpdate', (component, prop) => {
console.log('updated component', component, 'property:', prop, 'value:', component.getStyle()[prop]);
});
Related Questions and Answers
Continue research with similar issue discussions.
Issue #917
[QUESTION] Custom style properties per element
Is it possible to have custom style property UI per element. For example, consider that I want the font-size to be shown as textbox for tex...
Issue #1968
Get information on action that was undone
Is it possible to extract information on what was undone. I tried but I'm unable to fetch information on exactly what was undone, the value...
Issue #2696
[QUESTION]: How can I create block with background image with behavior like built-in "image"?
Hello, I'm trying to create block with background image (similar to Grapedrop Image Box). I added new component like this: And also I added...
Issue #2660
[QUESTION] Reinit model's components function
Hello guys, I have a custom component with different structure based on prop's value. How can i recall/reinit model's components function o...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.