question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Node category CSS

See original GitHub issue

It may be useful to include a CSS class named node-<category > in the parent node div, so that similar nodes can be styled differently. For example: render math nodes with a blue title, smaller in width, or no border radius at all.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
newcatcommented, Jul 27, 2019

Admittedly, I haven’t put enough effort into keeping the documentation up to date with the development in the past few months. I will try to improve that. Also just noticed that the API reference is completely broken 🤦‍♂

So yeah, a node type is a single entry in the “Add Node” context menu. Basically one kind of node has one type but there can be multiple nodes of the same type. I can see why you would like to have the category in the css class as well. But I have decided against that for the following reason:

The node list is in the Editor, which comes from the core package. For displaying nodes, the Editor.vue, which comes from the renderer-vue package, binds to the node list in the editor. The Editor (like the rest of the core package) does not “know” the concept of categories. This whole idea is only implemented in the renderer-vue package for having a nice and clean context menu. So when rendering the list of nodes, I do not directly have access to the category of a node, as the data comes from the core editor. I would have to add this data for each node in the Editor.vue, which in turn means that I can’t do a simple databinding where all the logic related to a node is separated into a Node.vue component.

So TLDR: Although it would be possible to implement, it would blur the line between data sources, which I don’t quite like, as it increases complexity and reduces maintainability.

1reaction
newcatcommented, Jul 27, 2019

Implemented in the dev branch. I decided against against using category names but instead, every node div gets a --type-<NodeType> modifier. By using CSS selectors you can style all nodes of a certain category at the same type, like this:

.node.--type-NodeA,
.node.--type-NodeB {
    background-color: red;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing the CSS class of the body based on node type
The page Customizing the full page layout and sections based on node type describes how to customize the overall layout. However, a great...
Read more >
Organizing your CSS - Learn web development | MDN
Here are some general suggestions for ways to keep your stylesheets organized and tidy. Does your project have a coding style guide? If...
Read more >
Implementing CSS class for the last child node in the treeview ...
Hi Parimal, One suggestion would be to set the Value Property of the last tree node to some custom text and in the...
Read more >
IntelliSense in Visual Studio Code
VS Code IntelliSense offers different types of completions, including language server suggestions, snippets, and simple word based textual completions. Icon ...
Read more >
Selectors Level 3 - W3C
CSS uses Selectors for binding style properties to elements in the ... This W3C Recommendation is identical to the 11 September 2018 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found