From 190a4941e23f8f4b706ab47631b402fe896e280c Mon Sep 17 00:00:00 2001 From: iseulde Date: Thu, 25 Apr 2019 19:47:02 +0200 Subject: [PATCH 1/3] Format Library: Remove secondary (access) shortcuts --- packages/format-library/src/code/index.js | 23 ++++++------------- packages/format-library/src/link/index.js | 10 -------- .../format-library/src/strikethrough/index.js | 23 ++++++------------- 3 files changed, 14 insertions(+), 42 deletions(-) diff --git a/packages/format-library/src/code/index.js b/packages/format-library/src/code/index.js index aaccbde3946f49..4eb3cfb1118ef8 100644 --- a/packages/format-library/src/code/index.js +++ b/packages/format-library/src/code/index.js @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { toggleFormat } from '@wordpress/rich-text'; -import { RichTextShortcut, RichTextToolbarButton } from '@wordpress/block-editor'; +import { RichTextToolbarButton } from '@wordpress/block-editor'; const name = 'core/code'; const title = __( 'Inline Code' ); @@ -17,21 +17,12 @@ export const code = { const onToggle = () => onChange( toggleFormat( value, { type: name } ) ); return ( - <> - - - + ); }, }; diff --git a/packages/format-library/src/link/index.js b/packages/format-library/src/link/index.js index 913285f2e8b0f3..f68d4932f62420 100644 --- a/packages/format-library/src/link/index.js +++ b/packages/format-library/src/link/index.js @@ -71,16 +71,6 @@ export const link = { return ( <> - - onChange( toggleFormat( value, { type: name } ) ); return ( - <> - - - + ); }, }; From 3778a0519b3b282179db468b50c46089ccde5cb4 Mon Sep 17 00:00:00 2001 From: iseulde Date: Thu, 25 Apr 2019 20:04:58 +0200 Subject: [PATCH 2/3] Update help modal --- .../keyboard-shortcut-help-modal/config.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/edit-post/src/components/keyboard-shortcut-help-modal/config.js b/packages/edit-post/src/components/keyboard-shortcut-help-modal/config.js index 5c6037c0467f4b..340efee1c5d55d 100644 --- a/packages/edit-post/src/components/keyboard-shortcut-help-modal/config.js +++ b/packages/edit-post/src/components/keyboard-shortcut-help-modal/config.js @@ -132,10 +132,6 @@ const textFormattingShortcuts = { keyCombination: primary( 'i' ), description: __( 'Make the selected text italic.' ), }, - { - keyCombination: primary( 'u' ), - description: __( 'Underline the selected text.' ), - }, { keyCombination: primary( 'k' ), description: __( 'Convert the selected text into a link.' ), @@ -145,12 +141,8 @@ const textFormattingShortcuts = { description: __( 'Remove a link.' ), }, { - keyCombination: access( 'd' ), - description: __( 'Add a strikethrough to the selected text.' ), - }, - { - keyCombination: access( 'x' ), - description: __( 'Display the selected text in a monospaced font.' ), + keyCombination: primary( 'u' ), + description: __( 'Underline the selected text.' ), }, ], }; From 73200566e6f69c5134a904ad684518e950a5bbee Mon Sep 17 00:00:00 2001 From: iseulde Date: Wed, 1 May 2019 13:16:03 +0200 Subject: [PATCH 3/3] Fix tests --- .../__snapshots__/rich-text.test.js.snap | 6 ----- packages/e2e-tests/specs/rich-text.test.js | 9 ------- .../test/__snapshots__/index.js.snap | 26 +++---------------- 3 files changed, 3 insertions(+), 38 deletions(-) diff --git a/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap b/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap index 8aab0dcd5b734b..3c7044b5fb8053 100644 --- a/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap +++ b/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap @@ -6,12 +6,6 @@ exports[`RichText should apply formatting when selection is collapsed 1`] = ` " `; -exports[`RichText should apply formatting with access shortcut 1`] = ` -" -

test

-" -`; - exports[`RichText should apply formatting with primary shortcut 1`] = ` "

test

diff --git a/packages/e2e-tests/specs/rich-text.test.js b/packages/e2e-tests/specs/rich-text.test.js index 1bd6d79c1b10fc..6dce07f78146ca 100644 --- a/packages/e2e-tests/specs/rich-text.test.js +++ b/packages/e2e-tests/specs/rich-text.test.js @@ -27,15 +27,6 @@ describe( 'RichText', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); - it( 'should apply formatting with access shortcut', async () => { - await clickBlockAppender(); - await page.keyboard.type( 'test' ); - await pressKeyWithModifier( 'primary', 'a' ); - await pressKeyWithModifier( 'access', 'd' ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); - it( 'should apply formatting with primary shortcut', async () => { await clickBlockAppender(); await page.keyboard.type( 'test' ); diff --git a/packages/edit-post/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap index fe522a985d3b9a..e08b7e6501cdcb 100644 --- a/packages/edit-post/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap @@ -235,14 +235,6 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ "I", ], }, - Object { - "description": "Underline the selected text.", - "keyCombination": Array [ - "Ctrl", - "+", - "U", - ], - }, Object { "description": "Convert the selected text into a link.", "keyCombination": Array [ @@ -262,23 +254,11 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ ], }, Object { - "description": "Add a strikethrough to the selected text.", - "keyCombination": Array [ - "Shift", - "+", - "Alt", - "+", - "D", - ], - }, - Object { - "description": "Display the selected text in a monospaced font.", + "description": "Underline the selected text.", "keyCombination": Array [ - "Shift", - "+", - "Alt", + "Ctrl", "+", - "X", + "U", ], }, ]