Skip to content

[Format API] Explore Building Method of Registering via JSON or PHP #30

@justintadlock

Description

@justintadlock

For simple RichText formats, we should explore registering these via JSON instead of needing to write JavaScript. For example, consider some simple inline text where you want to change the typography to something custom. It could be registered in a /richtext/example.json file like so:

{
	"title": "Example",
	"slug": "x3p0/example",
	"tagName": "span",
	"className": "example",
	"styles": {
		"typography": {
			"fontSize: "var(--wp--preset--font-size--sm)",
			"fontFamily": "var(--wp--preset--font-family--primary)",
			"textTransform": "uppercase"
		}
	}
}

Maybe there's even a potential PHP equivalent. Or just a PHP version in general (may be a better place to start).

This would be a very limited version of what you could accomplish with JS, but for really straightforward styling and no additional options, it'd give a lot of freedom.

Related Gutenberg tickets:

Metadata

Metadata

Assignees

Labels

🧪 EnhancementSpinning up new features in the lab.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions