Closed benvmatheson closed 5 years ago
On saving I export my CSS, then import it the next time I load
Read this please https://grapesjs.com/docs/modules/Storage.html
One example on those docs suggested just using the style
attribute:
const editor = grapesjs.init({
container: '#gjs',
fromElement: 1,
height: '100%',
storageManager: { type: 0 },
plugins: ['gjs-blocks-basic'],
style: '* {display: none;}',
});
However, other style was still prepended. Should it be assumed that when importing style, it will always be prepended with the following?
* {
box-sizing: border-box;
}
body {
margin: 0;
}
This is the default CSS that you can change via protectedCss
option, but again, if your purpose is to edit a previously created template, importing exported CSS is WRONG You might need to import HTML/CSS only on the creation of the template and this is ok, but later you should rely on the JSON created by the editor
Unfortunately our usage requires that we import/export raw CSS/HTML. But protectedCss appears to be doing exactly what we need. Thank you!
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.
On saving I export my CSS, then import it the next time I load. When doing so, it appends my CSS to the existing default CSS.
editor.CssComposer.clear()
appears to reset to default CSS, rather than clear all CSS.https://jsfiddle.net/benvmatheson/movxw7p1/3/
Is it possible to clear all CSS, or just have imported CSS replace all CSS rather than appending to default CSS?