@vdegenne/highlight-manager 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -3
- package/lib/index.js +8 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ interface Options {
|
|
|
49
49
|
/**
|
|
50
50
|
* @default undefined
|
|
51
51
|
*/
|
|
52
|
-
scrollStrategy: ScrollStrategy | undefined;
|
|
52
|
+
scrollStrategy: Partial<ScrollStrategy> | undefined;
|
|
53
53
|
/**
|
|
54
54
|
* If true, will select the next visible candidate if the highlight is offscreen.
|
|
55
55
|
*
|
|
@@ -59,7 +59,7 @@ interface Options {
|
|
|
59
59
|
}
|
|
60
60
|
export declare function setGlobalBeforeHighlight(fct: () => void): void;
|
|
61
61
|
interface HighlightOptions {
|
|
62
|
-
scrollStrategy: ScrollStrategy | undefined;
|
|
62
|
+
scrollStrategy: Partial<ScrollStrategy> | undefined;
|
|
63
63
|
}
|
|
64
64
|
export declare class HighLightManager {
|
|
65
65
|
#private;
|
|
@@ -78,7 +78,7 @@ export declare class HighLightManager {
|
|
|
78
78
|
/**
|
|
79
79
|
* @returns {boolean} true if the highlight succeeded, false otherwise.
|
|
80
80
|
*/
|
|
81
|
-
highlight(start: number, end?: number, unhighlightAll?: boolean, cache?: boolean, options?: HighlightOptions): boolean;
|
|
81
|
+
highlight(start: number, end?: number, unhighlightAll?: boolean, cache?: boolean, options?: Partial<HighlightOptions>): boolean;
|
|
82
82
|
previous(step?: number, cache?: boolean): void;
|
|
83
83
|
next(step?: number, cache?: boolean): void;
|
|
84
84
|
extendLeftHighlight(step?: number, cache?: boolean): void;
|
package/lib/index.js
CHANGED
|
@@ -155,7 +155,7 @@ export class HighLightManager {
|
|
|
155
155
|
/**
|
|
156
156
|
* @returns {boolean} true if the highlight succeeded, false otherwise.
|
|
157
157
|
*/
|
|
158
|
-
highlight(start, end, unhighlightAll = true, cache = false, options) {
|
|
158
|
+
highlight(start, end, unhighlightAll = true, cache = false, options = {}) {
|
|
159
159
|
if (end === undefined) {
|
|
160
160
|
end = start;
|
|
161
161
|
}
|
|
@@ -172,11 +172,13 @@ export class HighLightManager {
|
|
|
172
172
|
}
|
|
173
173
|
// console.log(highlightIndexStart, highlightIndexEnd, start, end)
|
|
174
174
|
const _options = {
|
|
175
|
-
scrollStrategy:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
scrollStrategy: options?.scrollStrategy || this.#options.scrollStrategy
|
|
176
|
+
? {
|
|
177
|
+
...scrollStrategyDefaults,
|
|
178
|
+
...this.#options.scrollStrategy,
|
|
179
|
+
...options?.scrollStrategy,
|
|
180
|
+
}
|
|
181
|
+
: undefined,
|
|
180
182
|
};
|
|
181
183
|
globalBeforeHighlight?.();
|
|
182
184
|
this.#options.beforeHighlight?.();
|