Skip to content

Conversation

@leekelleher
Copy link
Member

Description

Fixes #20470.

When authoring UFM labels for Block editors (Block Grid, Block List and RTE Blocks), you can now use a $index token to display the block's current index (zero-based).

To note, with RTE Blocks, the index will always be zero 0. It has been wired up so that if we do implement index ordering for RTE Blocks in future, then it will render correctly.

How to test?

On a document that has a Block List or Block Grid, configure the corresponding data-type to have a label that utilizes the UFM syntax, e.g. Block ${ $index + 1 }. When adding several blocks, the block label should render the $index in a sequential order.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the $index token in UFM (Umbraco Friendly Markup) labels for Block editors, allowing authors to display a block's current zero-based index in the block label.

  • Adds $index property to all block component elements (Block Grid, Block List, RTE Blocks)
  • Updates block rendering to include index in the block value object for UFM processing
  • Implements index observation and propagation throughout the block editor hierarchy

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ref-rte-block.element.ts Adds index property and includes it in blockValue for RTE blocks
block-rte-entry.element.ts Implements index observation and passes it to ref component
property-editor-ui-block-list.element.ts Updates repeat key function and passes index to entries
ref-list-block.element.ts Adds index property and includes it in blockValue for list blocks
inline-list-block.element.ts Adds index property and includes it in blockValue for inline blocks
block-list-entry.element.ts Implements index observation and passes it to view components
block-grid-entry.element.ts Implements index observation and passes it to view components
block-grid-entries.element.ts Updates repeat key function and passes index to entries
block-grid-block.element.ts Adds index property and includes it in blockValue for grid blocks
block-grid-block-inline.element.ts Adds index property and includes it in blockValue for inline grid blocks

@iOvergaard iOvergaard merged commit 4ba1866 into main Oct 14, 2025
27 of 28 checks passed
@iOvergaard iOvergaard deleted the v16/bugfix/block-editors-ufm-index branch October 14, 2025 06:46
iOvergaard pushed a commit that referenced this pull request Oct 17, 2025
* Block List: adds `$index` support for UFM labels

* Block Grid: adds `$index` support for UFM labels

* Block RTE: adds `$index` support for UFM labels

Which is always zero `0`.
But has been wired up if we do implement the index order in future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support $index in block UFM labels

3 participants