💄 native menu items

This commit is contained in:
2026-03-03 20:46:23 +10:00
parent ac49c3df72
commit 63842b8805
7 changed files with 206 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import { EditorState, StateField, StateEffect, Annotation, RangeSetBuilder, Comp
import { markdown } from '@codemirror/lang-markdown'
import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'
import { history, defaultKeymap, historyKeymap, invertedEffects, selectAll, indentLess } from '@codemirror/commands'
import { search, searchKeymap } from '@codemirror/search'
import { search, searchKeymap, openSearchPanel } from '@codemirror/search'
import { marked } from 'marked'
import DOMPurify from 'dompurify'
import { useEditorStore } from '../../store/editorStore'
@@ -632,6 +632,14 @@ export function MarkdownEditor(): JSX.Element {
view.dispatch({ effects: themeCompartment.reconfigure(buildTheme(fontSize, theme === 'dark')) })
}, [fontSize, theme])
useEffect(() => {
return window.api.onMenuAction((action) => {
if (action === 'find' && viewRef.current) {
openSearchPanel(viewRef.current)
}
})
}, [])
function handleContextMenu(e: React.MouseEvent): void {
if (!activeFilePath) return
e.preventDefault()