-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Phase 3: Explore inline block commenting #59445
Comments
Hey Annezazu, We're excited to share that we've developed this feature and equally thrilled to contribute it to the WordPress core. You can check out the codebase on our GitHub repository here. Key Features:
Feel free to explore the GitHub repository for a closer look at the functionalities, and don't hesitate to reach out if you have any questions or feedback. Let's make WordPress collaboration better than ever! 🌐✨ |
This is very exciting to see! Big thank you to your crew for being open to contributing your work to Core. It's part of what I hope to see more of with Phase 3. To move forward, are you all able to split your work into chunks to merge items in a multi-step process? Reviewing the whole repo in one go will be a huge task and smaller items makes it easier to get a sense of the whole. Since you all are experts in your own code and how it's architectured, it would help to have you all lead splitting and integrating it. In terms of general next steps, I had a quick chat with @youknowriad who suggested the following:
In some cases, for similar work, folks will create a big POC (proof of concept) PR that's initially opened to serve as an overall guide to the smaller steps. Here's an example: #53455 (comment) You're welcome to do that too to orient the work. Let me know what questions or guidance is needed so we can collaborate well <3 |
Here is the Introduction to database structure. Comments and related activities are stored within the wp_postmeta, whereas all plugin settings and miscellaneous data reside in the wp_options. Our plugin does not utilize any custom tables. Comment Meta Data Structure:
Autodraft Comments: Comments left blank or as autosaves are stored in _autodraft_ids on the post meta. We add our custom meta key to the WordPress "wp_postmeta" table. Also I am adding here visual presentation Introduce the REST endpoint |
Hello @poojabhimani12, thank you for contributing 🙏 I took a quick review at the various pieces to see how we can best proceed. Keep in mind I'm mainly a design/user experience contributor to the project, and the following should be seen as a first impression. Experimental flag PRThe PR, as noted, adds an experimental flag for the feature, and adds a button to the block toolbar. I later reviewed the plugin using the demo that's graciously provided. Quick GIF showing adding inline, block level comments, interacting with existing comments, editing comments, and more: There are quite a lot of impressive features. Enough that it can also be a bit overwhelming to take in at first, the demo site is no doubt created to show the breadth of features rather than necessarily a typical example of what you might see. But for that reason, I'll rewind a bit, and start with the basics, simply adding a comment. Adding commentsThere are a few ways to do it. Medium has an on-select inline toolbar to surface comment buttons: Google Docs, perhaps best known for collaboration features, shows an on-select toolbar on the right: MultiCollab supports both models:
It's also very feature complete:
It's certainly an impressive featureset, replicating most of what people appreciate about Google Docs. This also means that there's quite a big surface area for UI that would need to be added and reviewed. As part of that, some details would likely need addressing in order to be compatible with existing UI, meet accessibility criteria, such as using WordPress core components, WordPress icons, leveraging the design system and theme colors, border radii, shadows, borders, etc. Absorbing the featureset wholesale is likely not going to be feasible, given how much overlap the plugin has with phase 3 features. The overlap almost certainly comes with a great deal of experience from building everything from multi user editing to share buttons. Because of that, each of those pieces are probably best added separately. To aid that, the best path forward may be to extract the smallest possible feature-set, polish that to core standards for componentry, design, and accessibility, then ship that. And if it works well, outline a road map of subsquent features and how they might fit in with existing phase 3 collaboration issues. One outline for how to start could be:
We'd most likely want on-select commenting options, and simpler ways to comment. But by starting simple, the structure of the logistics of bringing this to the block editor could be hashed out, what needs rewriting vs. what can be reused would become clearer, and there would be fewer details to get right in order to ship each PR. Let me know if this makes sense, and thank you again for contributing! |
I'm excited to work with @ingeniumed and @alecgeatches on moving this work forward. We all work at WordPress VIP. Broadly, there are two different areas to consider: UI and data. @jasmussen offered tons of helpful UI feedback and some clear actions. There are big data questions, but I wonder if we could move the UI forward today. Could there be an experiment where comments aren't persisted in the database? Would that help integrate the UI and refine it to match WordPress standards? I think it may be helpful to explore this option. Turning toward data, I think the biggest question this raises is how we associate the comment with the block. The plugin does this currently, but there has been some conversation about a unique block ID. That would be a significant structural change with implications beyond just this issue. There is also room for conversation about storing the comments as WordPress comments vs. post meta. Or even inline as part of block attributes. The best next step is to gather further details on the "why" behind the current data structure. Did you experiment with it? Where have you seen issues? What implications would every WordPress blog worldwide have if it implemented this? If you could return to the beginning, would you do it another way? Once we have a strong case for the current (or a modified) structure, we can ask the community for feedback. If we can move forward on both paths, I think we can deliver the finished feature more quickly. |
I'm mostly curious how the comments will link to the content.
|
As an experimental approach for block-level comments, we are currently implementing a method where comments are saved by incorporating a new attribute called blockComments to the blocks. This allows us to manage the comments using the blocks' clientId, ensuring that each comment is associated with its respective block via the clientId. Regarding inline comments, we are storing the generated ID within spans. When we store this information... While this approach is still experimental, I am inclined towards saving comments in the post meta table to prevent information leaks, as you mentioned. With block comments already stored in the post meta, extending functionality to support inline comments becomes more straightforward. |
Sure, it's just that information about what is commented on can still be leaked, which is a tradeoff we may be ok with, I just wanted to highlight it. I don't really see any other robust way to achieve it tbh.
I'm not sure I understand this part. Are you "generating" a new ID by storing the client ID at the time of commenting? |
No, we are not. In the context of the WordPress block editor, each block has a unique clientId, which can be used to identify and manage block-specific data. In this PR, we are using the clientId to save and fetch comments from the block's attributes. However, with the post meta approach (storing comments as post meta), we might not use the clientId and instead generate our own unique IDs to store comments. |
Cool to see the work here! Expanding on what @smithjw1 mentions, I'd be very curious to see an exploration that introduces these as a new private |
That concept of blocks was explored also for Pattern Overrides with the existing |
The PR has been updated with the proposed data model and is now ready for review and merging as an experiment. |
While working on adding comments through a custom comment type, we have encountered a few queries and would appreciate your insights: Adding Custom Comment Type:
Adding Comments on Draft Pages: Our Suggestions:
|
I've updated this issue with mockups. |
As this new comment type, this will require lots of query to the comment database with that queried by the comment type. However, querying but comment type has some performance issues, as this type does not have an index. There is a core ticket #59488, if this feature is to make it into core, then I believe this index is required. |
While a discussion broke out years ago around a commenting API, this issue seeks to be a gathering place on what in line commenting could look like today as phase 3 has previously been more firmly announced and early explorations begin. In particular, this area of work is listed as a task for real time collaboration and this issue can act as a gathering place for coordinating what's needed. To pull from this workflows post:
Mockups
Some initial work is underway in #60622, where the following mockups were pulled from.
Adding comments:
"Add comment" is present in the block toolbar's "More" menu, in the first group.
Separately, this menu can itself benefit from migrating to DropdownMenuV2 so it can have flyouts, that might offer a better hierarchy.
Indicators:
In this example, comments have been added to a post. That makes the sidebar button appear. Implicitly that means, the comments button only appears if a post has comments.
Shown also, one of the blocks selected, with indication in the block toolbar: a stack of avatars of who interacted with this particular block. This particular design is similar to past concept art for collaborative editing, which imagines a similar stack of avatars with colored rings, in the top toolbar.
The block-highlight is block-level, to start, and shows the full block except for text blocks, where the full text is highlighted even if in inline style. An alternative is a block-level highlight treatment for all blocks:
This might get too close to block level multi-select, though, so the particular visual for highlighting blocks we can refine, it can also be borders and/or underlines.
Sidebar:
The sidebar has a partially-inline visual style, but it's mainly a matter of applying the site background-color as background to the sidebar panel.
Figma.
Issue updated Aug 29.
The text was updated successfully, but these errors were encountered: