Skip to content

Edit as HTML: Add a modal to edit block HTML in a larger editor - #85392

Open
dhruvikpatel18 wants to merge 3 commits into
WordPress:trunkfrom
dhruvikpatel18:add/edit-as-html-modal
Open

dhruvikpatel18 wants to merge 3 commits into
WordPress:trunkfrom
dhruvikpatel18:add/edit-as-html-modal

Conversation

@dhruvikpatel18

Copy link
Copy Markdown
Member

What?

Closes #41056

Adds an "Expand HTML editor" button to the block toolbar while a block is being edited as HTML. It opens the block's HTML in a large "Edit HTML" modal, with Update and Cancel actions. The existing inline HTML editor is unchanged.

Why?

The inline "Edit as HTML" textarea is only as wide as the block. In a narrow block, such as a 25% column, the markup wraps into a tall strip a few words wide, and long URLs and attributes break across many lines. That makes the markup hard to read and edit.

The Custom HTML block already solved the same problem with a modal editor (#73108). This brings that approach to "Edit as HTML" for every block that supports HTML editing.

Testing Instructions

  1. Open a post and add a Columns block with the 25 / 75 layout.
  2. In the narrow column, add a Paragraph with a link and some bold text.
  3. Select the paragraph, open the block Options menu (⋮) and choose "Edit as HTML". Note how narrow the inline HTML editor is.
  4. In the block toolbar, click "Expand HTML editor" (the icon button next to "Edit visually").
  5. Confirm the "Edit HTML" modal opens with the block's HTML, at full dialog width, with the cursor in the textarea.
  6. Change the HTML and click Cancel. Confirm the block is unchanged.
  7. Open the modal again, change the HTML (for example, wrap a word in <em>), and click Update. Confirm the inline HTML editor shows the new markup.
  8. Click "Edit visually" and confirm the change appears in the block.
  9. Open the modal, enter markup that doesn't match the block (for example, change <p> to <div>), and click Update. Confirm the block shows the same invalid content warning that the inline editor gives.
  10. Repeat on a small viewport. The modal opens as a bottom sheet and Update and Cancel work.

Screenshots or screencast

Before After
Screen.Recording.2026-10-22.at.10.30.33.AM.mov
Screen.Recording.2026-10-22.at.6.44.20.PM.mov

Use of AI Tools

Implemented with assistance of Claude Code.

@dhruvikpatel18 dhruvikpatel18 self-assigned this Oct 22, 2026
@github-actions github-actions Bot added [Package] Block editor /packages/block-editor [Package] Base styles /packages/base-styles labels Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @jdcohan, @SergeGusev.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: jdcohan, SergeGusev.

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@dhruvikpatel18 dhruvikpatel18 added [Type] Enhancement A suggestion for improvement. General Interface Parts of the UI which don't fall neatly under other labels. labels Oct 22, 2026
@dhruvikpatel18
dhruvikpatel18 marked this pull request as ready for review October 22, 2026 13:23

This branch has not been deployed

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

Labels

General Interface Parts of the UI which don't fall neatly under other labels. [Package] Base styles /packages/base-styles [Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit as HTML in a popup window

1 participant