Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format Library: Remove secondary (access) shortcuts #15191

Merged
merged 3 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ exports[`RichText should apply formatting when selection is collapsed 1`] = `
<!-- /wp:paragraph -->"
`;

exports[`RichText should apply formatting with access shortcut 1`] = `
"<!-- wp:paragraph -->
<p><s>test</s></p>
<!-- /wp:paragraph -->"
`;

exports[`RichText should apply formatting with primary shortcut 1`] = `
"<!-- wp:paragraph -->
<p><strong>test</strong></p>
Expand Down
9 changes: 0 additions & 9 deletions packages/e2e-tests/specs/rich-text.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.' ),
Expand All @@ -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.' ),
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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",
],
},
]
Expand Down
23 changes: 7 additions & 16 deletions packages/format-library/src/code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand All @@ -17,21 +17,12 @@ export const code = {
const onToggle = () => onChange( toggleFormat( value, { type: name } ) );

return (
<>
<RichTextShortcut
type="access"
character="x"
onUse={ onToggle }
/>
<RichTextToolbarButton
icon="editor-code"
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="access"
shortcutCharacter="x"
/>
</>
<RichTextToolbarButton
icon="editor-code"
title={ title }
onClick={ onToggle }
isActive={ isActive }
/>
);
},
};
10 changes: 0 additions & 10 deletions packages/format-library/src/link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@ export const link = {

return (
<>
<RichTextShortcut
type="access"
character="a"
onUse={ this.addLink }
/>
<RichTextShortcut
type="access"
character="s"
onUse={ this.onRemoveFormat }
/>
<RichTextShortcut
type="primary"
character="k"
Expand Down
23 changes: 7 additions & 16 deletions packages/format-library/src/strikethrough/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { toggleFormat } from '@wordpress/rich-text';
import { RichTextToolbarButton, RichTextShortcut } from '@wordpress/block-editor';
import { RichTextToolbarButton } from '@wordpress/block-editor';

const name = 'core/strikethrough';
const title = __( 'Strikethrough' );
Expand All @@ -17,21 +17,12 @@ export const strikethrough = {
const onToggle = () => onChange( toggleFormat( value, { type: name } ) );

return (
<>
<RichTextShortcut
type="access"
character="d"
onUse={ onToggle }
/>
<RichTextToolbarButton
icon="editor-strikethrough"
title={ title }
onClick={ onToggle }
isActive={ isActive }
shortcutType="access"
shortcutCharacter="d"
/>
</>
<RichTextToolbarButton
icon="editor-strikethrough"
title={ title }
onClick={ onToggle }
isActive={ isActive }
/>
);
},
};