-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 documentation for object
key in registerFormatType
settings
#40051
Comments
From what I can tell the |
Hi, |
Ran into this issue this week :) Starting from the Format API tutorial here: https://developer.wordpress.org/block-editor/how-to-guides/format-api/ you can get to https://developer.wordpress.org/block-editor/reference-guides/packages/packages-rich-text/#registerformattype which tells you about In general the format API is missing a lot of documentation. e.g. I also needed to know what parameters the |
@ellatrix Do you maybe have some insight here? :) Would love to update the documentation to reflect all the options |
@fabiankaegy, @codebykat what can we do to get this resolved. Happy to help with a PR if you give me some hints/guidance. |
@mburridge im on the same page as you. I would have submitted a PR long ago if I fully understood what the object key is for. I was hoping to get some input from someone more familiar with the code here so that we can then document it. From my understanding objects are elements that are self closing like for example image tags. Whilst other elements that wrap content are no objects. |
Looking at the code I see I don't have the knowledge necessary to tell whether this type definition is up to date. |
I might suggest to try to type this package file per file until it's fully typed (which gives us the documentation for free) |
The
registerFormatType
function from the@wordpress/rich-text
package takes a settings object as the second parameter. Thissettings
object is typed asWPFormat
here in the code:gutenberg/packages/rich-text/src/register-format-type.js
Lines 9 to 20 in a7e2895
however there are also other none documented settings that are being used in the Gutenberg codebase like the
object
key used in thecore/image
format:gutenberg/packages/format-library/src/image/index.js
Line 24 in 60827ac
It would be great to get some documentation added for this undocumented key.
The text was updated successfully, but these errors were encountered: