Skip to content

Conversation

@mcyph
Copy link
Collaborator

@mcyph mcyph commented Apr 19, 2021

In this PR I've made it so most calls in the examples and core go directly to mxCell rather than going through mxGraphModel to improve readability+simplicity for newer users. The previous functions in mxGraphModel are still there but now forward to the mxCell function with a // SLATED FOR DELETION comment to indicate it may be removed at a later date.

So for example:

if (!state.view.graph.getModel().isEdge(state.cell)) {

will become

if (!state.cell.isEdge()) {

I also have started to remove some of the nulls as possible types to functions in mxCell to try to eliminate bugs which occur due to nulls being accidentally passed to functions and no exception raised, but please note this also will introduce bugs in some cases, especially where null is passed from non-typescript/plain-js files which don't have as strict checking.

@junsikshim
Copy link
Collaborator

What are those docs/stashed/* files?
They look like examples, but are in a weird location...

@mcyph
Copy link
Collaborator Author

mcyph commented Apr 20, 2021

What are those docs/stashed/* files?
They look like examples, but are in a weird location...

Yeah, they are the examples I didn't convert/started converting to react but hadn't yet finished. I put them there outside the source code tree because React/next.js wouldn't work unless all the javascript files were parseable.

Those "stashed" examples were still there prior to this PR, and mainly only things related to mxGraphModel should have been changed this time around in that dir.
Some of these were relatively complex examples or depended on other things working first, and was leaving refactoring/converting the examples till later. This includes the "editor" examples you can view at https://jgraph.github.io/mxgraph/javascript/.

@mcyph
Copy link
Collaborator Author

mcyph commented Apr 20, 2021

I wonder how the big "Editor" code differs in scope and whether it was derived from/turned into https://draw.io ?

I'm wondering whether it may be worth investigating whether https://github.com/jgraph/drawio itself could be converted to ES9 and added to the library/put into an external package if it's not orders of magnitude larger.

@junsikshim
Copy link
Collaborator

Those "stashed" examples were still there prior to this PR

Oh, I just realized I had docs excluded in my vscode config.
I never saw them until now. lol

Btw, I'm still converting your examples(the ones in src/pages/) into storybook. I'll open a PR when it's ready.

@junsikshim junsikshim self-requested a review April 20, 2021 10:20
@junsikshim junsikshim merged commit def8468 into maxGraph:development Apr 24, 2021
@tbouffard tbouffard added the refactor Code refactoring label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants