BUG: Set content function empties the component content
Question
I am trying to use the set function to change the content of a component, but actually the result is an empty component with nothing inside.
This is an example with the code summarized
editor.on('component:selected', () => {
const selectedComponent = editor.getSelected()
selectedComponent.set('content', "foo")
});
Version used: 0.16.44
What is the expected behavior?
The code executed should result in a component with text "foo" inside.
What is the current behavior? The executed code empties the component content.
In version 0.16.34 everything works as expected.
Is there an workaround for this issue or should i stick with 0.16.34 verison ?
Answers (1)
you shouldn't use the content property, use selectedComponent.components(str)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1511
[QUESTION] Change the html content of the selected component
I am trying to replace the html of the basic Text componet using the below code const component = editor.getSelected(); component.set('cont...
Issue #3704
BUG: load blocks closed by default?
I am using the following bit of code to collapse all the block categories, unfortunately, this is not working live demo : https://jsfiddle....
Issue #2951
typography sector not found
When using trying to add a font to the style manager, I use the following code: const prop = editor.StyleManager.getProperty('typography',...
Issue #2961
BUG: Components in custom modal isn't editable
Hello, I'm trying to add custom modal block to my project and I want to change content of this modal also with drag&drop. Here's code of my...
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.