[BUG] Class of a block doesn't always show in the classes section
Question
Hello everyone,
I have added many custom blocks and gave the same css class to all the images in those blocks. Let's call it for now 'image-class'. When I drag and drop 2 of those blocks and select 1 image in 1 of the blocks, the class 'image-class' does not show at first click in the classes section in the panel on the right. It only appears when the user clicks on a second image.
You can see in the image below, if the user drags and drops a 'Grid Items' block, and selects 1 image, the class 'grid-item-image' can be seen in the classes section in the panel (top right) <img width="1277" alt="screen shot 2018-08-16 at 6 00 49 pm" src="https://user-images.githubusercontent.com/28840780/44217144-745d7300-a17f-11e8-9e0d-ffa35d17244f.png"> That is the behavior I am trying to describe.
The fact that the class doesn't always appear at first image selection is causing me a problem, because if the user modifies the padding per example, he will be modifying the padding of the whole class, so all the images will be effected, which is confusing for the user, because the class 'image-class' is not there to uncheck it and modify only the selected image and not all the blocks with the class 'image-class'.
Answers (3)
Can't reproduce it, just provide a live demo (as I suggest in the issue template) with that block
I will share with you some screen shots that will surely make this problem clearer:
- Step 1: Drag a drop a block in the canvas and select it by clicking on it <img width="642" alt="screen shot 2018-08-21 at 10 16 29 am" src="https://user-images.githubusercontent.com/28840780/44386545-7599f180-a52b-11e8-99ba-1a2c7e3dca9e.png">
You can see that the id doesn't show where it should
- Step 2: Unselect the block by clicking anywhere else then select it again <img width="1278" alt="screen shot 2018-08-21 at 10 16 44 am" src="https://user-images.githubusercontent.com/28840780/44386586-94988380-a52b-11e8-8332-0988e178c763.png">
You can now see the id
Any idea on how we should make the id and the classes always show and not need a second click to appear?
Another question is how can I add another things like this? so let's say I want to add under the 'selected' something like tagname, to show the tagname of the selected component; In another words, I want that on each time the user clicks on a block, to see the tagname of it under the classes and the id. Is there a way to implement this?
Thanks
I understand what is your problem but still, you have to post a live demo because I can't reproduce it. It might depends on many stuff, just screenshots are not enough. I'm not even sure you're using the latest version, so update it please...
Another question is how can I add another things like this? so let's say I want to add under the 'selected' something like tagname, to show the tagname of the selected component; In another words, I want that on each time the user clicks on a block, to see the tagname of it under the classes and the id. Is there a way to implement this?
You can rely on this:
editor.on('component:selected', component => {
someSelectedEl.innerHTML = component.get('tagName');
...
})
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1696
Traits appear first time when draged custom component
Hi artf , i have created custom component and add traits for it , when dragging this component to editor and select it the setting traits w...
Issue #1468
[bug] modaltitle no effect
Hello, I can't translate asset manager title to french. Example : assetManager: { storageType: '', storeOnChange: true, storeAfterUpload: t...
Issue #1364
[Bug]: Error on multiple instances of grapesjs
Hello, I use Grapesjs in my reactJS application. I have a react component which is an instance of Grapesjs. So I can add this component in...
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
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.