Issue #2799šŸ’¬ AnsweredOpened May 24, 2020by dintifla0 reactions

Ordering of selector with id and class selectors, space after id-selector

Quick answerby dintifla

a short update: I managed to get the the selectors in the right order when using selectors.unshift(idSelector) instead of selectors.add(idSelector) in above sample. Now i still have the issue with the missing space between the id- and the class-selectors. Until now I could not find a way to get into Selectors.getFullS...

Read full answer below ↓

Question

I am currently working on a web application for which we integrate this project as GUI editor to customize the environments. Our GUI components are loaded and parsed from the database. We can identify e.g. a button, data grid, etc. by an ID (e.g. 17190fbd-13d6-430f-bb32-1a09d2151a77). These components are then built from several nested HTML elements by a framework, which adds classes for styling. My goal is now to access these inner elements from GrapesJS with something like #ancestor-id .framework-class1.framework-class2 (e.g. #17190fbd-13d6-430f-bb32-1a09d2151a77 .my-text-label) I add the i...

Answers (3)

dintifla• May 26, 2020

a short update: I managed to get the the selectors in the right order when using selectors.unshift(idSelector) instead of selectors.add(idSelector) in above sample. Now i still have the issue with the missing space between the id- and the class-selectors. Until now I could not find a way to get int...

artf• May 26, 2020

Hi @dintifla SelectorManager is not meant to work like that (you can only have a mix of classes .class1.class2 but not with IDs), but honestly I don't understand what is your goal of using the SelectorManager at all. If you need to query a component in the editor you can just do this anyParentCompo...

dintifla• May 26, 2020

Hi @artf Thanks for your reply. In the end it is not just about querying a component, but generate the CSS for it. I don't need the HTML since my application is designed in a rich client application, stored in an abstract representation into the database and then parsed into a DOM. As a result, I c...

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.