diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0414738..35a392575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/public/locales/en.json b/public/locales/en.json index b81b22681..23c748d7a 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -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" diff --git a/src/components/editor/app-bar/help-button/shortcuts.tsx b/src/components/editor/app-bar/help-button/shortcuts.tsx index 6190d60bf..93d0c1a4e 100644 --- a/src/components/editor/app-bar/help-button/shortcuts.tsx +++ b/src/components/editor/app-bar/help-button/shortcuts.tsx @@ -24,7 +24,8 @@ export const Shortcut: React.FC = () => { 'editor.help.shortcuts.italic': [modifierKey, <> + , I], 'editor.help.shortcuts.underline': [modifierKey, <> + , U], 'editor.help.shortcuts.strikethrough': [modifierKey, <> + , D], - 'editor.help.shortcuts.mark': [modifierKey, <> + , M] + 'editor.help.shortcuts.mark': [modifierKey, <> + , M], + 'editor.help.shortcuts.link': [modifierKey, <> + , K] } } return ( diff --git a/src/components/editor/editor-pane/key-map.ts b/src/components/editor/editor-pane/key-map.ts index 28ab8b861..124478c1a 100644 --- a/src/components/editor/editor-pane/key-map.ts +++ b/src/components/editor/editor-pane/key-map.ts @@ -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,