-
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
Change insertion markers to use JSON deserialization when duplicating blocks #7316
Comments
Can I pick this challenge? |
Sure go for it @varshneydevansh ! |
I found the discussion to be very intriguing and understood how we arrived at this issue. To use the JSON serialization and deserialization the Is this is a suitable approach? I think I also have to remove all the related functions regarding the mutation state. for example- Line 123 in 2a2b3b3
If I do this, then I also have to remove the references from these places? Or should I leave them as it's and just change the I think I also have to add the Line 70 in 2a2b3b3
export class BlockSVG {
// Add the toJson method
toJson(): string {
return JSON.stringify(this);
}
// Add the fromJson method
fromJson(json: string): void {
const data = JSON(json); |
Hello @varshneydevansh =) When I said the "JSON serialization system" above I meant this one! The example of serializing individual blocks should help you. So you don't need to remove or add any APIs, just call the APIs linked above from the insertion marker code to create the marker block =) I hope that helps! If you have any further questions please reply =) |
Reoppening due to rollback #7430 |
Check for duplicates
Problem
Insertion markers duplicate the block being dragged, and then tell the duplicate to be an insertion marker.
Currently the duplication duplicates (ha) a lot of code from the serialization system. We think this is because in the past the XML system didn't have a good way to just serialize and deserialize a single block (without children). But the JSON system does have this!
Request
Change the insertion marker
createMarkerBlock
code over to use JSON serialization and deserialization.Alternatives considered
No response
Additional context
Sparked by this discussion: https://groups.google.com/g/blockly/c/gcvynl88QLY/m/shFyX4x0BwAJ
The text was updated successfully, but these errors were encountered: