Suggestion: Node category CSS
See original GitHub issueIt 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:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 therenderer-vue
package, binds to the node list in the editor. TheEditor
(like the rest of the core package) does not “know” the concept of categories. This whole idea is only implemented in therenderer-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 thecore
editor. I would have to add this data for each node in theEditor.vue
, which in turn means that I can’t do a simple databinding where all the logic related to a node is separated into aNode.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.
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: