prosekit/extensions/search
Interfaces
Section titled “Interfaces”SearchQueryOptions
Section titled “SearchQueryOptions”Options for defineSearchQuery
Properties
Section titled “Properties”-
search:string -
The search string (or regular expression).
-
replace?:string -
The replace text.
-
caseSensitive?:boolean -
Indicates whether the search is case-sensitive
Default
Section titled “Default”false
-
literal?:boolean -
By default, string search will replace
\n,\r, and\tin the query with newline, return, and tab characters. When this is set to true, that behavior is disabled.Default
Section titled “Default”false
-
regexp?:boolean -
When true, the search string is interpreted as a regular expression.
Default
Section titled “Default”false
-
wholeWord?:boolean -
Enable whole-word matching.
Default
Section titled “Default”false
SearchStatus
Section titled “SearchStatus”The match count for the current search query, and the position of the match that the selection sits on.
Properties
Section titled “Properties”-
total:number -
The total number of matches for the current search query.
-
active:number -
The one-based position of the match that the selection sits on, or 0 when the selection is not on a match.
Type Aliases
Section titled “Type Aliases”SearchStatusHandler
Section titled “SearchStatusHandler”-
type SearchStatusHandler = (status:SearchStatus) =>void -
A function that receives the current search status.
Functions
Section titled “Functions”defineSearchQuery()
Section titled “defineSearchQuery()”-
function defineSearchQuery(options?:SearchQueryOptions):PlainExtension -
Defines an extension that stores a current search query and replace string. When called without options, it stores an empty query, which can be updated later with the
setSearchQuerycommand.
defineSearchCommands()
Section titled “defineSearchCommands()”-
function defineSearchCommands():SearchCommandsExtension -
Defines commands for search and replace.
getSearchStatus()
Section titled “getSearchStatus()”-
function getSearchStatus(state:EditorState):SearchStatus -
Returns the current search status.
defineSearchStatusHandler()
Section titled “defineSearchStatusHandler()”-
function defineSearchStatusHandler(handler:SearchStatusHandler):PlainExtension -
Registers a handler that is called whenever the search status changes. It can be used to render a match counter.