Automattic / isolated-block-editor

Repackages Gutenberg's editor playground as a full-featured multi-instance editor that does not require WordPress.
344 stars 50 forks source link

Add experimental onSelection callback #162

Closed msurdi closed 2 years ago

msurdi commented 2 years ago

This Pull request adds a new __experimentalOnSelection prop to the main editor component. The callback, if provided, will be invoked every time there's a selection change in the editor.

This is so that we can hook into the lifecycle of the selection process without having to reach to the internals of the editor.

I've updated the "Controlled" storybook example so we can see it working.