Issue #3363Opened March 24, 2021by nairdapuiu1 reactions

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)

artfMarch 24, 20211 reactions

you shouldn't use the content property, use selectedComponent.components(str)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.