Automattic / blocks-everywhere

Gutenberg block editor in WordPress comments, admin pages, bbPress, and BuddyPress.
GNU General Public License v3.0
77 stars 16 forks source link

Extend editor props to accept __experimentalOnChange and __experiment… #182

Closed arcangelini closed 1 year ago

arcangelini commented 1 year ago

Summary

There are a few helpful callbacks that are currently available in the isolate-block-editor that are no included in blocks-everywhere. These would be very helpful to have access to.

The PR adds the callbacks to wpBlocksEverywhere setting and leaves them as optional to avoid any conflicts if there is noting set. The three most helpful callbacks I thought would be onChange, onInput, onSelection.

This also updates the README with the new props.

Testing

  1. Setup the testing environment of your choice.
  2. Go to a page where blocks-everywhere is loaded.
  3. Everything should be working with no regressions.
  4. Use the dev console to set callback functions like this:
wpBlocksEverywhere.iso.__experimentalOnSelection = ( selection ) => console.log( 'Selection', selection );
wpBlocksEverywhere.iso.__experimentalOnInput = ( selection ) => console.log( 'Input', selection );
wpBlocksEverywhere.iso.__experimentalOnChange = ( selection ) => console.log( 'Change', selection );
  1. Now go back and use the editor to see the outputs in the console.
johngodley commented 1 year ago

Looks good. Can you also add a note in the readme.txt file too?