Skip to content

Commit

Permalink
Add menu item to open "Move block" dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Jan 7, 2025
1 parent c9c092f commit 6187d6d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions electron/main/menu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { app, Menu } = require("electron")
import { OPEN_SETTINGS_EVENT, REDO_EVENT } from '@/src/common/constants'
import { OPEN_SETTINGS_EVENT, REDO_EVENT, MOVE_BLOCK_EVENT } from '@/src/common/constants'
import { openAboutWindow } from "./about";
import { quit } from "./index"

Expand Down Expand Up @@ -63,13 +63,19 @@ const template = [
label: 'Edit',
submenu: [
{ role: 'undo' },
//{ role: 'undo' },
{
label: 'Redo',
accelerator: 'CommandOrControl+Shift+z',
click: (menuItem, window, event) => {
window?.webContents.send(REDO_EVENT)
console.log("redo")
},
},
{ type: 'separator' },
{
label: 'Move block to another buffer...',
accelerator: 'CommandOrControl+S',
click: (menuItem, window, event) => {
window?.webContents.send(MOVE_BLOCK_EVENT)
},
},
{ type: 'separator' },
Expand Down
1 change: 1 addition & 0 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const WINDOW_CLOSE_EVENT = "window-close"
export const OPEN_SETTINGS_EVENT = "open-settings"
export const SETTINGS_CHANGE_EVENT = "settings-change"
export const REDO_EVENT = "redo"
export const MOVE_BLOCK_EVENT = "move-block"

export const UPDATE_AVAILABLE_EVENT = "update-available"
export const UPDATE_NOT_AVAILABLE_EVENT = "update-not-available"
Expand Down
7 changes: 6 additions & 1 deletion src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { useSettingsStore } from "../stores/settings-store"
import { useEditorCacheStore } from '../stores/editor-cache'
import { OPEN_SETTINGS_EVENT, SETTINGS_CHANGE_EVENT } from '@/src/common/constants'
import { OPEN_SETTINGS_EVENT, MOVE_BLOCK_EVENT } from '@/src/common/constants'
import StatusBar from './StatusBar.vue'
import Editor from './Editor.vue'
Expand Down Expand Up @@ -44,6 +44,10 @@
window.heynote.mainProcess.on(OPEN_SETTINGS_EVENT, () => {
this.showSettings = true
})
window.heynote.mainProcess.on(MOVE_BLOCK_EVENT, (path) => {
this.openMoveToBufferSelector()
})
},
beforeUnmount() {
Expand Down Expand Up @@ -77,6 +81,7 @@
"showCreateBuffer",
"showEditBuffer",
"showMoveToBufferSelector",
"openMoveToBufferSelector",
]),
editorInert() {
Expand Down

0 comments on commit 6187d6d

Please sign in to comment.