rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

Compatibility issue with Elementor Top Bar #274

Closed louiswol94 closed 2 months ago

louiswol94 commented 5 months ago

Describe the bug The Elementor Editor Top Bar feature isn’t detecting the changes made to Rank Math's meta box. The Update button doesn’t activate unless you make some changes to the content.

This issue was reported to Elementor by Uzair Nazeer

To Reproduce Steps to reproduce the behavior:

  1. Activate Elementor Top Bar Experiment
  2. Edit a page with Elementor
  3. Click on 'SEO' tab
  4. Make changes in the meta box
  5. See error - Publish button is not activated.

Expected behavior The "Publish" button should activate.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context In your activateSaveButton() function here:

https://github.com/rankmath/seo-by-rank-math/blob/master/includes/3rdparty/elementor/assets/src/DataCollector.js#L88

You need to run: window.top.$e.internal( 'document/save/set-is-modified', { status: true } ); Instead of calling footerSaver.activateSaveButtons() directly.

This command document/save/set-is-modified will run footerSaver.activateSaveButtons() with a UI hook (in elementor/assets/dev/js/editor/document/save/hooks/ui/set-is-modified/after.js ), and the new Top Bar also "listens" to this command to mark the Document as "dirty".

So by using the command instead of calling activateSaveButtons() directly, it should work on the old/new editor.