jetpack
jetpack copied to clipboard
Rankmath AI and Jetpack AI Conflict
Impacted plugin
Jetpack
Quick summary
When Jetpack is activated, it overrides the Rankmath AI button that is part of the block toolbar.
Steps to reproduce
- Install Rankmath and connect it to account. (Free plan is fine.)
- Activate Jetpack
- Create a post with a
paragraph
block.
A clear and concise description of what you expected to happen.
Rankmath's AI button in block toolbar should appear.
What actually happened
- When Jetpack is activated, Rankmath AI button does not appear in Block Toolbar.
- This is true even if
add_filter( 'jetpack_ai_enabled', '__return_false' );
filter is added to site. - When Jetpack is deactivated, it reappears.
Impact
One
Available workarounds?
No but the platform is still usable
Platform (Simple and/or Atomic)
Self-hosted
Logs or notes
https://wordpress.org/support/topic/conflict-with-rankmath-9/#post-17141423 https://wordpress.org/support/topic/jetpack-rankmath-conflict/#post-17165526
@Automattic/jetpack-agora Do you think you could take a look at this?
Thanks!
In some quick testing, this doesn't seem to have anything to do with Jetpack's AI feature specifically. I've tried versions of Jetpack back to 11.6 and they also somehow prevent Rankmath's AI button from showing up.
Coming at it in a different way, I find that Rankmath and the https://widgets.wp.com/wpcom-block-editor/default.editor.js script registered by Jetpack's modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php
tool are both trying to do like
registerFormatType(
'...',
{
title: '...',
tagName: 'p',
className: null,
edit: ...
}
);
It seems that it's not allowed for multiple things to register a format type for the same bare tag, we get this error in the console output: Format "wpcom/justify" is already registered to handle bare tag name "p".
It looks like the "wpcom/justify" one ultimately comes from Calypso's apps/wpcom-block-editor/src/default/features/rich-text.js.
It shouldn't be. It relies on the core API te extend the block toolbar. Going to take a look asap.
Thanks @anomiex for digging. The code there reads:
This code is developed in the calypso monorepo at https://github.com/Automattic/wp-calypso/tree/trunk/apps/wpcom-block-editor.
@jeherve any particular Calypso dev we could ping on this?
It seems that it's not allowed for multiple things to register a format type for the same bare tag
Great find! Looks like it indeed, since https://github.com/WordPress/gutenberg/pull/11488
no format type can use the same tag name, so e.g. you cannot have two format types handling a or span elements. [...] This is a proposal to instead normally serialise a class name. Only in cases where it is wanted that the format type can handle any element with the tag name, you can pass null for the class name.
I'm not sure what approach we should take here, since we want to be able to apply the justify format to just about any paragraph. On their end, I assume Rankmath AI also want to be able to make changes to all paragraphs.
any particular Calypso dev we could ping on this?
The Build team has been considering getting rid of that option in the WordPress.com Block editor, and instead rely on Gutenberg instead:
https://github.com/Automattic/wp-calypso/issues/73455
That would be a nice way to solve our problem.
Unfortunately it looks like we're not quite there yet in Gutenberg: https://github.com/WordPress/gutenberg/issues/48202
@Automattic/build What do you think?
What do you think?
I'd love to just add "align text justify" to this dropdown and be done with it:
Google Docs has it:
Microsoft Word has it:
It seems like Core is overly stuck on semantics.
Trying to jump at this one, but looks RankMath requires a subscription to show the AI
feature right now. Do you still able to reproduce it on free version @foleynotrose ?
@renatoagds I'm still seeing options for 100 AI requests with the Rankmath free version:
I have been trying to reproduce this conflict, but I'm not being able to do. I spawned some JN sites and I'm able to have Jetpack and RankMath installed and working properly both.
I note the changelog for RankMath v1.0.206 says
Fixed: Missing Content AI Command Center option when the Jetpack plugin is active
So perhaps that's why it can't be reproduced so easily anymore.
It looks like there is still something broken though:
- Create a "long" paragraph.
- Click the red "Rank Math" button next to Publish, which should open a sidebar.
- At the bottom of the sidebar there should be a "Content Readability" section, inside of which there should be an entry about long paragraphs with an "eye" icon next to it. Click the eye, which should highlight your long paragraph.
- Select the paragraph. Without Jetpack you get a "Shorten with AI" button instead of the usual editor toolbar, while with Jetpack you get the normal toolbar.
Videos
https://github.com/Automattic/jetpack/assets/1030580/78e3165e-6e27-41d4-9cbd-8e1854e2d4d7
https://github.com/Automattic/jetpack/assets/1030580/e9c7c3f2-5e4b-453c-8e96-e9a58a602123