Codeinwp / visualizer

WordPress Visualizer plugin is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.
102 stars 29 forks source link

Feat/block chart edit #1136

Closed preda-bogdan closed 1 month ago

preda-bogdan commented 1 month ago

Summary

Added a button inside Gutenberg to Edit the Chart from a single location. Will open a Media pop-up Modal, the same that is used outside of the editor. Added a new filter visualizer_legacy_block_edit to allow users to switch to the legacy behavior. Eg.

add_filter( 'visualizer_legacy_block_edit', '__return_true' );

Hide previous controls from the block. Added E2E test.

Will affect the visual aspect of the product

YES

Screenshots

Edit Chart ![image](https://github.com/Codeinwp/visualizer/assets/23024731/609c3db5-c0d9-4777-91e1-f9aad0a5bcda)
Media Pop-up ![image](https://github.com/Codeinwp/visualizer/assets/23024731/9836f648-6915-4b54-a1cc-ceaa5a1dbbe9)

Test instructions

  1. All tests should pass.
  2. On a fresh instance add a chart inside the Gutenberg editor.
  3. Check that the Edit Chart button is present and previous controls are not available.
  4. Check that. the button will open the Media pop-up and allows you to edit the current chart.

Check before Pull Request is ready:

Closes Codeinwp/visualizer-pro#440.

pirate-bot commented 1 month ago

Plugin build for 48f6d40d43edfeacfda3c343ea871d6f11aeb9a8 is ready :bellhop_bell:!

irinelenache commented 1 month ago

@preda-bogdan Tested and found a single issue:

Can be checked here:

 Admin area URL: https://block-chart.s3-tastewp.com/wp-admin 
 Username: irinel 
 Password: v9M2uK9vP2Q 
Soare-Robert-Daniel commented 1 month ago
  • [ ] If you edit the chart using the pop-up, there will be a console error after saving, and the changes will be visible after refreshing the editor https://vertis.d.pr/v/wsi8xB

@preda-bogdan you can add:

window.send_to_editor = () => {
    view.close();
};

I found the same issue yesterday.

preda-bogdan commented 1 month ago

@Soare-Robert-Daniel thank you, but we also need to notify the editor to re-render the block.

preda-bogdan commented 1 month ago

@irinelenache The chart should update upon the window closing and no error should be displayed in the console.

Let me know if everything is working as expected now. Thank you!

irinelenache commented 1 month ago

@preda-bogdan The issue is fixed now, thank you 🚀