Issue on Style Import
Question
Hi @artf,
Describe the bug detailed While creating a new template using GrapesJS, I came across a scenario that, when we try to import CSS from the import modal it does not get reflected in the editor.
- On a blank editor, I have created a template with HTML & CSS adding to it.
- After that, I need to do some changes in the CSS section, for that, I took the Import option at the top of the editor & scrolled to the style tag at the bottom.
- There I saw the style that causing the issue, I selected that and removed it.
- After that, I clicked the Import button.
Then I checked the template & the style issue was still there. So I again opened the Import modal to confirm that the style is not there & I removed it properly. I saw that the style I removed was still there inside the style tag. I tried to remove that multiple times and import it. It was not removed from the editor. It was there in the import modal once I again open that.
What is the current behavior? After removing a style from the Import modal, it does not get reflecting in the editor. No issues when we remove the HTML element and importing the code.
What is the expected behavior? After importing CSS(adding/removing/updating) using the Import option, it should reflect in the editor.
Plugins used grapesjs-lory-slider, grapesjs-tabs, grapesjs-custom-code, grapesjs-touch, grapesjs-parser-postcss, grapesjs-tooltip, grapesjs-tui-image-editor, grapesjs-typed, grapesjs-style-bg, gjs-preset-webpage, grapesjs-plugin-forms, gjs-component-countdown, gjs-plugin-ckeditor.
Are you able to reproduce the bug from the demo? Yes
Are you able to attach screenshots, screencasts, or a live demo? Yes, here is a demo link, and that its the demo link of the GrapesJS itself. Grapesjs Demo Video: https://www.awesomescreenshot.com/video/4985996?key=d6919e1431a0774cb65b25330fcb17e3
Version: grapesjs - v0.17.25 ckeditor - standard - 4.14.1 Browser - Google Chrome - Version 92.0.4515.131 (Official Build) (64-bit)
OS - Linux elementary OS 5.1.7 Hera, Built on Ubuntu 18.04.4 LTS, Linux 5.4.0-80-generic
**Side question:**
- Is there any way to rename the zip file downloaded using 'Export to ZIP' option in top menu? I am using:
`'gjs-preset-webpage': {
modalImportTitle: 'Import Template',
modalImportLabel: '<div style="margin-bottom: 10px; font-size: 13px;">Paste here your HTML/CSS and click Import</div>',
modalImportContent: function(editor) {
return editor.getHtml() + '<style>'+editor.getCss()+'</style>'
},
exportOpts: {
btnLabel: __yamlang('Export Landing Page to ZIP'),
filenamePfx: $('#user_company_name').val()+' - ', // Client Company Name comes here
filename: $('[name="page_name"]').val(), // Client Template Name comes here
},`
I get the download filename as 'grapesjs_template_datetime.zip'
Please let me know if there is any fix or workaround for this.
It will be a great help.
Thank you.Answers (3)
Hi @javadsamiee the issue was fixed on the latest version of the preset plugin
Hi @SintoDema the issue is here https://github.com/artf/grapesjs-preset-webpage/blob/3e5a9e12998c9a32b6f1199953084163678e6c17/src/commands/openImport.js#L15-L18
As you see, it updates components but doesn't clear the styles module. I don't have time to work on that plugin right now but I'd ask you to open an issue/PR there, one day or another I should fix it.
Hi @SintoDema the issue is here https://github.com/artf/grapesjs-preset-webpage/blob/3e5a9e12998c9a32b6f1199953084163678e6c17/src/commands/openImport.js#L15-L18
As you see, it updates components but doesn't clear the styles module. I don't have time to work on that plugin right now but I'd ask you to open an issue/PR there, one day or another I should fix it.
@artf Is there any update for this issue yet?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1334
How to import previous saved templates in new template.
@artf I have saved some templates created by grapejs and want to use/import it in new template as a section / block. I do not want import a...
Issue #3002
BUG: CSS Properties are not correctly loaded if style manager panel is not active at initialization
Hi @artf! Let me describe the issue Version: 16.22 What is the expected behavior? The css property values and visibility settings should ta...
Issue #4859
BUG: Editing CSS property sets a style to a common class instead of element
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v108Reproducible demo link https://gr...
Issue #3434
BUG: Using imported HTML/CSS/JS into the editor shows outlines, but no content, JS Fiddle inside
You can get the version by typing grapesjs.version into the console YES: https://jsfiddle.net/75a9u1cf/2/ What is the expected behavior? I...
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.