diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index bf4cdd1..f9c874e 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -10,7 +10,7 @@ "frontendDist": "../dist" }, "app": { - "windows": [{"label": "main", "title": "NotesAgent Preview", "width": 1200, "height": 800, "minWidth": 640, "minHeight": 480, "decorations": false}], + "windows": [{"label": "main", "title": "NotesAgent Preview", "width": 1280, "height": 960, "minWidth": 720, "minHeight": 700, "center": true, "decorations": false}], "security": { "csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: http://127.0.0.1:8000; font-src 'self' data:; connect-src ipc: http://ipc.localhost http://127.0.0.1:8000; frame-src 'self' blob:; object-src 'none'; base-uri 'self'", "capabilities": ["main"] diff --git a/frontend/src/components/common/TitleBarMenu.spec.ts b/frontend/src/components/common/TitleBarMenu.spec.ts index 1123703..33e5085 100644 --- a/frontend/src/components/common/TitleBarMenu.spec.ts +++ b/frontend/src/components/common/TitleBarMenu.spec.ts @@ -58,4 +58,13 @@ describe('桌面顶部段落菜单', () => { expect(wrapper.get('.import-properties').text()).toContain('Ctrl+Alt+P') wrapper.unmount() }) + + it('格式菜单列出十四种警告框和元数据快捷键', async () => { + const wrapper = mount(TitleBarMenu) + await wrapper.get('[data-menu="format"] .menu-trigger').trigger('click') + expect(wrapper.findAll('.callout-options button')).toHaveLength(14) + expect(wrapper.get('.submenu-heading').text()).toContain('Ctrl+Alt+C') + expect(wrapper.get('.metadata-command').text()).toContain('Ctrl+Alt+P') + wrapper.unmount() + }) }) diff --git a/frontend/src/components/common/TitleBarMenu.vue b/frontend/src/components/common/TitleBarMenu.vue index 7ec630f..23a649e 100644 --- a/frontend/src/components/common/TitleBarMenu.vue +++ b/frontend/src/components/common/TitleBarMenu.vue @@ -14,6 +14,11 @@ const open = ref(null) const bar = ref(null) const error = ref('') const shortcut = computed(() => /Mac|iPhone|iPad/.test(navigator.platform) ? '⌘⌥P' : 'Ctrl+Alt+P') +const callouts = [ + ['note', '笔记'], ['abstract', '摘要'], ['info', '信息'], ['todo', '待办'], ['tip', '技巧'], + ['important', '重要'], ['success', '成功'], ['question', '问题'], ['warning', '警告'], + ['failure', '失败'], ['danger', '危险'], ['bug', '缺陷'], ['example', '示例'], ['quote', '引用'], +] as const function enabled(id: EditorCommandId) { return getEditorCommandCapabilities().find(item => item.id === id)?.enabled ?? false @@ -31,6 +36,11 @@ async function command(id: EditorCommandId, params?: unknown) { if (result.ok) close() else error.value = t('当前编辑器无法执行此命令。', 'The active editor cannot run this command.') } +async function metadataCommand() { + const imported = await executeEditorCommand('editor.import-note-properties') + if (imported.ok) { close(); return } + await command('editor.metadata.edit') +} async function save() { await editor.save(); close() } function setMode(mode: 'source' | 'wysiwyg') { editor.setMode(mode); close() } function toggleTheme() { theme.toggleTheme(); close() } @@ -63,14 +73,14 @@ onBeforeUnmount(() => window.removeEventListener('pointerdown', dismiss))