Class GenericSearchProvider

Generic DOM tree search provider.

Hierarchy

Constructors

Properties

_currentMatchIndex: any
_filtersChanged: Signal<GenericSearchProvider, void>
_highlightNext: any
_markNodes: any
_matches: any
_mutationObserver: any
_onWidgetChanged: any
_query: any
_stateChanged: Signal<GenericSearchProvider, void>
isReadOnly: true = true

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.

widget: Widget

Accessors

  • get currentMatchIndex(): number
  • The current index of the selected match.

    Returns number

  • get filtersChanged(): ISignal<this, void>
  • Signal indicating that filter definition changed.

    Returns ISignal<this, void>

  • get isDisposed(): boolean
  • Whether the search provider is disposed or not.

    Returns boolean

  • get matches(): IHTMLSearchMatch[]
  • The current matches

    Returns IHTMLSearchMatch[]

  • get matchesCount(): number
  • The number of matches.

    Returns number

  • get stateChanged(): ISignal<this, void>
  • Signal indicating that something in the search has changed, so the UI should update

    Returns ISignal<this, void>

Methods

  • Dispose of the resources held by the search provider.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Clear the highlighted matches and any internal state.

    Returns Promise<void>

  • Get the filters for the given provider.

    Returns {
        [key: string]: IFilter;
    }

    The filters.

    Notes

    TODO For now it only supports boolean filters (represented with checkboxes)

  • Get an initial query value if applicable so that it can be entered into the search box as an initial query

    Returns string

    Initial value used to populate the search box.

  • Move the current match indicator to the next match.

    Parameters

    • Optional loop: boolean

      Whether to loop within the matches list.

    Returns Promise<IHTMLSearchMatch>

    A promise that resolves once the action has completed.

  • Move the current match indicator to the previous match.

    Parameters

    • Optional loop: boolean

      Whether to loop within the matches list.

    Returns Promise<IHTMLSearchMatch>

    A promise that resolves once the action has completed.

  • Replace all matches in the notebook with the provided text

    Parameters

    • newText: string

      The replacement text

    Returns Promise<boolean>

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

  • Replace the currently selected match with the provided text

    Parameters

    • newText: string

      The replacement text

    • Optional loop: boolean

      Whether to loop within the matches list.

    Returns Promise<boolean>

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

  • 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

    • Optional filters: {}

      Filter parameters to pass to provider

      Returns Promise<void>

    • Instantiate a generic search provider for the widget.

      Notes

      The widget provided is always checked using isApplicable before calling this factory.

      Parameters

      Returns ISearchProvider

      The search provider on the widget

    • Report whether or not this provider has the ability to search on the given object

      Parameters

      Returns boolean

    • Utility for copying the letter case from old to new text.

      Parameters

      • oldText: string
      • newText: string

      Returns string

    Generated using TypeDoc