Stabilize BlockCanvas's contentRef property #67209
Labels
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
The
contentRef
property, which provides access to the editor canvas wrapping element, is currently available only in the ExperimentalBlockCanvas. This prevents third parties which use the BlockCanvas to access the canvas element via the ref.The property is used in the VisualEditor component in
wordpress/editor
package to handle various visual effects, focusing blocks or handling clicks.There is a similar use case in the Email Editor we are building for MailPoet. The editor is currently experimental, but we plan to release in the next couple of months so we want to eliminate usage of private APIs as much as possible.
Another example of usage is in IsolatedBlockEditor.
It seems that a couple of independent custom editors ended up using this property.
What is your proposed solution?
I propose exposing the contentRef property on the public BlockCanvas component PR:(#67210).
Stabilizing the contentRef prop was already proposed as part of #57672. I want to highlight the comment from @youknowriad.
It has been more than half a year since the proposal so I hope we could revisit this. Using ref/forwardRef is quite common so I wouldn't say it is unclear. My concern here that allowing access to a dom element as public API could be too powerful and hard to manage in terms of backward compatibility. What would be the alternative approach?
Pros
Cons
The text was updated successfully, but these errors were encountered: