Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#54247 new enhancement

REST API: Add block editor settings endpoint

Reported by: enej's profile enej Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:

Description

This is a tracking ticket for merging the block editor settings endpoints from Gutenberg.

https://github.com/WordPress/gutenberg/blob/trunk/lib/class-wp-rest-block-editor-settings-controller.php

Change History (11)

This ticket was mentioned in PR #1756 on WordPress/wordpress-develop by enejb.


3 years ago
#1

  • Keywords has-patch has-unit-tests added

This ticket was mentioned in Slack in #core-restapi by enej. View the logs.


3 years ago

TimothyBJacobs commented on PR #1756:


3 years ago
#3

Thanks for the patch @enejb! We usually don't merge these until shortly before/alongside the corresponding JS. Is there a ticket for that already?

#4 in reply to: ↑ description @enej
3 years ago

More context:
This block-editor-settings endpoint first landed in https://github.com/WordPress/gutenberg/pull/29969

The main rationale behind the endpoint is to expose the block editor settings data so that it can be consumed by other editors in different contexts such as the mobile native editor, site editor, the front end.

Currently, the editor loads these settings on page load vs using this endpoint but there seems to be interest in using this endpoint in the future. (https://github.com/WordPress/gutenberg/pull/29969#issuecomment-831785648)

This endpoint was first introduced as __experimental/wp-block-editor/v1 in gutenberg and later renamed to wp-block-editor/v1 in https://github.com/WordPress/gutenberg/pull/33128

Some rational behind wp/v2 vs wp-block-editor/v1 can be found in this comment https://github.com/WordPress/gutenberg/pull/33128#discussion_r662384172

Shipping this endpoint in 5.9 would mean that more folks that are using the mobile app block editor (not just sites running the latest version of Gutenberg) can benefit from the colour and font size options UI improvements.

enejb commented on PR #1756:


3 years ago
#5

Thanks for taking a look @TimothyBJacobs

I provided a bit more context here - https://core.trac.wordpress.org/ticket/54247#comment:4
As far as I can tell the endpoint is not being used yet directly by Gutenberg. (I couldn't find any calls being made to it)

cc @gziolo Do you know if there are any plans for using the endpoint in Gutenberg directly?

We are already using the endpoint in native mobile apps already in order to allow users to edit font size and colours on some blocks.

gziolo commented on PR #1756:


3 years ago
#6

Do you know if there are any plans for using the endpoint in Gutenberg directly?

In theory we could since we print in PHP some JS code to pass the same settings to the editor. I’m not sure how the transition could look like in practice though. @oandregal or @jorgefilipecosta, any immediate plans related to that?

oandregal commented on PR #1756:


3 years ago
#7

:wave: This is what I know: this endpoint landed at https://github.com/WordPress/gutenberg/pull/29969 in Gutenberg and it's used by mobile, so they'd know more if it's ready to be merged in WordPress core. @WordPress/native-mobile

While the endpoint was mainly driven by mobile needs to gather "global styles" data, it can do more as it stands. It was suggested that the editors could use this endpoint, but I'm not aware of any work in this direction. Additionally, @youknowriad is proposing we use a different one for global settings & styles at https://github.com/WordPress/gutenberg/discussions/35141 If we do so, I wonder if mobile should use it as well. Given that this is still being talked about, I'm not sure we should merge the existing settings endpoint.

geriux commented on PR #1756:


3 years ago
#8

If we do so, I wonder if mobile should use it as well.

Hey @oandregal 👋 It'd be nice to use it on mobile as well since we have plans to allow modifying global styles from the app, the thing is we also use __experimentalFeatures from the block editor settings endpoint. Would this new endpoint have this data as well?

oandregal commented on PR #1756:


3 years ago
#9

Would you provide your thoughts on the discussion at https://github.com/WordPress/gutenberg/discussions/35141? If we go that route we need to cover the two use cases we have at the moment (mobile plus the site editor).

This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.


3 years ago

#11 @andraganescu
3 years ago

  • Milestone changed from Awaiting Review to Future Release

It looks like this would be a good addition to the API for the mobile app. Nevertheless it's unclear from here if that endpoint is "final" or a new one is in the works.

Note: See TracTickets for help on using tickets.