Add command palette and command registry

- Commands (with optional shortcuts and availability checks) are registered in one place;
  global shortcuts are dispatched from it, and plugins can use registerCommand later
- The quick switcher lists commands when the input starts with '>' (VS Code style),
  opened with Ctrl+Shift+P or F1 (Firefox reserves Ctrl+Shift+P), plus buttons in the
  sidebar footer and the mobile top bar; recently used commands come first
- Built-in commands: quick open, search, new note/folder, save, rename, delete, close tab,
  trash, log out
- Mount the trash dialog at the workspace level so it is not positioned inside the
  transformed mobile drawer
This commit is contained in:
eezd committed 2026-10-17 12:14:11 +08:00
1 parent d096f0da70
commit 919575f3e7
7 files changed
+201 -73

No files matched your search

+2 -4
View File
@@ -2,14 +2,12 @@
import { ref } from 'vue'
import Icon from './Icon.vue'
import { basename } from './paths'
import TrashDialog from './TrashDialog.vue'
import { tree } from './tree'
import TreeNode from './TreeNode.vue'
import SearchPanel from './SearchPanel.vue'
import { createFolder, createNote, move, openSearch, ws } from './workspace'
const emit = defineEmits<{ logout: [] }>()
const trashOpen = ref(false)
const rootDrop = ref(false)
function onRootDragOver(e: DragEvent) {
@@ -45,9 +43,9 @@ function onRootDrop(e: DragEvent) {
<p v-if="!tree.length" class="rm-tree-empty">还没有笔记</p>
</div>
<div class="rm-sidebar-foot">
<button class="rm-foot-btn" @click="trashOpen = true"><Icon name="trash" />回收站</button>
<button class="rm-foot-btn" title="命令面板(F1)" @click="ws.switcher = '>'"><Icon name="command" />命令</button>
<button class="rm-foot-btn" @click="ws.trashOpen = true"><Icon name="trash" />回收站</button>
<button class="rm-foot-btn" @click="emit('logout')"><Icon name="logout" />退出</button>
</div>
<TrashDialog v-if="trashOpen" @close="trashOpen = false" />
</div>
</template>