WordPress/gutenberg

[RNMobile] Support setting anchors for all eligible blocks

Closed this issue · 1 comments

What problem does this address?

The mobile block editor has limited support for setting anchors for blocks. #27935 provides support for setting anchors for Heading blocks, but ideally the mobile block editor allows setting anchors for all eligible blocks to align with the web block editor.

There appears to be...

25 Eligible Blocks
  • audio
  • button
  • buttons
  • code
  • column
  • columns
  • cover
  • file
  • gallery
  • group
  • heading
  • image
  • list
  • media-text
  • navigation
  • paragraph
  • preformatted
  • pullquote
  • quote
  • separator
  • social-links
  • spacer
  • table
  • verse
  • video

What is your proposed solution?

The work within #27935 leverages the relevant anchor hook, but scopes its application for mobile to only include Heading blocks. We could support all eligible blocks by removing the current scoping.

Additionally, we would need to apply an appropriate section heading above the HTML anchor text input. I see a few options for the section heading.

Option Description
(A) Generic Section Heading Change the existing section heading from "Heading settings" to "Advanced settings."
(B) Block-Specific Heading Update the section heading to be unique for the current block type (e.g. Pull quote settings, Image settings).
(C) Advanced Settings Panel Port the web's InspectorAdvancedControls component to native mobile. We would need to determine how this collapsible panel on the web should be presented within the mobile bottom sheet. I.e. should it collapse or present without collapse?

From my perspective, Option C makes the most sense, as it further aligns with the web block editor. There are also additional controls within the web's Advanced settings section that may one day be ported to native mobile as well.

In reference to Option C above, just noting that since this issue was created, work was done to refactor the native implementation of InspectorAdvancedControls in #34069, which may make this implementation path easier.