Skip to main content
Search for text/pattern in SuperEditor content. Select text and apply different sizes. Supports pt, px, em, and rem units with automatic min/max clamping.

Use Case

  • Find and replace: quickly locate words or phrases and replace them.
  • Content navigation: jump to the next or previous match without scrolling manually.
  • Highlighting: visually emphasize search results for the user.
  • Custom workflows: integrate search into toolbars, command palettes, or keyboard shortcuts.

Commands

goToFirstMatch

Navigate to the first search match
Scrolls editor to the first match from previous search
Example:
editor.commands.goToFirstMatch()
Search for string matches in editor content
Returns array of SearchMatch objects with positions and IDs
Example:
const matches = editor.commands.search('test string')
const regexMatches = editor.commands.search(/test/i)
Parameters:
patternInput
String | RegExp
required
Search string or pattern

goToSearchResult

Navigate to a specific search match
Scrolls to match and selects it
Example:
const searchResults = editor.commands.search('test string')
editor.commands.goToSearchResult(searchResults[3])
Parameters:
match
SearchMatch
required
Match object to navigate to

Types

SearchMatch

Search match object

Source Code

I