Gutenberg: Documentation: Format API

Created on 26 Oct 2018  路  6Comments  路  Source: WordPress/gutenberg

We merged today #10209 which introduces new API which allows to register and unregister formats for RichText component. @iseulde did a fantastic job refactoring all existing code to use this new API. However, we still need to document the following items:

Components package

Readme with a code example is missing for:

RichText package

Readme should list:

  • [ ] wp.richText. insertObject method
  • [ ] wp.richText. toggleFormat method
  • [ ] wp.richText.registerFormatType method
  • [ ] wp.richText.unregisterFormatType method

Url package

Changelog should include in New features section:

  • [ ] Changelog should include filterURLForDisplay

Readme should list:

  • [ ] filterURLForDisplay method

Docs:

We should add an example how to control formats in the Extending Editor section.

@chrisvanpatten - let us know if that can be included in the efforts you are leading

[Package] Rich text [Type] Documentation [Type] Enhancement

Most helpful comment

All 6 comments

Let me start off by saying I don't understand anything I just read...

Currently I have used and have setup for clients a way for them to style from a drop down. This was fairly easy to do following instruction I found on the internet, and in WP documentation. None of this seems easy :o\

What I would love to see is a way to open a drop down to a list of style selections (classes) either via a block, or inline. This could be either somewhere in the menu for the block (inline) or in the block selector itself (block styles), that just allows for someone to select what they want, and it would add the class to the html tag. The styles themselves could be added to a separate hooked in style sheet.

Now maybe this is what your all talking about doing, I'm just not understanding.

I'm currently just playing around with Gutenburg but I haven't found an easy way to handle this. I have clients that use different fonts and sizes as well as colored bold and italics intermittently, hence why I made use a site specific plugin. Maybe this will be handled by a plugin, however I don't currently see any that add this ability. This is a real world use need.

Am I just missing this somewhere?
Thanks!

As @WebWeaver64 said the problem about Format API is its lack of documentation. I opened ticket #4658 that was closed but even though I'm trying, I'm not being successful at creating a button in text blocks. It's a very frustrating situation.

Things are easier when you have an example. And I found it: https://wordpress.org/plugins/advanced-rich-text-tools/

This plugin should be linked in the documentation. Thanks @iseulde 馃挴

Started a tutorial on the Format API at https://github.com/WordPress/gutenberg/pull/13247

It looks like this issue was resolved by @nosolosw in #13247. Awesome work 馃挴

Was this page helpful?
0 / 5 - 0 ratings