Style gets lost on deselecting a component when using rte.exec method
Question
Hi @artf,
When setting the backcolor/forecolor (or any other formatting like fontsize, etc) using the RichTextEditor toolbar, the formatting gets lost on deselecting > selecting and deselecting the component again. Please see the demo on code pen - https://codepen.io/AbdiasM/pen/LYVydpr Moreover, the RTE toolbar doesn't show again on entering edit mode.
Steps to reproduce:
- Drop a text block
- Double click the text block and select some text (eg. here)
- Click on the last icon in the RTE Toolbar and set the backcolor Observe: Backcolor is applied
- Click outside the text block
- Double click text block again to enter edit mode
- Click outside text block again Observe: Backcolor is lost
- Double click inside text block again Observe: RTE toolbar doesn't show
Could you please take a look into this. This is kind of crucial.
Answers (3)
Anyone?
Solved this by setting
avoidInlineStyle: 0,
forceClass :0,
in editor's config
However, the issue still occurs if template is imported. It can be reproduced on the GrapesJS demo page (https://grapesjs.com/demo.html) as well.
1. Import the following template:
` <div id="ipwi" class="c1423">Test
<span draggable="true" id="iqhox">Template </span> issue
</div>
<style>* {
box-sizing: border-box;
}
body {
margin: 0;
}
*{
box-sizing:border-box;
}
body{
margin:0;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
margin-left:0px;
}
#ipwi{
display:inline-block;
padding:5px;
width:auto;
}
#iqhox{
display:inline-block;
padding:5px;
width:auto;
color:rgb(255, 0, 0);
}
</style>`
2. Double click on the text 'issue' to enter edit mode
3. Click outside the text component
Observe: The formatting applied on the text 'Template' gets lost
@artfThanks for the report @AbdiasM we're already aware of the issue, it should be fixed once #1470 will be solved (so you can subscribe to the issue there)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2472
DragData extend for other components like div etc
Hi @artf How to implement dragData event for custom components(external).I called dragData method on div drag but dataTransfer and content...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Issue #1327
[QUESTIONS] Replacing selected text and getting html
Hi! Im trying to replace selected text with a code (random code). It's works, i can see the code, but when i do editor.getHtml() not. If i...
Issue #1842
Showing two times some properties and not showing some options too.
Hello, @artf @NicoEngler, I have one strange issues. I am using grapes.js and grapes.min.css with version of 0.14.50. While i am selecting...
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.