[QUESTION] Change and get value of editor.getSelected() block
How can I change and get the content of current selected block?
To get content:
editor.getSelected().get('content')
To set content:
editor.getSelected().set('content', 'myhtml')
@JulyanoF be aware that content is for static strings (used mainly for custom RTEs) therefore by doing this editor.getSelected().set('content', '<div>TEXT1</div>...') you wouldn't be able to edit inner elements.
const selected = editor.getSelected();
// Get the JSON of the Component
JSON.stringify(selected.toJSON())
// Get its HTML
selected.toHTML();
// Set new components
selected.components('<div>Text1</div><div>Text2</div>')
selected.components()
@artf I don't want to create a new component into the selected block,. I need only edit the content. When I use this method, it is creating a new div into the previous block. How can I avoid it?
@JulyanoF hi ,bro.i have encounter this problem.can you tell me how to solve it?
@ionic666 Hello. I did something like it:
editor.getSelected().toHTML().replace(/<div class="c.*?>([\s\S]*?)<\/div>/, '$1') to get content of selected area and editor.set('content', myContent) to set content
@JulyanoF i am sorry.Excuse me,I have done as you said,But it doesn't work.

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.