Should anchor hook automatically format attribute text? #25304
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Package] Block editor
/packages/block-editor
[Type] Enhancement
A suggestion for improvement.
In #23197 anchor tag support was adding using hooks, this allows adding a
supports: { anchor: true }
property on a block that enables a field in advanced that can be set. Additionally a block can usesetAttrtbiutes: { anchor: "Anchor text" }
and it will set the value for the anchor field.However, the value does not automatically get converted to a valid value, per the spec, it should contain no whitespace.
Question: should the anchor hook automatically format the values being set?
My thought is yes, and also lower-case, switch whitespace to "-" so something like "Anchor text" would become "anchor-text"
We could then resolve #6182 by updating the
onChange: setAttributes( { content: value, anchor: value } )
Granted there is an issue for non-unique ids on the page, but that exists now regardless of heading.
Thoughts?
The text was updated successfully, but these errors were encountered: