Issue #2610Opened February 28, 2020by AbdiasM0 reactions

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:

  1. Drop a text block
  2. Double click the text block and select some text (eg. here)
  3. Click on the last icon in the RTE Toolbar and set the backcolor Observe: Backcolor is applied
  4. Click outside the text block
  5. Double click text block again to enter edit mode
  6. Click outside text block again Observe: Backcolor is lost
  7. 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)

AbdiasMMarch 6, 20200 reactions

Anyone?

AbdiasMMarch 18, 20200 reactions

Solved this by setting

avoidInlineStyle: 0,
Code SnippetTEXT
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

@artf
artfMarch 20, 20200 reactions

Thanks 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.

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.