mirror of
https://github.com/heyman/heynote.git
synced 2025-08-17 18:11:12 +02:00
Use block aware "Select All" command in context menu and app menu
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const { app, Menu } = require("electron")
|
||||
import { OPEN_SETTINGS_EVENT, UNDO_EVENT, REDO_EVENT, MOVE_BLOCK_EVENT, DELETE_BLOCK_EVENT, CHANGE_BUFFER_EVENT } from '@/src/common/constants'
|
||||
import { OPEN_SETTINGS_EVENT, UNDO_EVENT, REDO_EVENT, MOVE_BLOCK_EVENT, DELETE_BLOCK_EVENT, CHANGE_BUFFER_EVENT, SELECT_ALL_EVENT } from '@/src/common/constants'
|
||||
import { openAboutWindow } from "./about";
|
||||
import { quit } from "./index"
|
||||
|
||||
@ -22,6 +22,14 @@ const redoMenuItem = {
|
||||
},
|
||||
}
|
||||
|
||||
const selectAllMenuItem = {
|
||||
label: 'Select All',
|
||||
accelerator: 'CommandOrControl+a',
|
||||
click: (menuItem, window, event) => {
|
||||
window?.webContents.send(SELECT_ALL_EVENT)
|
||||
},
|
||||
}
|
||||
|
||||
const deleteBlockMenuItem = {
|
||||
label: 'Delete block',
|
||||
accelerator: 'CommandOrControl+Shift+D',
|
||||
@ -117,7 +125,7 @@ const template = [
|
||||
...(isMac ? [
|
||||
{ role: 'pasteAndMatchStyle' },
|
||||
{ role: 'delete' },
|
||||
{ role: 'selectAll' },
|
||||
selectAllMenuItem,
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Speech',
|
||||
@ -129,7 +137,7 @@ const template = [
|
||||
] : [
|
||||
{ role: 'delete' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'selectAll' }
|
||||
selectAllMenuItem,
|
||||
])
|
||||
]
|
||||
},
|
||||
@ -226,7 +234,7 @@ export function getEditorContextMenu(win) {
|
||||
{role: 'copy'},
|
||||
{role: 'paste'},
|
||||
{type: 'separator'},
|
||||
{role: 'selectAll'},
|
||||
selectAllMenuItem,
|
||||
{type: 'separator'},
|
||||
deleteBlockMenuItem,
|
||||
moveBlockMenuItem,
|
||||
|
Reference in New Issue
Block a user