mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-04 06:31:35 +08:00
refactor(client): define context menu shortcuts in separate field
This commit is contained in:
parent
a037f95ff1
commit
ea8e98b8ef
@ -103,6 +103,10 @@ class ContextMenu {
|
|||||||
.append(" ") // some space between icon and text
|
.append(" ") // some space between icon and text
|
||||||
.append(item.title);
|
.append(item.title);
|
||||||
|
|
||||||
|
if (item.shortcut) {
|
||||||
|
$link.append($("<kbd>").text(item.shortcut));
|
||||||
|
}
|
||||||
|
|
||||||
const $item = $("<li>")
|
const $item = $("<li>")
|
||||||
.addClass("dropdown-item")
|
.addClass("dropdown-item")
|
||||||
.append($link)
|
.append($link)
|
||||||
|
@ -39,7 +39,8 @@ function setupContextMenu() {
|
|||||||
if (params.isEditable) {
|
if (params.isEditable) {
|
||||||
items.push({
|
items.push({
|
||||||
enabled: editFlags.canCut && hasText,
|
enabled: editFlags.canCut && hasText,
|
||||||
title: `Cut <kbd>${platformModifier}+X`,
|
title: `Cut`,
|
||||||
|
shortcut: `${platformModifier}+X`,
|
||||||
uiIcon: "bx bx-cut",
|
uiIcon: "bx bx-cut",
|
||||||
handler: () => webContents.cut()
|
handler: () => webContents.cut()
|
||||||
});
|
});
|
||||||
@ -48,7 +49,8 @@ function setupContextMenu() {
|
|||||||
if (params.isEditable || hasText) {
|
if (params.isEditable || hasText) {
|
||||||
items.push({
|
items.push({
|
||||||
enabled: editFlags.canCopy && hasText,
|
enabled: editFlags.canCopy && hasText,
|
||||||
title: `Copy <kbd>${platformModifier}+C`,
|
title: `Copy`,
|
||||||
|
shortcut: `${platformModifier}+C`,
|
||||||
uiIcon: "bx bx-copy",
|
uiIcon: "bx bx-copy",
|
||||||
handler: () => webContents.copy()
|
handler: () => webContents.copy()
|
||||||
});
|
});
|
||||||
@ -70,7 +72,8 @@ function setupContextMenu() {
|
|||||||
if (params.isEditable) {
|
if (params.isEditable) {
|
||||||
items.push({
|
items.push({
|
||||||
enabled: editFlags.canPaste,
|
enabled: editFlags.canPaste,
|
||||||
title: `Paste <kbd>${platformModifier}+V`,
|
title: `Paste`,
|
||||||
|
shortcut: `${platformModifier}+V`,
|
||||||
uiIcon: "bx bx-paste",
|
uiIcon: "bx bx-paste",
|
||||||
handler: () => webContents.paste()
|
handler: () => webContents.paste()
|
||||||
});
|
});
|
||||||
@ -79,7 +82,8 @@ function setupContextMenu() {
|
|||||||
if (params.isEditable) {
|
if (params.isEditable) {
|
||||||
items.push({
|
items.push({
|
||||||
enabled: editFlags.canPaste,
|
enabled: editFlags.canPaste,
|
||||||
title: `Paste as plain text <kbd>${platformModifier}+Shift+V`,
|
title: `Paste as plain text`,
|
||||||
|
shortcut: `${platformModifier}+Shift+V`,
|
||||||
uiIcon: "bx bx-paste",
|
uiIcon: "bx bx-paste",
|
||||||
handler: () => webContents.pasteAndMatchStyle()
|
handler: () => webContents.pasteAndMatchStyle()
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user