From 953d9a116386bff36dbb27ddee76551b4b8fae65 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 23 Feb 2023 11:50:58 +0000 Subject: [PATCH] Revert "Move Link Control action buttons into lower area (#47309)" This reverts commit e6059372fee79ca56e5d917ef3c20525131e619a. --- .../src/components/link-control/index.js | 53 ++++++++----------- .../src/components/link-control/style.scss | 4 +- .../specs/editor/various/links.test.js | 10 ++-- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index 73e2f6bb8e0e1d..d6155045656f5c 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -274,7 +274,6 @@ function LinkControl( { // See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927. const showTextControl = hasLinkValue && hasTextControl; - const isEditing = ( isEditingLink || ! value ) && ! isCreatingPage; return (
) } - { isEditing && ( + { ( isEditingLink || ! value ) && ! isCreatingPage && ( <>
) } - - ) } - - { value && ! isEditingLink && ! isCreatingPage && ( - setIsEditingLink( true ) } - hasRichPreviews={ hasRichPreviews } - hasUnlinkControl={ shownUnlinkControl } - onRemove={ onRemove } - /> - ) } - -
- { showSettingsDrawer && ( -
- -
- ) } - - { isEditing && (
- ) } -
+ + ) } + + { value && ! isEditingLink && ! isCreatingPage && ( + setIsEditingLink( true ) } + hasRichPreviews={ hasRichPreviews } + hasUnlinkControl={ shownUnlinkControl } + onRemove={ onRemove } + /> + ) } + { showSettingsDrawer && ( +
+ +
+ ) } { renderControlBottom && renderControlBottom() }
); diff --git a/packages/block-editor/src/components/link-control/style.scss b/packages/block-editor/src/components/link-control/style.scss index cadb0ce6340e28..51682a45c7c20b 100644 --- a/packages/block-editor/src/components/link-control/style.scss +++ b/packages/block-editor/src/components/link-control/style.scss @@ -79,6 +79,7 @@ $preview-image-height: 140px; display: flex; flex-direction: row-reverse; // put "Cancel" on the left but retain DOM order. justify-content: flex-start; + margin: $grid-unit-20; // allow margin collapse for vertical spacing. gap: $grid-unit-10; } @@ -426,10 +427,9 @@ $preview-image-height: 140px; padding: 10px; } -.block-editor-link-control__drawer { +.block-editor-link-control__tools { display: flex; align-items: center; - justify-content: space-between; border-top: $border-width solid $gray-300; margin: 0; padding: $grid-unit-20; diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js index 9ffbd6aa041ca7..449072dab1df09 100644 --- a/packages/e2e-tests/specs/editor/various/links.test.js +++ b/packages/e2e-tests/specs/editor/various/links.test.js @@ -121,6 +121,8 @@ describe( 'Links', () => { // Navigate to and toggle the "Open in new tab" checkbox. await page.keyboard.press( 'Tab' ); + await page.keyboard.press( 'Tab' ); + await page.keyboard.press( 'Tab' ); await page.keyboard.press( 'Space' ); // Toggle should still have focus and be checked. @@ -133,7 +135,8 @@ describe( 'Links', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); // Tab back to the Submit and apply the link. - await page.keyboard.press( 'Tab' ); + await pressKeyWithModifier( 'shift', 'Tab' ); + await pressKeyWithModifier( 'shift', 'Tab' ); await page.keyboard.press( 'Enter' ); // The link should have been inserted. @@ -526,6 +529,8 @@ describe( 'Links', () => { // Navigate to and toggle the "Open in new tab" checkbox. await page.keyboard.press( 'Tab' ); + await page.keyboard.press( 'Tab' ); + await page.keyboard.press( 'Tab' ); await page.keyboard.press( 'Space' ); // Confirm that focus was not prematurely returned to the paragraph on @@ -534,8 +539,7 @@ describe( 'Links', () => { // Close dialog. Expect that "Open in new tab" would have been applied // immediately. - - await pressKeyWithModifier( 'shift', 'Tab' ); + await page.keyboard.press( 'Tab' ); await page.keyboard.press( 'Enter' ); // Wait for Gutenberg to finish the job.