added shortcut for addLink (ctrl+k) (#921)

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-07 17:21:02 +01:00 committed by GitHub
parent 4459dc742f
commit 45cd5a9b89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -57,9 +57,10 @@ SPDX-License-Identifier: CC-BY-SA-4.0
- Code blocks have a 'Copy code to clipboard' button.
- Code blocks with 'vega-lite' as language are rendered as [vega-lite diagrams](https://vega.github.io/vega-lite/examples/).
- Markdown files can be imported into an existing note directly from the editor.
- The table button in the toolbar opens an overlay where the user can choose the number of columns and rows
- The table button in the toolbar opens an overlay where the user can choose the number of columns and rows.
- A toggle in the editor preferences for turning ligatures on and off.
- Easier possibility to share notes via native share-buttons on supported devices.
- Surround selected text with a link via shortcut (ctrl+k or cmd+k).
### Changed

View file

@ -195,6 +195,7 @@
"underline": "Underline selection",
"strikethrough": "Strike selection through",
"mark": "Mark selection",
"link": "Add link around selection",
"view": "Show only View",
"both": "Show View and Edit",
"edit": "Show only Edit"

View file

@ -24,7 +24,8 @@ export const Shortcut: React.FC = () => {
'editor.help.shortcuts.italic': [modifierKey, <> + </>, <kbd>I</kbd>],
'editor.help.shortcuts.underline': [modifierKey, <> + </>, <kbd>U</kbd>],
'editor.help.shortcuts.strikethrough': [modifierKey, <> + </>, <kbd>D</kbd>],
'editor.help.shortcuts.mark': [modifierKey, <> + </>, <kbd>M</kbd>]
'editor.help.shortcuts.mark': [modifierKey, <> + </>, <kbd>M</kbd>],
'editor.help.shortcuts.link': [modifierKey, <> + </>, <kbd>K</kbd>]
}
}
return (

View file

@ -7,6 +7,7 @@
import CodeMirror, { Editor, KeyMap, Pass } from 'codemirror'
import { isMac } from '../utils'
import {
addLink,
makeSelectionBold,
makeSelectionItalic,
markSelection,
@ -81,7 +82,8 @@ export const defaultKeyMap: KeyMap = !isMac
'Ctrl-B': makeSelectionBold,
'Ctrl-U': underlineSelection,
'Ctrl-D': strikeThroughSelection,
'Ctrl-M': markSelection
'Ctrl-M': markSelection,
'Ctrl-K': addLink
}
: {
F9: suppressKey,