-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
base: trunk
Are you sure you want to change the base?
Add Inline comment experimental flag #60622
Conversation
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @akashdhawade1991, @juhibhatt19, @MD-sunilprajapati. 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.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
👋 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. |
Experimental block commenting
Try/inline block commenting
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:
|
if ( contentRef.current ) { | ||
updateBlockAttributes( clientId, { | ||
className: `block-editor-collab__${ threadId }`, | ||
} ); |
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.
Hm, I don't think we should be modifying blocks attributes to add a border? These attributes will be saved and shown on the front-end. Not sure what this border is until I can test the functionality.
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.
As of now, we have implemented commenting functionality at the block level and are adding a custom class with a comment ID to block attributes.
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.
Right, but we really shouldn't be setting block attributes to add a class. This should be done another way, maybe with the editor.BlockListBlock
filter or a hooks similar to these.
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.
editor.BlockListBlock
may be more straightforward to use for now, with that you can directly filter the block props and also the class name.
…ting Try/inline block commenting
…ting Try/inline block commenting
…ting Update package lock
@ellatrix - We have addressed all your feedback, and the task is now ready for re-review. |
@@ -0,0 +1,43 @@ | |||
<?php |
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.
This file should move within the experimental folder, otherwise it will be backported to core.
const { threads } = useSelect( ( select ) => { | ||
const meta = select( editorStore ).getEditedPostAttribute( 'meta' ); | ||
return { | ||
threads: meta?.collab ? JSON.parse( meta.collab ) : false, |
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.
This will return a new object on every select call, which will cause a re-render for every change to the editor store. JSON should be parsed on render instead, perhaps memoized.
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.
Also maybe we can use useEntityProp
here too?
} | ||
{ Object.keys( threads ).length > 0 && | ||
Object.values( threads ) | ||
.reverse() |
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.
What does reverse do here? Should they be started by date, and grouped by block position?
"@wordpress/data": "file:../data", | ||
"@wordpress/date": "file:../date", | ||
"@wordpress/editor": "file:../editor", |
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.
We shouldn't be adding all these dependencies to this package. But this should be resolved if we move away from adding this control as a format.
Implement inline commenting
Right now, we've just started with text-level blocks as per jasmussen's comments. We are planning to submit inline commenting and block-level commenting for all blocks soon. |
Could you let us know if this design will work for the sidebar comment board? |
Tbh, I don't see how it could work without being in the sidebar. We can't make space in the canvas like that because styles are dictated by themes. When comments are rendered in the sidebar, they can still be positioned slightly outside the sidebar, horizontally in line with the text, and the lines of the sidebar could be blurred if that's how you'd like to design it. |
@jasmussen tagging you in for some design questions and feedback here ✨ around placement of comments. |
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.
Why?
#59445
How?
Testing Instructions
Screenshots or screencast
demo.webm