[PR #782] [MERGED] Add local search component #890

Closed
opened 2026-03-03 00:23:40 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BoostIO/BoostNote-App/pull/782
Author: @Komediruzecki
Created: 2/14/2021
Status: Merged
Merged: 5/4/2021
Merged by: @Rokt33r

Base: masterHead: feature/improve-local-search-consistency


📝 Commits (10+)

  • c090cf7 Add local search component
  • 05c9aac Update for review
  • 085b8eb Fix some namings and types
  • cfe4602 Update tooltips for local search and replace
  • 73cbb5c Discard unnecessary if statements
  • e996a6e Discard unnecessary type defs
  • 1c45b4b Refactor code based on review
  • 0f67a6f Fix replaceAll hack
  • c3fa1e9 Fix event changes comments
  • 19f0c85 Update focus management for local search

📊 Changes

26 files changed (+1876 additions, -107 deletions)

View changed files

📝 jest.json (+2 -1)
📝 package-lock.json (+9 -9)
📝 package.json (+2 -2)
📝 src/components/PreferencesModal/KeymapTab.tsx (+14 -21)
📝 src/components/atoms/CodeEditor.tsx (+109 -19)
📝 src/components/atoms/CustomizedCodeEditor.tsx (+13 -0)
📝 src/components/atoms/KeymapItemSection.tsx (+26 -35)
src/components/atoms/search/LocalSearchButton.tsx (+75 -0)
src/components/atoms/search/SearchResultItem.tsx (+6 -0)
📝 src/components/molecules/SearchModalNoteResultItem.tsx (+1 -1)
src/components/organisms/LocalReplace.tsx (+435 -0)
src/components/organisms/LocalSearch.tsx (+903 -0)
📝 src/components/organisms/NoteDetail.tsx (+149 -2)
📝 src/components/organisms/SearchModal.tsx (+9 -8)
src/components/pages/NotePage.tsx (+0 -0)
📝 src/lib/CodeMirror.ts (+1 -3)
📝 src/lib/keymap.ts (+33 -0)
📝 src/lib/preferences.ts (+20 -3)
📝 src/lib/search/search.ts (+14 -3)
📝 src/lib/styled/BaseTheme.ts (+3 -0)

...and 6 more files

📄 Description

Add local search component (#722, #762)

  • Add local replace component
  • Update codemirror and codemirror types to latest version (attribute field for MarkerOptions needed)
  • Update code to use new API for TextMarkers
  • Update styling for all themes
  • Update key mapping of buttons (options)
  • Add button descriptions for search options (popups)
  • Add modulo navigation for search and replace
  • Add search and replace key mappings for opening, navigation, and replacing
  • Add search options in NoteDetail state
  • Update global search constant and API for easier handling of additional options

Fix VIM keybinding

  • Add escape to exit VIM insert mode in VIM keymap
  • Add escape as close search/replace in normal mode
    Fix typo in NotePage styled component (Container)

Open Points:

  • Most of them in code (as todos, improvements, optimizations)
  • Add error handling (how do we want to handle (popup messages, in form handling, quiet ignore)?
  • Keymap for replace - currently 'CTRL+H' but should be 'CTRL+R'
  • Tooltips will be added once tooltip PR is merged (as well as translations for them)
  • Translations for all strings regarding search dialogs

Let me know if styling is fine (added background colors in themes), it's pretty basic.
The functionality works even without resolving all todos/optimizations/improvements.

Few examples of how it looks:
SimpleSearchOnly
SimpleSearchNextOccurencePopup
SimpleSearchUI
SimpleSearchOptionPopup
SimpleRegexSearchWithSplitPane
BadPatternDarkTheme

Keymaps (here for general usage but also for review if anything needs changing)

On focused editor
CTRL+F - opens search only
CTRL+H - opens search and replace dialogs
escape - closes search dialog in non VIM keymap

On focused search dialog
down arrow, enter or F3 - navigates to next item
up arrow, SHIFT+F3 - navigates to previous item
CTRL+H - opens replace dialog

On focused replace dialog
CTRL+F - opens search dialog and closes replace dialog
down arrow, or F3 - navigates to next item
up arrow, or SHIFT+F3 - navigates to previous item
enter - replaces currently focused item

On search or replace focused dialog
escape - closes search/replace dialog
CTRL+SHIFT+Enter - adds newline to search/replace input dialog

Buttons available are self-explanatory (replace, replace all, close button in corner, navigation buttons and options)

State of case sensitive search, regex search (preserving case in replace dialog), and search/replace queries is persistent between search dialog toggling (open/close)

Tested in

  • Local dev
  • Production AppImage (Linux)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BoostIO/BoostNote-App/pull/782 **Author:** [@Komediruzecki](https://github.com/Komediruzecki) **Created:** 2/14/2021 **Status:** ✅ Merged **Merged:** 5/4/2021 **Merged by:** [@Rokt33r](https://github.com/Rokt33r) **Base:** `master` ← **Head:** `feature/improve-local-search-consistency` --- ### 📝 Commits (10+) - [`c090cf7`](https://github.com/BoostIO/BoostNote-App/commit/c090cf7c35f985bda0d314f464195cec69e42860) Add local search component - [`05c9aac`](https://github.com/BoostIO/BoostNote-App/commit/05c9aac0c47471733f6f598e8300d8f1a7ad0d4e) Update for review - [`085b8eb`](https://github.com/BoostIO/BoostNote-App/commit/085b8eb94fc3af7521a3cdba2ab32b4ce7068e70) Fix some namings and types - [`cfe4602`](https://github.com/BoostIO/BoostNote-App/commit/cfe46027078be4430782f5a437ecef09ed82d0f2) Update tooltips for local search and replace - [`73cbb5c`](https://github.com/BoostIO/BoostNote-App/commit/73cbb5cd3c769dd623bb88b0522f83d4f8602bce) Discard unnecessary if statements - [`e996a6e`](https://github.com/BoostIO/BoostNote-App/commit/e996a6eaf54dc99f124fb48887b17c1115c9ef1f) Discard unnecessary type defs - [`1c45b4b`](https://github.com/BoostIO/BoostNote-App/commit/1c45b4bf502860a8e2d1d3faa7aef329d3d47d78) Refactor code based on review - [`0f67a6f`](https://github.com/BoostIO/BoostNote-App/commit/0f67a6f09dcaa777d7163540198bbf89a84bb744) Fix replaceAll hack - [`c3fa1e9`](https://github.com/BoostIO/BoostNote-App/commit/c3fa1e98cb385b0373138bd467fd65b71cc80590) Fix event changes comments - [`19f0c85`](https://github.com/BoostIO/BoostNote-App/commit/19f0c850a2afc0a6fcca26c42f0e7c23fe502ebd) Update focus management for local search ### 📊 Changes **26 files changed** (+1876 additions, -107 deletions) <details> <summary>View changed files</summary> 📝 `jest.json` (+2 -1) 📝 `package-lock.json` (+9 -9) 📝 `package.json` (+2 -2) 📝 `src/components/PreferencesModal/KeymapTab.tsx` (+14 -21) 📝 `src/components/atoms/CodeEditor.tsx` (+109 -19) 📝 `src/components/atoms/CustomizedCodeEditor.tsx` (+13 -0) 📝 `src/components/atoms/KeymapItemSection.tsx` (+26 -35) ➕ `src/components/atoms/search/LocalSearchButton.tsx` (+75 -0) ➕ `src/components/atoms/search/SearchResultItem.tsx` (+6 -0) 📝 `src/components/molecules/SearchModalNoteResultItem.tsx` (+1 -1) ➕ `src/components/organisms/LocalReplace.tsx` (+435 -0) ➕ `src/components/organisms/LocalSearch.tsx` (+903 -0) 📝 `src/components/organisms/NoteDetail.tsx` (+149 -2) 📝 `src/components/organisms/SearchModal.tsx` (+9 -8) ➕ `src/components/pages/NotePage.tsx` (+0 -0) 📝 `src/lib/CodeMirror.ts` (+1 -3) 📝 `src/lib/keymap.ts` (+33 -0) 📝 `src/lib/preferences.ts` (+20 -3) 📝 `src/lib/search/search.ts` (+14 -3) 📝 `src/lib/styled/BaseTheme.ts` (+3 -0) _...and 6 more files_ </details> ### 📄 Description **Add local search component** (#722, #762) - Add local replace component - Update codemirror and codemirror types to latest version (attribute field for MarkerOptions needed) - Update code to use new API for TextMarkers - Update styling for all themes - Update key mapping of buttons (options) - Add button descriptions for search options (popups) - Add modulo navigation for search and replace - Add search and replace key mappings for opening, navigation, and replacing - Add search options in NoteDetail state - Update global search constant and API for easier handling of additional options Fix VIM keybinding - Add escape to exit VIM insert mode in VIM keymap - Add escape as close search/replace in normal mode Fix typo in NotePage styled component (Container) Open Points: - [x] Most of them in code (as todos, improvements, optimizations) - [x] Add error handling (how do we want to handle (popup messages, in form handling, quiet ignore)? - [x] Keymap for replace - currently 'CTRL+H' but should be 'CTRL+R' - [ ] Tooltips will be added once tooltip PR is merged (as well as translations for them) - [ ] Translations for all strings regarding search dialogs Let me know if styling is fine (added background colors in themes), it's pretty basic. The functionality works even without resolving all todos/optimizations/improvements. Few examples of how it looks: ![SimpleSearchOnly](https://user-images.githubusercontent.com/18196945/107889615-338f7200-6f14-11eb-9dd6-32e685caa036.png) ![SimpleSearchNextOccurencePopup](https://user-images.githubusercontent.com/18196945/107889622-3c804380-6f14-11eb-889b-7165676cce82.png) ![SimpleSearchUI](https://user-images.githubusercontent.com/18196945/107889613-2c686400-6f14-11eb-9acf-c2e04d8ea016.png) ![SimpleSearchOptionPopup](https://user-images.githubusercontent.com/18196945/107889617-368a6280-6f14-11eb-98f0-9105d08ad57f.png) ![SimpleRegexSearchWithSplitPane](https://user-images.githubusercontent.com/18196945/107889669-9123be80-6f14-11eb-9685-652e50bccaf8.png) ![BadPatternDarkTheme](https://user-images.githubusercontent.com/18196945/107889959-60dd1f80-6f16-11eb-8ff0-a76aa965833e.png) Keymaps (here for general usage but also for review if anything needs changing) On focused editor `CTRL+F` - opens search only `CTRL+H` - opens search and replace dialogs `escape` - closes search dialog in non VIM keymap On focused search dialog `down arrow`, `enter` or `F3` - navigates to next item `up arrow`, `SHIFT+F3` - navigates to previous item `CTRL+H` - opens replace dialog On focused replace dialog `CTRL+F` - opens search dialog and closes replace dialog `down arrow`, or `F3` - navigates to next item `up arrow`, or `SHIFT+F3` - navigates to previous item `enter` - replaces currently focused item On search or replace focused dialog `escape` - closes search/replace dialog `CTRL+SHIFT+Enter` - adds newline to search/replace input dialog Buttons available are self-explanatory (replace, replace all, close button in corner, navigation buttons and options) State of case sensitive search, regex search (preserving case in replace dialog), and search/replace queries is persistent between search dialog toggling (open/close) **Tested in** - Local dev - Production AppImage (Linux) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 00:23:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/BoostNote-App#890
No description provided.