Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Search #382

Closed
4 of 6 tasks
GaboHBeaumont opened this issue Jun 30, 2022 · 0 comments
Closed
4 of 6 tasks

Page Search #382

GaboHBeaumont opened this issue Jun 30, 2022 · 0 comments
Assignees
Milestone

Comments

@GaboHBeaumont
Copy link

GaboHBeaumont commented Jun 30, 2022

We will use the actual rendered DOM to implement search, instead of relying on slate's tree or anything like that. This let's us incorporate more into the search results that just the document, like titles of documents and similar.

We can use existing libraries like https://github.com/padolsey/findAndReplaceDOMText for inspiration, but I believe we must build our own solution that also integrates with highlighting the results on the page.

The algorithm will accept a root node as input, allowing us to limit which subtrees are taken into account when searching (since we don't want text in buttons or similar showing up in the search) it will also accept a search term of course. Since we will most likely use regexes for this anyway, we can allow search terms to be regexes too (like vscode allows too for example)

UI

The UI portion of this pitch will implement a floating search box, similar in style to notion desktop, or firefox, or chrome. This maintains the established UI pattern on search-on-page.

Search results will be highlighted in light yellow.

Context

There are possible page search APIs exposed by the webview components, but the returned data is rather unusable. (of macOS it only returns a bool indicating if something was found) see this PR for more info.

Technical Tasks

  • Search UI popup
  • Next match button
  • Prev match button
  • Cmd+F shortcut
  • text highlighting
  • RegExp input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants