Skip to content

[Feature]: Issue 300 | Content Resizing#331

Draft
TylerB24890 wants to merge 8 commits intoWordPress:developfrom
TylerB24890:feature/issue-300-content-resizing
Draft

[Feature]: Issue 300 | Content Resizing#331
TylerB24890 wants to merge 8 commits intoWordPress:developfrom
TylerB24890:feature/issue-300-content-resizing

Conversation

@TylerB24890
Copy link

@TylerB24890 TylerB24890 commented Mar 20, 2026

What?

Closes #300

This feature allows authors to select existing text blocks and use AI to modify their length or density without changing the core meaning with an Inline Transformation flow.

Why?

Editors often struggle with pacing. A section might be too verbose (needs condensing) or a key point might feel underdeveloped (needs expanding). This tool acts as an instantaneous editor.

How?

This PR applies a new experiment "Content Resizing" which, when enabled, adds a toolbar to the core/paragraph block with various options to have AI resize the content. There are three options available; Rephrase, Shorten, Expand.

When the block has AI generated content applied, the toolbar button applies an active state providing a visual cue that the block is using AI content. Additionally, an "Undo" action is added to the toolbar dropdown, allowing editors to undo the AI generated content and revert to the original content.

Use of AI Tools

  • AI Assistance: Yes
  • Tool(s): Claude Code (Opus 4.6)
  • Used for:
    • Experiment scaffolding
    • Debugging support & code suggestions
    • Inline documentation
    • Unit test generation

Testing Instructions

  1. Enable the "Content Resizing" experiment from the AI settings page.
  2. Navigate to a block editor and select a paragraph block.
  3. Use the AI icon in the toolbar to resize the content.
    • Test all three resizing actions.
  4. When AI content is applied, confirm the toolbar icon shows an active state indicating AI suggested content is being used.
  5. When AI content is applied, confirm the "Undo" action exists and functions in the block toolbar.
    • Clicking "Undo AI changes" will revert the block content to its original state.

Screenshots or screencast

Suggested Content:
ai-resize_suggestion

Undo Action
ai-resize_undo

Open WordPress Playground Preview

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 65.42056% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.09%. Comparing base (32c5e2d) to head (3d3ada6).

Files with missing lines Patch % Lines
.../Experiments/Content_Resizing/Content_Resizing.php 34.48% 19 Missing ⚠️
...es/Abilities/Content_Resizing/Content_Resizing.php 77.63% 17 Missing ⚠️
.../Abilities/Content_Resizing/system-instruction.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #331      +/-   ##
=============================================
+ Coverage      57.85%   58.09%   +0.24%     
- Complexity       615      637      +22     
=============================================
  Files             46       49       +3     
  Lines           3165     3272     +107     
=============================================
+ Hits            1831     1901      +70     
- Misses          1334     1371      +37     
Flag Coverage Δ
unit 58.09% <65.42%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TylerB24890 TylerB24890 changed the title [WIP]: Issue 300 - Content Resizing [Feature]: Issue 300 | Content Resizing Mar 23, 2026
@TylerB24890
Copy link
Author

@jeffpaul I took a stab at this and have a functional experiment here, however I took a slightly different approach from the described UI in the issue. I opt'd to use a modal UI for accepting the resized content, similar to the SEO Meta Descriptions UI.

One thing I think could improve the experience would be to add a direct comparison UI, perhaps render the original content in the modal so editors can see both side by side? Open to your thoughts here.

Also might need some improvement on the system-instruction.php. It works as is, but sometimes the model doesn't retain what I would consider critical links, despite the instruction stating to do so.

@jeffpaul
Copy link
Member

One thing I think could improve the experience would be to add a direct comparison UI, perhaps render the original content in the modal so editors can see both side by side? Open to your thoughts here.

Yeah, that could be nice, perhaps noting the +/- on characters/words as well?

Also might need some improvement on the system-instruction.php. It works as is, but sometimes the model doesn't retain what I would consider critical links, despite the instruction stating to do so.

@Sidsector9 I know you've done work on this elsewhere, any advice on how to best retain that content/context?

@jeffpaul
Copy link
Member

  1. If we're able to update from the sparkle icon to the plugin icon in the block toolbar, that might be slightly better:
Screenshot 2026-03-23 at 2 36 49 PM

https://github.com/WordPress/ai/blob/develop/.wordpress-org/icon.svg

  1. Let's update Retry to Regenerate to match other similar buttons in the plugin

  2. We can probably get rid of the Discard button in the modal as the X in the upper right effectively does the same

@jeffpaul jeffpaul added this to the 0.7.0 milestone Mar 23, 2026
@jeffpaul jeffpaul requested review from dkotter and jeffpaul March 23, 2026 19:42
@TylerB24890
Copy link
Author

@jeffpaul

If we're able to update from the sparkle icon to the plugin icon in the block toolbar, that might be slightly better

I created a variation of the plugin icon for the toolbar:
Screenshot 2026-03-24 at 1 02 58 PM

Let me know if you were envisioning something different.

Let's update Retry to Regenerate to match other similar buttons in the plugin

Done.

We can probably get rid of the Discard button in the modal as the X in the upper right effectively does the same

Done.

What's left:

  • Need to add the original text to the modal still (including +/- word count)
  • E2E tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Experiment: Content Resizing

2 participants