-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: comment have XML save and load new workspace comments classes #7931
Conversation
f7ee13b
to
07a22ec
Compare
07a22ec
to
8be694a
Compare
@@ -478,6 +491,34 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { | |||
return newBlockIds; | |||
} | |||
|
|||
/** Deserializes the given comment state into the given workspace. */ | |||
function loadWorkspaceComment( |
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.
I am curious why not have this implemented as a function on the class itself, like it used to be? It seems like that would make it easier on people who are implementing custom subclasses, and it would make more sense organizationally IMO. And we do have a pattern of a fromXml
method on fields, events, etc.
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.
No one is allowed to implement custom subclasses atm. We discussed that and decided YAGNI.
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.
Fair enough :)
The basics
The details
Resolves
Fixes N/A
Proposed Changes + reasons
Updates the XML system to save and load new workspace comment classes for a ✨ seamless transition ✨
Test Coverage
Added round-trip tests for comments. This also covers the logic for all the headless setters and getters (as promised in a previous PR)
Documentation
N/A
Additional Information
Sorry about the derpy format for the serialization tests. But rewriting them to be mocha style isn't worth it.
When writing this I realized that JSON isn't handling RTL correctly. I used the same (bad) implementation here, then I'm going to fix it in my next PR.