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:
Readme with a code example is missing for:
ToolbarButton
- https://github.com/WordPress/gutenberg/tree/master/packages/components/src/toolbar-buttonReadme should list:
wp.richText. insertObject
methodwp.richText. toggleFormat
methodwp.richText.registerFormatType
methodwp.richText.unregisterFormatType
methodChangelog should include in New features
section:
filterURLForDisplay
Readme should list:
filterURLForDisplay
methodWe 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
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 馃挴
The source code of the Plugin: https://github.com/iseulde/advanced-rich-text-tools
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 馃挴
Most helpful comment
The source code of the Plugin: https://github.com/iseulde/advanced-rich-text-tools