43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
/*!
|
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
*/
|
|
/**
|
|
* @module plugins/search
|
|
*/
|
|
import type { FuzzySearch } from "../../types/index";
|
|
import "./interface";
|
|
declare module 'jodit/config' {
|
|
interface Config {
|
|
/**
|
|
* Enable custom search plugin
|
|
* 
|
|
*/
|
|
useSearch: boolean;
|
|
search: {
|
|
lazyIdleTimeout: number;
|
|
/**
|
|
* Use custom highlight API https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API
|
|
* or use default implementation (wrap text in span and attribute jd-tmp-selection)
|
|
*/
|
|
useCustomHighlightAPI: boolean;
|
|
/**
|
|
* Function to search for a string within a substring. The default implementation is [[fuzzySearchIndex]]
|
|
* But you can write your own. It must implement the [[FuzzySearch]] interface.
|
|
*
|
|
* ```ts
|
|
* Jodit.make('#editor', {
|
|
* search: {
|
|
* fuzzySearch: (needle, haystack, offset) => {
|
|
* return [haystack.toLowerCase().indexOf(needle.toLowerCase(), offset), needle.length];
|
|
* }
|
|
* }
|
|
* })
|
|
* ```
|
|
*/
|
|
fuzzySearch?: FuzzySearch;
|
|
};
|
|
}
|
|
}
|