Issue #741💬 AnsweredOpened January 10, 2018by duskhacker0 reactions

Saving CSS removes some styles on each save

快速解答by artf

@duskhacker here editor.setStyle(codeViewer.editor.getValue().trim()); you're setting this string <style>.txt-red....</style> when it should be .txt-red... Quick fix, just replace setStyle with addComponents

Read full answer below ↓

Question

This issue is a follow up of #609, I figured opening a new issue would be better than to keep commenting on a closed issue.

@artf asked if I could provide a working example of the issue. I've set up this pen:

https://codepen.io/duskhacker/pen/MrVpMa

It seems to work best in Chrome.

To see the issue, first click the 'edit CSS' button, then without editing, simply click the 'Save' button on the modal. Then click the 'edit CSS' button again, you should see that the style that was there is now gone.

This mirrors my experience in my implementation, each time I edit/save the CSS another block of styling is missing, it seems to remove the top block each time.

Answers (2)

artfJanuary 31, 2018

@duskhacker here editor.setStyle(codeViewer.editor.getValue().trim()); you're setting this string <style>.txt-red....</style> when it should be .txt-red... Quick fix, just replace setStyle with addComponents

lock[bot]September 18, 2019

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.

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

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.