Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts focus/blur behavior around the sidebar “Find in Folder” UI to address #2294, aiming to focus the sidebar search input when invoking Find-in-Folder and to unfocus it on sidebar close / Escape.
Changes:
- Adds a template ref and focuses the find-in-folder input when handling the
findInFolderaction. - Alters sidebar open/close handling to trigger a new
search-blurbus event. - Adds a
search-blurlistener to the editor find/replace bar that currently clears/hides the editor search UI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/renderer/components/sideBar/search.vue | Adds input ref + focusing logic; changes sidebar visibility watcher behavior. |
| src/renderer/components/search/index.vue | Adds search-blur bus handling via blurSearch(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (value && !oldValue) { | ||
| this.handleFindInFolder(false) | ||
| } else { | ||
| bus.$emit('search-blur') |
| @@ -7,6 +7,7 @@ | |||
| type="text" v-model="keyword" | |||
| placeholder="Search in folder..." | |||
| @keyup="search" | |||
| handleFindInFolder (focus = true) { | ||
| this.keyword = this.searchMatches.value | ||
| if (focus) { | ||
| this.$nextTick(() => { | ||
| this.$refs.search.focus() | ||
| }) | ||
| } |
| }, | ||
|
|
||
| blurSearch () { | ||
| this.emptySearch(true) |
|
This project recently merged a large refactor (electron-vite migration, PR #4001) that upgraded dependencies and fixed several issues. Please review this PR and let us know if it is still needed, or if the changes have already been addressed upstream.
|
|
Most likely the changes are outdated, no need to keep the pull request. Thank you for your work on marktext. |
Description
This pull request changes the behavior of
Edit: Find in Folder/(Ctrl+Shift+F) andView: Toggle Sidebar(Ctrl+J).Find in Folder: the search input is focused (whether the sidebar was previously open, closed or not yet created)Toggle Sidebar: when closing the sidebar the search input is unfocused (blurred) if it had the focus.Escape: the search input is unfocused (blurred) if it had the focus.When the search input get focused, the search keyword is emptied. Which is the same behavior as 'Edit: Find'(Ctrl+F).