Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit adding specific classes to nodes & SVG lines #628

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

smonsarr
Copy link

Currently certain aspects of nodes and lines can be modified such as background-color etc. When working with a web publication that supports theming, it is some times not acceptable to directly specify colours in the content of the page. Such aspects must be exclusively managed by CSS.

This change to jsmind adds two node data fields :

  • nodeClassList : an array of strings that will be added to the classList object of the rendered jmnode
  • lineClassList : SVG only - an array of strings that will be added to the classList object of the rendered SVG path

This allows the content to exclusively specify intent such as "important". How "important" is relayed to the user is managed exclusively in CSS.

In the following example each branch is assigned a nodeColor class (nodeColor_1, nodeColor_2, etc). The actual colors are managed by CSS theme:
image

In this example a node data looks like :

{
	"id": "gp0mlO8fTKjMkdlhaUwp6c",
	"topic": "Application : Documentaires, Biographies",
	"nodeClassList": ["nodeColor_1"],
	"lineClassList": ["lineColor_1"]
}

@smonsarr smonsarr changed the title Permit addind specific classes to nodes & SVG lines Permit adding specific classes to nodes & SVG lines Sep 12, 2024
@hizzgdev
Copy link
Owner

hizzgdev commented Sep 18, 2024

Thanks @smonsarr , your PR looks great. And I have some thoughts about the idea:

  1. we have to add nodeClassList and lineClassList to the nodes whose appearance we want to change?
  2. If the answer to the previous Question is true, I think it just like merge styles into a style rule?
  3. considering the HTML class is not applicable to Canvas graphing, I would like to suggest achieving it in another way.
    3.1. could we read the style rule and change the style of the leading line for Canvas?
  4. why do we need a list of className?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants