From 39c39862b4fc55a245c9fa91076afc11e0bafaac Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Thu, 24 Sep 2020 14:46:11 +0200 Subject: [PATCH] add keyboard shortcuts to the api, remove best practices section --- docs/src/docPages/api/keyboard-shortcuts.md | 75 +++++++++++++++++++ .../best-practices/keyboard-shortcuts.md | 68 ----------------- docs/src/docPages/best-practices/menus.md | 1 - docs/src/docPages/best-practices/overview.md | 1 - docs/src/links.yaml | 12 +-- packages/extension-bullet-list/index.ts | 2 +- packages/extension-code-block/index.ts | 2 +- packages/extension-ordered-list/index.ts | 2 +- 8 files changed, 79 insertions(+), 84 deletions(-) create mode 100644 docs/src/docPages/api/keyboard-shortcuts.md delete mode 100644 docs/src/docPages/best-practices/keyboard-shortcuts.md delete mode 100644 docs/src/docPages/best-practices/menus.md delete mode 100644 docs/src/docPages/best-practices/overview.md diff --git a/docs/src/docPages/api/keyboard-shortcuts.md b/docs/src/docPages/api/keyboard-shortcuts.md new file mode 100644 index 00000000..74fe2379 --- /dev/null +++ b/docs/src/docPages/api/keyboard-shortcuts.md @@ -0,0 +1,75 @@ +# Keyboard Shortcuts +Keyboard shortcuts may be strings like `Shift-Control-Enter`. Keys are based on the strings that can appear in `event.key`. There is a little tool called [keycode.info](https://keycode.info/), which shows the `event.key` interactively. Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held). You may use `Space` as an alias for the   name. + +Modifiers can be given in any order. `Shift-`, `Alt-`, `Control-` and `Cmd-` are recognized. For characters that are created by holding shift, the `Shift-` prefix is implied, and should not be added explicitly. + +You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Control-` on other platforms. + +Tiptap and all of its extensions come with predefined keyboard shortcuts. + +## Essentials +| Action | Windows/Linux | macOS | +| ------------------------ | ------------- | ----- | +| Copy | ⌃C | ⌘C | +| Cut | ⌃X | ⌘X | +| Paste | ⌃V | ⌘V | +| Paste without formatting | ⌃⇧V | ⌘⇧V | +| Undo | ⌃Z | ⌘Z | +| Redo | ⌃⇧Z | ⌘⇧Z | +| Insert or edit link | ⌃K | ⌘K | +| Open link | ⌥↩ | ⌥↩ | +| Find | ⌃F | ⌘F | +| Find and replace | ⌃H | ⌘⇧H | +| Find again | ⌃G | ⌘G | +| Find previous | ⌃⇧G | ⌘⇧G | +| Repeat last action | ⌃Y | ⌘Y | +| Add a line break | ⇧↩ | ⇧↩ | + +## Text Formatting +| Action | Windows/Linux | macOS | +| --------------------- | ------------- | ----- | +| Bold | ⌃B | ⌘B | +| Italicize | ⌃I | ⌘I | +| Underline | ⌃U | ⌘U | +| Strikethrough | ⌥⇧5 | ⌘⇧X | +| Superscript | ⌃. | ⌘. | +| Subscript | ⌃, | ⌘, | +| Copy text formatting | ⌃⌥C | ⌘⌥C | +| Paste text formatting | ⌃⌥V | ⌘⌥V | +| Clear text formatting | ⌃\
⌃Space | ⌘\ | +| Increase font size | ⌃⇧> | ⌘⇧> | +| Decrease font size | ⌃⇧< | ⌘⇧< | + +## Paragraph Formatting +| Action | Windows/Linux | macOS | +| ------------------------------ | ------------- | ----- | +| Increase paragraph indentation | ⌃] | ⌘] | +| Decrease paragraph indentation | ⌃[ | ⌘[ | +| Apply normal text style | ⌃⌥0 | ⌘⌥0 | +| Apply heading style 1 | ⌃⌥1 | ⌘⌥1 | +| Apply heading style 2 | ⌃⌥2 | ⌘⌥2 | +| Apply heading style 3 | ⌃⌥3 | ⌘⌥3 | +| Apply heading style 4 | ⌃⌥4 | ⌘⌥4 | +| Apply heading style 5 | ⌃⌥5 | ⌘⌥5 | +| Apply heading style 6 | ⌃⌥6 | ⌘⌥6 | +| Left align | ⌃⇧L | ⌘⇧L | +| Center align | ⌃⇧E | ⌘⇧E | +| Right align | ⌃⇧R | ⌘⇧R | +| Justify | ⌃⇧J | ⌘⇧J | +| Numbered list | ⌃⇧7 | ⌘⇧7 | +| Bulleted list | ⌃⇧8 | ⌘⇧8 | +| Move paragraph up | ⌃⇧↑ | ⌃⇧↑ | +| Move paragraph down | ⌃⇧↓ | ⌃⇧↓ | + +## Text Selection +| Action | Windows/Linux | macOS | +| ------------------------------------------------- | ------------- | ----- | +| Select all | ⌃A | ⌘A | +| Extend selection one character to left | ⇧← | ⇧← | +| Extend selection one character to right | ⇧→ | ⇧→ | +| Extend selection one line up | ⇧↑ | ⇧↑ | +| Extend selection one line down | ⇧↓ | ⇧↓ | +| Extend selection one paragraph up | ⌥⇧↑ | ⌥⇧↑ | +| Extend selection one paragraph down | ⌥⇧↓ | ⌥⇧↓ | +| Extend selection to the beginning of the document | ⌃⇧↑ | ⌘⇧↑ | +| Extend selection to the end of the document | ⌃⇧↓ | ⌘⇧↓ | diff --git a/docs/src/docPages/best-practices/keyboard-shortcuts.md b/docs/src/docPages/best-practices/keyboard-shortcuts.md deleted file mode 100644 index e2118d36..00000000 --- a/docs/src/docPages/best-practices/keyboard-shortcuts.md +++ /dev/null @@ -1,68 +0,0 @@ -# Keyboard Shortcuts - -## Essentials -| Action | Google Docs | -| ------------------------ | ----------- | -| Copy | ⌘C | -| Cut | ⌘X | -| Paste | ⌘V | -| Paste without formatting | ⌘⇧V | -| Undo | ⌘Z | -| Redo | ⌘⇧Z | -| Insert or edit link | ⌘K | -| Open link | ⌥↩ | -| Find | ⌘F | -| Find and replace | ⌘⇧H | -| Find again | ⌘G | -| Find previous | ⌘⇧G | -| Repeat last action | ⌘Y | -| Add a line break | ⇧↩ | - -## Text Formatting -| Action | Google Docs | -| --------------------- | ----------- | -| Bold | ⌘B | -| Italicize | ⌘I | -| Underline | ⌘U | -| Strikethrough | ⌘⇧X | -| Superscript | ⌘. | -| Subscript | ⌘, | -| Copy text formatting | ⌘⌥C | -| Paste text formatting | ⌘⌥V | -| Clear text formatting | ⌘\ | -| Increase font size | ⌘⇧> | -| Decrease font size | ⌘⇧< | - -## Paragraph Formatting -| Action | Google Docs | -| ------------------------------ | ----------- | -| Increase paragraph indentation | ⌘] | -| Decrease paragraph indentation | ⌘[ | -| Apply normal text style | ⌘⌥0 | -| Apply heading style 1 | ⌘⌥1 | -| Apply heading style 2 | ⌘⌥2 | -| Apply heading style 3 | ⌘⌥3 | -| Apply heading style 4 | ⌘⌥4 | -| Apply heading style 5 | ⌘⌥5 | -| Apply heading style 6 | ⌘⌥6 | -| Left align | ⌘⇧L | -| Center align | ⌘⇧E | -| Right align | ⌘⇧R | -| Justify | ⌘⇧J | -| Numbered list | ⌘⇧7 | -| Bulleted list | ⌘⇧8 | -| Move paragraph up | ⌃⇧↑ | -| Move paragraph down | ⌃⇧↓ | - -## Text Selection -| Action | Google Docs | -| ------------------------------------------------- | ----------- | -| Select all | ⌘A | -| Extend selection one character to left | ⇧← | -| Extend selection one character to right | ⇧→ | -| Extend selection one line up | ⇧↑ | -| Extend selection one line down | ⇧↓ | -| Extend selection one paragraph up | ⌥⇧↑ | -| Extend selection one paragraph down | ⌥⇧↓ | -| Extend selection to the beginning of the document | ⌘⇧↑ | -| Extend selection to the end of the document | ⌘⇧↓ | \ No newline at end of file diff --git a/docs/src/docPages/best-practices/menus.md b/docs/src/docPages/best-practices/menus.md deleted file mode 100644 index 97a2bc33..00000000 --- a/docs/src/docPages/best-practices/menus.md +++ /dev/null @@ -1 +0,0 @@ -# Menus \ No newline at end of file diff --git a/docs/src/docPages/best-practices/overview.md b/docs/src/docPages/best-practices/overview.md deleted file mode 100644 index 4bba659e..00000000 --- a/docs/src/docPages/best-practices/overview.md +++ /dev/null @@ -1 +0,0 @@ -# Overview \ No newline at end of file diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 13cc80dc..9efce473 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -177,15 +177,5 @@ link: /api/schema/get-schema - title: generateHtml link: /api/schema/generate-html - -- title: Best Practices - items: - - title: Overview - link: /best-practices/overview/ - draft: true - - title: Menus - link: /best-practices/menus/ - draft: true - title: Keyboard Shortcuts - link: /best-practices/keyboard-shortcuts/ - draft: true \ No newline at end of file + link: /api/keyboard-shortcuts diff --git a/packages/extension-bullet-list/index.ts b/packages/extension-bullet-list/index.ts index 54949f12..e2f0fba2 100644 --- a/packages/extension-bullet-list/index.ts +++ b/packages/extension-bullet-list/index.ts @@ -25,7 +25,7 @@ export default new Node() }, })) .keys(({ editor }) => ({ - 'Shift-Ctrl-8': () => editor.bulletList(), + 'Shift-Control-8': () => editor.bulletList(), })) .inputRules(({ type }) => [ wrappingInputRule(/^\s*([-+*])\s$/, type), diff --git a/packages/extension-code-block/index.ts b/packages/extension-code-block/index.ts index 9358f1b5..87e388ab 100644 --- a/packages/extension-code-block/index.ts +++ b/packages/extension-code-block/index.ts @@ -29,7 +29,7 @@ export default new Node() }, })) .keys(({ editor }) => ({ - 'Shift-Ctrl-\\': () => editor.codeBlock(), + 'Shift-Control-\\': () => editor.codeBlock(), })) .inputRules(({ type }) => [ textblockTypeInputRule(/^```$/, type), diff --git a/packages/extension-ordered-list/index.ts b/packages/extension-ordered-list/index.ts index 797f80a8..14273ca2 100644 --- a/packages/extension-ordered-list/index.ts +++ b/packages/extension-ordered-list/index.ts @@ -38,7 +38,7 @@ export default new Node() }, })) .keys(({ editor }) => ({ - 'Shift-Ctrl-9': () => editor.orderedList(), + 'Shift-Control-9': () => editor.orderedList(), })) .inputRules(({ type }) => [ wrappingInputRule(