FindBar
Import :
const FindBar = brackets.getModule("search/FindBar")
FindBar
Kind: global class
- FindBar
- new FindBar([scopeLabel])
- .open()
- .close(suppressAnimation)
- .isClosed() ⇒
boolean
- .getOptions() ⇒
Object
- .getQueryInfo() ⇒
Object
- .showError(error, [isHTML], [isFilterError])
- .showFindCount(count)
- .showNoResults(showIndicator, showMessage)
- .getReplaceText() ⇒
string
- .enable(enable)
- .isEnabled() ⇒
boolean
- .isReplaceEnabled() ⇒
boolean
- .enableNavigation(enable)
- .enableReplace(enable)
- .focusQuery()
- .focusReplace()
- .showIndexingSpinner()
- .redoInstantSearch()
new FindBar([scopeLabel])
Find Bar UI component, used for both single- and multi-file find/replace. This doesn't actually create and add the FindBar to the DOM - for that, call open().
Dispatches these events:
- queryChange - when the user types in the input field or sets a query option. Use getQueryInfo() to get the current query state.
- doFind - when the user chooses to do a Find Previous or Find Next. Parameters are: shiftKey - boolean, false for Find Next, true for Find Previous
- doReplace - when the user chooses to do a single replace. Use getReplaceText() to get the current replacement text.
- doReplaceBatch - when the user chooses to initiate a Replace All. Use getReplaceText() to get the current replacement text.
- doReplaceAll - when the user chooses to perform a Replace All. Use getReplaceText() to get the current replacement text.
- close - when the find bar is closed
Param | Type | Description |
---|---|---|
[options.multifile] | boolean | true if this is a Find/Replace in Files (changes the behavior of Enter in the fields, hides the navigator controls, shows the scope/filter controls, and if in replace mode, hides the Replace button (so there's only Replace All) |
[options.replace] | boolean | true to show the Replace controls - default false |
[options.queryPlaceholder] | string | label to show in the Find field - default empty string |
[options.initialQuery] | string | query to populate in the Find field on open - default empty string |
[scopeLabel] | string | HTML label to show for the scope of the search, expected to be already escaped - default empty string |
findBar.open()
Opens the Find bar, closing any other existing Find bars.
Kind: instance method of FindBar
findBar.close(suppressAnimation)
Closes this Find bar. If already closed, does nothing.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
suppressAnimation | boolean | If true, don't do the standard closing animation. Default false. |
findBar.isClosed() ⇒ boolean
Kind: instance method of FindBar
Returns: boolean
- true if this FindBar has been closed.
findBar.getOptions() ⇒ Object
Kind: instance method of FindBar
Returns: Object
- The options passed into the FindBar.
findBar.getQueryInfo() ⇒ Object
Returns the current query and parameters.
Kind: instance method of FindBar
findBar.showError(error, [isHTML], [isFilterError])
Show or clear an error message related to the query.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
error | string | The error message to show, or null to hide the error display. |
[isHTML] | boolean | Whether the error message is HTML that should remain unescaped. |
[isFilterError] | boolean | Whether the error related to file filters |
findBar.showFindCount(count)
Set the find count.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
count | string | The find count message to show. Can be the empty string to hide it. |
findBar.showNoResults(showIndicator, showMessage)
Show or hide the no-results indicator and optional message. This is also used to indicate regular expression errors.
Kind: instance method of FindBar
Param | Type |
---|---|
showIndicator | boolean |
showMessage | boolean |
findBar.getReplaceText() ⇒ string
Returns the current replace text.
Kind: instance method of FindBar
findBar.enable(enable)
Enables or disables the controls in the Find bar. Note that if enable is true, all controls will be re-enabled, even if some were previously disabled using enableNavigation() or enableReplace(), so you will need to refresh their enable state after calling this.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
enable | boolean | Whether to enable or disable the controls. |
findBar.isEnabled() ⇒ boolean
Kind: instance method of FindBar
Returns: boolean
- true if the FindBar is enabled.
findBar.isReplaceEnabled() ⇒ boolean
Kind: instance method of FindBar
Returns: boolean
- true if the Replace button is enabled.
findBar.enableNavigation(enable)
Enable or disable the navigation controls if present. Note that if the Find bar is currently disabled (i.e. isEnabled() returns false), this will have no effect.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
enable | boolean | Whether to enable the controls. |
findBar.enableReplace(enable)
Enable or disable the replace controls if present. Note that if the Find bar is currently disabled (i.e. isEnabled() returns false), this will have no effect.
Kind: instance method of FindBar
Param | Type | Description |
---|---|---|
enable | boolean | Whether to enable the controls. |
findBar.focusQuery()
Sets focus to the query field and selects its text.
Kind: instance method of FindBar
findBar.focusReplace()
Sets focus to the replace field and selects its text.
Kind: instance method of FindBar
findBar.showIndexingSpinner()
The indexing spinner is usually shown when node is indexing files
Kind: instance method of FindBar
findBar.redoInstantSearch()
Force a search again
Kind: instance method of FindBar