mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
feat: add JSON serialization for workspace comments (#7927)
* feat: basic comment serializer * bad: temporarily jam new comment classes into array * chore: implement serializer * chore: add serialization tests * chore: JSDoc * chore: unonly tests
This commit is contained in:
@@ -53,6 +53,9 @@ export class WorkspaceComment {
|
||||
) {
|
||||
this.id = id && !workspace.getCommentById(id) ? id : idGenerator.genUid();
|
||||
|
||||
// TODO: File an issue to remove this once everything is migrated.
|
||||
workspace.addTopComment(this as AnyDuringMigration);
|
||||
|
||||
// TODO(7909): Fire events.
|
||||
}
|
||||
|
||||
@@ -162,6 +165,7 @@ export class WorkspaceComment {
|
||||
/** Disposes of this comment. */
|
||||
dispose() {
|
||||
this.disposing = true;
|
||||
this.workspace.removeTopComment(this as AnyDuringMigration);
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user