Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GenericSearchProvider

Hierarchy

  • GenericSearchProvider

Implements

Index

Constructors

constructor

Properties

Private _changed

_changed: any

Private _currentMatch

_currentMatch: any

Private _highlightNext

_highlightNext: any

Private _matches

_matches: any

Private _mutationObserver

_mutationObserver: any

Private _onWidgetChanged

_onWidgetChanged: any

Private _query

_query: any

Private _widget

_widget: any

Readonly isReadOnly

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.

isSubProvider

isSubProvider: boolean

Set whether or not this will wrap to the beginning or end of the document on invocations of highlightNext or highlightPrevious, respectively

Static UNSUPPORTED_ELEMENTS

UNSUPPORTED_ELEMENTS: { APPLET: boolean; AREA: boolean; AUDIO: boolean; BASE: boolean; BODY: boolean; CANVAS: boolean; EMBED: boolean; HEAD: boolean; IFRAME: boolean; IMG: boolean; LINK: boolean; MAP: boolean; META: boolean; NOEMBED: boolean; NOSCRIPT: boolean; OBJECT: boolean; PARAM: boolean; PICTURE: boolean; SCRIPT: boolean; SOURCE: boolean; STYLE: boolean; SVG: boolean; TITLE: boolean; TRACK: boolean; VIDEO: boolean }

We choose opt out as most node types should be searched (e.g. script). Even nodes like , could have textContent we care about.

Note: nodeName is capitalized, so we do the same here

Type declaration

  • APPLET: boolean
  • AREA: boolean
  • AUDIO: boolean
  • BASE: boolean
  • BODY: boolean
  • CANVAS: boolean
  • EMBED: boolean
  • HEAD: boolean
  • IFRAME: boolean
  • IMG: boolean
  • LINK: boolean
  • MAP: boolean
  • META: boolean
  • NOEMBED: boolean
  • NOSCRIPT: boolean
  • OBJECT: boolean
  • PARAM: boolean
  • PICTURE: boolean
  • SCRIPT: boolean
  • SOURCE: boolean
  • STYLE: boolean
  • SVG: boolean
  • TITLE: boolean
  • TRACK: boolean
  • VIDEO: boolean

Accessors

changed

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

    Returns ISignal<this, void>

currentMatch

  • Returns ISearchMatch

currentMatchIndex

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

    Returns number

matches

  • The same list of matches provided by the startQuery promise resolution

    Returns ISearchMatch[]

Methods

clearSelection

  • clearSelection(): void
  • Returns void

endQuery

  • endQuery(removeOverlay?: boolean): 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.

    Parameters

    • Optional removeOverlay: boolean

    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, removes all matches.

    Returns Promise<void>

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

getInitialQuery

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

    Parameters

    • searchTarget: Widget

    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.

refreshOverlay

  • refreshOverlay(): void
  • Returns void

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

  • startQuery(query: RegExp, searchTarget: Widget, filters?: {}): Promise<ISearchMatch[]>
  • 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: Widget

      The widget to be searched

    • Optional filters: {}

    Returns Promise<ISearchMatch[]>

    A promise that resolves with a list of all matches

Static canSearchOn

  • canSearchOn(domain: Widget): boolean
  • Report whether or not this provider has the ability to search on the given object

    Parameters

    • domain: Widget

    Returns boolean

Generated using TypeDoc