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 usage documentation for Rich Text package #35885

Merged
merged 8 commits into from
Oct 27, 2021

Conversation

getdave
Copy link
Contributor

@getdave getdave commented Oct 22, 2021

Description

I've been using the @wordpress/rich-text package a fair amount recently. It's super powerful and I really appreciate the work that's gone into this.

That said, to understand the package you must currently learn by either:

  • reading the code
  • reading the tests
  • reviewing current example usages

Whilst it is possible to gain a working understanding of the fundamentals of the package in this way it is not the most efficient method. Given that this package is so critical and underpins much of what Gutenberg can do, this seems like something we should look to address.

This PR attempts this by adding some basic Usage documentation. This covers

  • the purpose of the package.
  • the fundaments of the RichTextValue object.
  • the concept of "selections" (including "collapsed" selections)

I would also like to cover the replacements property of the value object. I would do this but I still don't understand it so I'm going to need to rely on others to add this information.

How has this been tested?

  • Read the docs.
  • Do they make sense?
  • Is any element misleading?
  • Is any part inaccurate? - specifically the code / prose-based examples.
  • Is my spelling and grammar ok?
  • Was there anything missing?

Screenshots

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@getdave getdave added [Type] Developer Documentation Documentation for developers [Package] Rich text /packages/rich-text developer-docs labels Oct 22, 2021
@getdave getdave requested review from gwwar and ellatrix October 22, 2021 15:46
@getdave getdave self-assigned this Oct 22, 2021
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

Thanks for adding the examples, I've already learned more about the RichText package.

I've added a couple of suggestions on rewording in a few spots.

I was a little confused by the Collapsed selection, the first paragraph makes sense. However, the last sentence confused me on what I'm supposed to take away from it.

It looks like you are still working on it since there is a TODO: in the Replacements spot, or was that asking for others to add their input?

This is great so far and thanks so much for documenting and adding examples. It helps!

@getdave getdave requested a review from mkaz October 26, 2021 13:29
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

Thanks for updating, this is a good improvement to the RichText docs 👍

@getdave getdave merged commit 2d6a363 into trunk Oct 27, 2021
@getdave getdave deleted the try/augment-rich-text-with-usage-docs branch October 27, 2021 08:17
@github-actions github-actions bot added this to the Gutenberg 11.9 milestone Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Rich text /packages/rich-text [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants