The search feature can be built on top of the existing custom highlights feature. What needs to be done is to expose an API to trigger a search.
The client apps can decide on their own terms when to search (via key combo listener or GUI button in read-only mode).
The text search algo should be reather simple, it should match multiple strings and it should be case insensitive.
Implement search button
Add search function in controller. Search the whole document for any substring matching the pattern
Search input popover/tooltip. Use the same technique as for link edit popover or quick menu
Cache the search results in a state. Similar to headings. Including rectangles, text position, substring
Provide callback: onSearch
Render yellow highlights over the text for all rectangles
Escape cleans the search. Search input has close action on tap.
Write demo page, test, docs
Join us on discord to get implementation advice and help or follow us on YouTube Visual Coding to learn more about the architecture of Visual Editor and other Flutter software architecture advice.
Join us on discord to get implementation advice and help or follow us on YouTube Visual Coding to learn more about the architecture of Visual Editor and other Flutter software architecture advice.