The FluidTopicsReaderService.searchInDocument() method allows designers to set the user's search in document query.
For example, the following codeblocks in a Custom component create a button that allows users to clear the current search in document query:
HTML:
<ft-button id="searchBtn" type="button" outlined icon="backspace" iconVariant="material">Clear search in document query</ft-button>
JavaScript:
const btn = document.getElementById("searchBtn");
btn.addEventListener("click", function () {
FluidTopicsReaderService.searchInDocument("");
});
This clears the highlight of words matching the search in document query.
Using the FluidTopicsReaderService.searchInDocument() method updates the state of:
- the Built-in search in document component.
- the Search components, when the Search block component's scope is In current document only.