Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

fix(editor): keep useRichMarkdownSearch.ts within the 300-line cap (#36147)

Jinwoo Honge960b3091a81
diff --git a/src/renderer/src/components/editor/useRichMarkdownSearch.ts b/src/renderer/src/components/editor/useRichMarkdownSearch.ts
index 79a2a2582a0..70c55047d1e 100644
--- a/src/renderer/src/components/editor/useRichMarkdownSearch.ts
+++ b/src/renderer/src/components/editor/useRichMarkdownSearch.ts
@@ -276,23 +276,18 @@ export function useRichMarkdownSearch({
const target = event.target
const targetInsideEditor = target instanceof Node && root.contains(target)
- if (
- isMarkdownPreviewFindShortcut(event, getShortcutPlatform(), keybindings) &&
- targetInsideEditor
- ) {
- event.preventDefault()
- event.stopPropagation()
- openSearch()
- return
- }
-
- if (
- isMarkdownPreviewReplaceShortcut(event, getShortcutPlatform(), keybindings) &&
- targetInsideEditor
- ) {
+ const platform = getShortcutPlatform()
+ const openFromShortcut = !targetInsideEditor
+ ? null
+ : isMarkdownPreviewFindShortcut(event, platform, keybindings)
+ ? openSearch
+ : isMarkdownPreviewReplaceShortcut(event, platform, keybindings)
+ ? openReplace
+ : null
+ if (openFromShortcut) {
event.preventDefault()
event.stopPropagation()
- openReplace()
+ openFromShortcut()
return
}