Span element gets stripped from editing
Question
We have added button on RTE toolbar so that we can put selected text inside <span>

Now, that functionality worked perfectly fine in our previously installed version (0.14.21) but now we updated to 0.14.43 and when I select the text and want to put it in <span> it does it in code, but RTE doesn't make it as element until I reload my template. It acts like part of all text instead of being selectable span block.

Generated code:
<div id="i3x1e" style="padding: 10px;">Insert your
<a href="" id="ib14x" class="link">text</a>
<span id="itjbi" class="span0">here</span>
</div>
Span button code:
rte.add('span', {
icon: 'Span',
result: rte => rte.insertHTML(`<span>${rte.selection()}</span>`)
});
Answers (2)
Okay, so we have found a solution by adding data-gjs-type='span' to a span element so the code becomes:
rte.add('span', {
icon: 'Span',
result: rte => rte.insertHTML(`<span data-gjs-type='span'>${rte.selection()}</span>`)
});
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #899
[QUESTION]: add button to selected element panel
How to add custom button to that panel:
Issue #1434
Toolbar Hide text element
@artf Please check you demo page text is hiding under the toolbar. how can we update the toolbar position?
Issue #1706
[Question]: How to get href from rte?
I have this rte toolbar where you can type and click 'save' and it's going to create a link for the selected text. but the problem is that...
Issue #1000
[Question/Bug] how to show plain text as trait
I want to show plain text within the trait under the setting button. In the above image 'Configuration_Type' I want to show as plain text....
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.