-
Notifications
You must be signed in to change notification settings - Fork 199
fix: DynamicLoading story, Codec and parseXml #125
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
fix: DynamicLoading story, Codec and parseXml #125
Conversation
|
ℹ️ in the original mxGraph code, the getCodec function could take a string parameter.
We still have some remaining part after migration to TypeScript in Codec.decodeCell. So this method probably fails. I guess we could make getCodec takes a string parameter, and benefits from alias (as I mentioned in #102), but if the proposed implementation works with getCodecByName works, let's go for it. I will test the proposed implementation soon. |
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
tbouffard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix 💪🏿.
The cells now display and new elements are added on click. As mentioned in the PR description, this story will be fully fixed when the cell deletion will work (#115)
dynamic-loading-fix-demo.mp4
|
ℹ️ about the graph.container properties always set to 0, someone propose the same fix in the past: This commit also proposed a fix for a typo that I have ported here: |
Summary
So I tried to fix
DynamicLoadingstory and stumbled across multiple problems.Problem 1 -
parseXmlnot returningDocumentmaxGraph/packages/core/src/util/xmlUtils.ts
Lines 37 to 39 in 61ab219
Don't know why it's added, but original code of
parseXmlreturningDocumentand notHTMLElement, which is breaking compatibility. In most casesparseXmlresult is used atCodecconstructor, which needsDocument.Removed
.documentElement.Problem 2 -
Codec.decodetrying to get constructors fromwindowmaxGraph/packages/core/src/serialization/Codec.ts
Lines 359 to 364 in 61ab219
It can work with vanilla JS imports, but bundlers (webpack) will kill this code very easy.
Added method
getCodecByNamefor getting constructor fromCodecRegistrydirectly by name, It's seems to work, don't really know about side-effects of this change, need advice.Problem 3 -
graph.container.clientWidthandgraph.container.clientHeightis always0in StorybookI don't understand why it's like that (maybe some CSS trickery), replaced it with
args.widthandargs.height.Description for the changelog
Fix
DynamicLoadingstoryRestored backward compatibility when using
parseXmlPossible fix for
Codec.decodemethod issueOther info
DynamicLoadingis fixed, but until #115 fix is merged, cells will not remove and story will look very strange 😸