From b66e6f4d02a25a769e3583d0f9457fc7415fba55 Mon Sep 17 00:00:00 2001 From: rjvelazco Date: Tue, 30 Jun 2026 10:50:38 -0400 Subject: [PATCH 1/8] fix(block-editor): apply links to a selected image instead of replacing it (#36361) In the new block editor, selecting an image and clicking the toolbar Link button deleted the image and replaced it with a text link. The image node already supports href/target attributes end-to-end; the break was purely in the UI flow, which always routed through the text-link insert path. - Toolbar Link button now detects a selected dotImage and opens the link popover in image-link mode (URL + open-in-new-tab only; no Text/Advanced), applying the link via updateAttributes('dotImage') so the image is preserved. - Add a Remove-link (trash) action when editing an image that already has a link. - Clicking a linked image no longer opens the text-link editor; it selects the image node (link is edited from the toolbar) and prevents navigation. - Fix layout jump/extra margin when a link wraps the image: zero the inline-block baseline gap and the Tailwind Typography img margin that returns once the image is no longer a direct figure child. - Toolbar Link button reflects an active state for linked images (isImageLinked), mirroring isLink for text links. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../link-popover/link-popover.component.html | 75 ++++++++++++------- .../link-popover/link-popover.component.ts | 37 +++++++++ .../toolbar/editor-toolbar.store.ts | 6 ++ .../components/toolbar/toolbar.component.html | 2 +- .../components/toolbar/toolbar.component.ts | 14 ++++ .../src/lib/editor/editor-chrome-click.ts | 9 +++ .../src/lib/editor/editor.component.css | 16 ++++ .../editor/services/editor-popover.service.ts | 6 ++ .../WEB-INF/messages/Language.properties | 1 + 9 files changed, 136 insertions(+), 30 deletions(-) diff --git a/core-web/libs/new-block-editor/src/lib/editor/components/link-popover/link-popover.component.html b/core-web/libs/new-block-editor/src/lib/editor/components/link-popover/link-popover.component.html index d10c24959161..950425a90aeb 100644 --- a/core-web/libs/new-block-editor/src/lib/editor/components/link-popover/link-popover.component.html +++ b/core-web/libs/new-block-editor/src/lib/editor/components/link-popover/link-popover.component.html @@ -75,22 +75,24 @@ -
- - -
+ @if (!isImageLink()) { +
+ + +
+ } - + @if (!isImageLink()) { + + } - @if (advancedOpen()) { + @if (!isImageLink() && advancedOpen()) {