Skip to content
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

feat!: Add support for preserving block comment locations. #8231

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

gonfunko
Copy link
Contributor

@gonfunko gonfunko commented Jun 26, 2024

The basics

The details

Resolves

Fixes #8230

Proposed Changes

This PR preserves the positions of block comments when (de)serializing a workspace.

Reason for Changes

We allow users to position block comments arbitrarily, but while we preserve the location of workspace comments when (de)serializing the workspace, block comments have their positions lost. This is also needed to support the Scratch modernization effort, since Scratch persists block comment locations as well.

Breaking Change

This PR modifies the ICommentIcon interface to have two additional methods: setBubbleLocation(location: Coordinate): void and getBubbleLocation(): Coordinate | undefined. If you have a class that implements ICommentIcon, you'll need to implement these methods as well. They should set and retrieve the location of the comment bubble/box, in workspace coordinates.

@gonfunko gonfunko requested a review from a team as a code owner June 26, 2024 18:26
@gonfunko gonfunko requested a review from BeksOmega June 26, 2024 18:26
@github-actions github-actions bot added the PR: feature Adds a feature label Jun 26, 2024
@gonfunko gonfunko changed the title feat: Add support for preserving block comment locations. feat!: Add support for preserving block comment locations. Jun 26, 2024
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: feature Adds a feature and removed PR: feature Adds a feature labels Jun 26, 2024
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: feature Adds a feature and removed PR: feature Adds a feature breaking change Used to mark a PR or issue that changes our public APIs. labels Jun 26, 2024
Copy link
Collaborator

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic LGTM assuming you tested that round-tripping the coords in RTL works correctly. Easy to typo that stuff.

Can you also:

  1. Update the breaking change section of the PR description to tell people they'll need to implement these new methods if they're creating a custom comment icon.
  2. File an issue to update the docs on creating a custom comment icon to include this info?

core/icons/comment_icon.ts Show resolved Hide resolved
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: feature Adds a feature and removed PR: feature Adds a feature breaking change Used to mark a PR or issue that changes our public APIs. labels Jun 27, 2024
@gonfunko
Copy link
Contributor Author

gonfunko commented Jun 27, 2024

Logic LGTM assuming you tested that round-tripping the coords in RTL works correctly. Easy to typo that stuff.

Yep, verified roundtripping with each layout as well as going between them for both XML and JSON.

Can you also:

  1. Update the breaking change section of the PR description to tell people they'll need to implement these new methods if they're creating a custom comment icon.

Done

  1. File an issue to update the docs on creating a custom comment icon to include this info?

Sent you a CL updating the docs

@gonfunko gonfunko merged commit 989c91f into google:rc/v12.0.0 Jun 27, 2024
9 checks passed
@gonfunko gonfunko deleted the comment-position branch June 27, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: comments PR: feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants