mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-18 20:49:36 +01:00
editor: Add keybindings for highlighting the currently selected text (#8577)
* editor: Add keybindings for highlighting the currently selected text Signed-off-by: Sudlon <sudlondon@outlook.com> * editor: Change keybinding command to TipTap "syntax" Signed-off-by: Sudlon <sudlondon@outlook.com> * editor: Remove SHIFT-keybinding (leaving ALT-keybinding) for highlighting currently selected text Signed-off-by: Sudlon sudlondon@outlook.com * editor: Remove left-over references to the double keybinding for highlighting currently selected text Signed-off-by: Sudlon sudlondon@outlook.com --------- Signed-off-by: Sudlon <sudlondon@outlook.com> Signed-off-by: Sudlon sudlondon@outlook.com Co-authored-by: sudlon <sudlondon@outlook.com>
This commit is contained in:
@@ -10,7 +10,7 @@ The following keyboard shortcuts will help you navigate Notesnook faster.
|
|||||||
### General
|
### General
|
||||||
|
|
||||||
| Description | Web | Windows/Linux | Mac |
|
| Description | Web | Windows/Linux | Mac |
|
||||||
| --- | --- | --- | --- |
|
| -------------------------------------------------- | ------ | ------------- | --- |
|
||||||
| Search in notes list view if editor is not focused | Ctrl F | Ctrl F | ⌘ F |
|
| Search in notes list view if editor is not focused | Ctrl F | Ctrl F | ⌘ F |
|
||||||
| Settings | Ctrl , | Ctrl , | ⌘ , |
|
| Settings | Ctrl , | Ctrl , | ⌘ , |
|
||||||
| Keyboard shortcuts | Ctrl / | Ctrl / | ⌘ / |
|
| Keyboard shortcuts | Ctrl / | Ctrl / | ⌘ / |
|
||||||
@@ -19,7 +19,7 @@ The following keyboard shortcuts will help you navigate Notesnook faster.
|
|||||||
### Navigation
|
### Navigation
|
||||||
|
|
||||||
| Description | Web | Windows/Linux | Mac |
|
| Description | Web | Windows/Linux | Mac |
|
||||||
| --- | --- | --- | --- |
|
| ---------------- | ------------------------- | ------------- | ------- |
|
||||||
| Next tab | Ctrl Alt → / Ctrl Alt ⇧ → | Ctrl tab | ⌘ tab |
|
| Next tab | Ctrl Alt → / Ctrl Alt ⇧ → | Ctrl tab | ⌘ tab |
|
||||||
| Previous tab | Ctrl Alt ← / Ctrl Alt ⇧ ← | Ctrl ⇧ tab | ⌘ ⇧ tab |
|
| Previous tab | Ctrl Alt ← / Ctrl Alt ⇧ ← | Ctrl ⇧ tab | ⌘ ⇧ tab |
|
||||||
| Command palette | Ctrl ⇧ P | Ctrl ⇧ P | ⌘ ⇧ P |
|
| Command palette | Ctrl ⇧ P | Ctrl ⇧ P | ⌘ ⇧ P |
|
||||||
@@ -31,7 +31,7 @@ The following keyboard shortcuts will help you navigate Notesnook faster.
|
|||||||
### Editor
|
### Editor
|
||||||
|
|
||||||
| Description | Web | Windows/Linux | Mac |
|
| Description | Web | Windows/Linux | Mac |
|
||||||
| --- | --- | --- | --- |
|
| ---------------------------------- | ----------------- | ----------------- | ----------- |
|
||||||
| Add attachment | Ctrl ⇧ A | Ctrl ⇧ A | ⌘ ⇧ A |
|
| Add attachment | Ctrl ⇧ A | Ctrl ⇧ A | ⌘ ⇧ A |
|
||||||
| Insert blockquote | Ctrl ⇧ B | Ctrl ⇧ B | ⌘ ⇧ B |
|
| Insert blockquote | Ctrl ⇧ B | Ctrl ⇧ B | ⌘ ⇧ B |
|
||||||
| Toggle bold | Ctrl B | Ctrl B | ⌘ B |
|
| Toggle bold | Ctrl B | Ctrl B | ⌘ B |
|
||||||
@@ -76,3 +76,4 @@ The following keyboard shortcuts will help you navigate Notesnook faster.
|
|||||||
| Text align left | Ctrl ⇧ L | Ctrl ⇧ L | ⌘ ⇧ L |
|
| Text align left | Ctrl ⇧ L | Ctrl ⇧ L | ⌘ ⇧ L |
|
||||||
| Text align right | Ctrl ⇧ R | Ctrl ⇧ R | ⌘ ⇧ R |
|
| Text align right | Ctrl ⇧ R | Ctrl ⇧ R | ⌘ ⇧ R |
|
||||||
| Underline | Ctrl U | Ctrl U | ⌘ U |
|
| Underline | Ctrl U | Ctrl U | ⌘ U |
|
||||||
|
| Toggle highlight | Ctrl Alt H | Ctrl Alt H | ⌘ ⌥ H |
|
||||||
|
|||||||
@@ -388,6 +388,12 @@ export const tiptapKeys = {
|
|||||||
description: "Underline",
|
description: "Underline",
|
||||||
category: "Editor",
|
category: "Editor",
|
||||||
type: "tiptap"
|
type: "tiptap"
|
||||||
|
},
|
||||||
|
toggleHighlight: {
|
||||||
|
keys: "Mod-Alt-h",
|
||||||
|
description: "Toggle highlight",
|
||||||
|
category: "Editor",
|
||||||
|
type: "tiptap"
|
||||||
}
|
}
|
||||||
} satisfies Record<string, TipTapKey>;
|
} satisfies Record<string, TipTapKey>;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
import "@tiptap/extension-text-style";
|
import "@tiptap/extension-text-style";
|
||||||
import { Extension } from "@tiptap/core";
|
import { Extension } from "@tiptap/core";
|
||||||
|
import { config } from "../../utils/config.js";
|
||||||
|
import { tiptapKeys } from "@notesnook/common";
|
||||||
|
|
||||||
export interface HighlightOptions {
|
export interface HighlightOptions {
|
||||||
types: string[];
|
types: string[];
|
||||||
@@ -99,11 +101,16 @@ export const Highlight = Extension.create<HighlightOptions>({
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
// addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
// return {
|
return {
|
||||||
// "Mod-Shift-h": () => this.editor.commands.toggleHighlight(),
|
[tiptapKeys.toggleHighlight.keys]: () =>
|
||||||
// };
|
this.editor.commands.toggleHighlight(getCurrentHighlightColor())
|
||||||
// },
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getCurrentHighlightColor() {
|
||||||
|
return config.get<"string">("highlight") || "yellow";
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user