Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ISearchProvider<T>

Type parameters

  • T: Widget = Widget

Hierarchy

  • ISearchProvider

Implemented by

Index

Properties

Readonly changed

changed: ISignal<ISearchProvider<T>, void>

Signal indicating that something in the search has changed, so the UI should update

Readonly currentMatchIndex

currentMatchIndex: number

The current index of the selected match.

Optional Readonly hasOutputs

hasOutputs: boolean

Set to true if the widget under search has outputs to search. Defaults to false.

Readonly isReadOnly

isReadOnly: boolean

Set to true if the widget under search is read-only, false if it is editable. Will be used to determine whether to show the replace option.

Readonly matches

matches: ISearchMatch[]

The same list of matches provided by the startQuery promise resolution

Methods

endQuery

  • endQuery(): Promise<void>
  • Clears state of a search provider to prepare for startQuery to be called in order to start a new query or refresh an existing one.

    Returns Promise<void>

    A promise that resolves when the search provider is ready to begin a new search.

endSearch

  • endSearch(): Promise<void>
  • Resets UI state as it was before the search process began. Cleans up and disposes of all internal state.

    Returns Promise<void>

    A promise that resolves when all state has been cleaned up.

getInitialQuery

  • getInitialQuery(searchTarget: T): any
  • Get an initial query value if applicable so that it can be entered into the search box as an initial query

    Parameters

    • searchTarget: T

      The widget to be searched

    Returns any

    Initial value used to populate the search box.

highlightNext

  • Move the current match indicator to the next match.

    Returns Promise<ISearchMatch>

    A promise that resolves once the action has completed.

highlightPrevious

  • Move the current match indicator to the previous match.

    Returns Promise<ISearchMatch>

    A promise that resolves once the action has completed.

replaceAllMatches

  • replaceAllMatches(newText: string): Promise<boolean>
  • Replace all matches in the notebook with the provided text

    Parameters

    • newText: string

    Returns Promise<boolean>

    A promise that resolves with a boolean indicating whether a replace occurred.

replaceCurrentMatch

  • replaceCurrentMatch(newText: string): Promise<boolean>
  • Replace the currently selected match with the provided text

    Parameters

    • newText: string

    Returns Promise<boolean>

    A promise that resolves with a boolean indicating whether a replace occurred.

startQuery

  • Initialize the search using the provided options. Should update the UI to highlight all matches and "select" whatever the first match should be.

    Parameters

    • query: RegExp

      A RegExp to be use to perform the search

    • searchTarget: T

      The widget to be searched

    • filters: IFiltersType

      Filter parameters to pass to provider

    Returns Promise<ISearchMatch[]>

    A promise that resolves with a list of all matches

Generated using TypeDoc