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

Add Inline comment experimental flag #60622

Open
wants to merge 190 commits into
base: trunk
Choose a base branch
from

Conversation

poojabhimani12
Copy link

@poojabhimani12 poojabhimani12 commented Apr 10, 2024

What?

Introducing the "Block Comment" experiment, with added functionality accessible via this feature flag which when enabled, allows users to add comments to the selected block by clicking on "comment" icon in the toolbar dropdown.

Screenshot at May 14 12-01-47

Why?

#59445

How?

Testing Instructions

  1. Enable the Block Comment experiment
  2. Insert any block
  3. Click on More dropdown from the block toolbar
  4. Click the comment icon in the toolbar and add comment.

Screenshots or screencast

Screenshot at May 14 12-11-59 Screenshot at May 14 12-13-15
demo.webm

Copy link

github-actions bot commented Apr 10, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @akashdhawade1991, @juhibhatt19.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: akashdhawade1991, juhibhatt19.

Co-authored-by: poojabhimani12 <poojabhimani@git.wordpress.org>
Co-authored-by: MD-sunilprajapati <spmultidots@git.wordpress.org>
Co-authored-by: rishishah-multidots <rishishah@git.wordpress.org>
Co-authored-by: ingeniumed <ingeniumed@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mtias <matveb@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 10, 2024
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @poojabhimani12! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@poojabhimani12 poojabhimani12 marked this pull request as draft April 10, 2024 06:20
@poojabhimani12 poojabhimani12 marked this pull request as ready for review May 16, 2024 04:49
@cbravobernal cbravobernal added the [Type] Experimental Experimental feature or API. label May 16, 2024
@ingeniumed
Copy link
Contributor

The following is a summary of the discussion that was had with @ellatrix, that's being posted by me for posterity.

In order to be able to test this feature end to end, this PR would need to be updated to add the ability to save comments as well. As a result, the following will need to be be done as the next steps:

  • Update the PR with the data model proposed here so that it actually persists everything. That way, you can see it working end to end.
  • Once this PR is merged in, keep an eye on the feature to see what sort of feedback is coming. Make any changes relevant to the feedback.
  • After sometime, put up a PR to drop the experimental flag so that it can ship in the next WP release - ideally 6.7

'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable multi-user commenting on blocks', 'gutenberg' ),
Copy link
Member

Choose a reason for hiding this comment

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

This should say something about being internal or for collaborators.

Copy link
Author

Choose a reason for hiding this comment

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

We’ve made this update based on the feedback provided here: #60622 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy to defer to Matías if he has suggestions. Perhaps: "Enable collaborative commenting on blocks."?

@poojabhimani12
Copy link
Author

Here are the details for the split PRs:

  1. Rest API PR - Add/rest api for block commenting #65181
  2. Add Speech Bubble icon - Add/add block comment icon #65180
  3. Comments supports to the block editor package - Add Inline comment experimental flag #60622

@poojabhimani12
Copy link
Author

I've been looking again the code changes of this PR. My understanding is that actually most of the feature is not a "block editor" feature. Aside the "button" to trigger the addition of a comment, everything is "editor" package (so WP specific)...

So a simpler solution to what I suggested above would be to actually move all of the code from the "block-editor" package to the "editor" package instead and use Slots or Extensibility APIs to inject the "comment" button into the block menu settings.

I would still suggest trying to split the PR to smaller PRs when possible though (for instance the REST API changes)

I have moved all the code from the "block-editor" package to the "editor" package.


<__unstableCommentIconFill.Slot
fillProps={ { onClose } }
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need another slot, we already have BlockSettingsMenuControls or __unstableBlockSettingsMenuFirstItem in this menu already. Can we use one of these?

Copy link
Author

Choose a reason for hiding this comment

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

Based on feedback, we've added a new slot to display the comment icon below the "Add after" option. If we use the __unstableBlockSettingsMenuFirstItem slot, the comment icon will instead appear at the top of the menu group.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, how important the position is. Can it be at the top or at the end of the menu instead ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, we can position it at the top, as shown here. We can also confirm with jasmussen to ensure he's okay with this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

return $response;
}
add_filter( 'rest_prepare_comment', 'add_user_avatar_urls_in_rest_response_6_7', 10, 1 );
}
Copy link
Member

Choose a reason for hiding this comment

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

I didn't see this in the REST API PR #65181, is it not relevant there?

Copy link
Author

Choose a reason for hiding this comment

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

We have implemented changes based on feedback from @tyxla directly in the REST API PR #65181 . For testing purposes, both files have been synced. If you'd prefer us to remove the REST API code from this PR, please let us know, and we'll handle it.

@@ -34,6 +34,7 @@
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/autop": "^4.7.0",
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this? This is a sort of legacy package that should be avoided. I don't understand why it's needed.

Copy link
Author

Choose a reason for hiding this comment

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

Based on feedback, we have added this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Experimental Experimental feature or API.
Projects
Status: Next
Development

Successfully merging this pull request may close these issues.