@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 0.0.0-nightly-20240730.0 to 0.0.0-nightly-20240731.0
@@ -56,3 +56,3 @@ /** | ||
export { default as FocusTracker } from './focustracker.js'; | ||
export { default as KeystrokeHandler } from './keystrokehandler.js'; | ||
export { default as KeystrokeHandler, type KeystrokeHandlerOptions } from './keystrokehandler.js'; | ||
export { default as toArray, type ArrayOrItem, type ReadonlyArrayOrItem } from './toarray.js'; | ||
@@ -59,0 +59,0 @@ export { default as toMap } from './tomap.js'; |
@@ -69,9 +69,4 @@ /** | ||
* @param options Additional options. | ||
* @param options.priority The priority of the keystroke | ||
* callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority | ||
* are called in the order they were added. | ||
*/ | ||
set(keystroke: string | ReadonlyArray<string | number>, callback: (ev: KeyboardEvent, cancel: () => void) => void, options?: { | ||
readonly priority?: PriorityString; | ||
}): void; | ||
set(keystroke: string | ReadonlyArray<string | number>, callback: (ev: KeyboardEvent, cancel: () => void) => void, options?: KeystrokeHandlerOptions): void; | ||
/** | ||
@@ -93,1 +88,16 @@ * Triggers a keystroke handler for a specified key combination, if such a keystroke was {@link #set defined}. | ||
} | ||
/** | ||
* {@link module:utils/keystrokehandler~KeystrokeHandler#set} method options. | ||
*/ | ||
export interface KeystrokeHandlerOptions { | ||
/** | ||
* The priority of the keystroke callback. The higher the priority value the sooner the callback will be executed. | ||
* Keystrokes having the same priority are called in the order they were added. | ||
*/ | ||
readonly priority?: PriorityString; | ||
/** | ||
* An optional callback function allowing for filtering keystrokes based on arbitrary criteria. | ||
* The callback function receives `keydown` DOM event as a parameter. | ||
*/ | ||
readonly filter?: (keyEvtData: KeyboardEvent) => boolean; | ||
} |
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
declare const version = "0.0.0-nightly-20240730.0"; | ||
declare const version = "0.0.0-nightly-20240731.0"; | ||
export default version; | ||
@@ -12,0 +12,0 @@ export declare const releaseDate: Date; |
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "0.0.0-nightly-20240730.0", | ||
"version": "0.0.0-nightly-20240731.0", | ||
"description": "Miscellaneous utilities used by CKEditor 5.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -52,3 +52,3 @@ /** | ||
export { default as FocusTracker } from './focustracker.js'; | ||
export { default as KeystrokeHandler } from './keystrokehandler.js'; | ||
export { default as KeystrokeHandler, type KeystrokeHandlerOptions } from './keystrokehandler.js'; | ||
export { default as toArray, type ArrayOrItem, type ReadonlyArrayOrItem } from './toarray.js'; | ||
@@ -55,0 +55,0 @@ export { default as toMap } from './tomap.js'; |
@@ -65,9 +65,4 @@ /** | ||
* @param options Additional options. | ||
* @param options.priority The priority of the keystroke | ||
* callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority | ||
* are called in the order they were added. | ||
*/ | ||
set(keystroke: string | ReadonlyArray<string | number>, callback: (ev: KeyboardEvent, cancel: () => void) => void, options?: { | ||
readonly priority?: PriorityString; | ||
}): void; | ||
set(keystroke: string | ReadonlyArray<string | number>, callback: (ev: KeyboardEvent, cancel: () => void) => void, options?: KeystrokeHandlerOptions): void; | ||
/** | ||
@@ -89,1 +84,16 @@ * Triggers a keystroke handler for a specified key combination, if such a keystroke was {@link #set defined}. | ||
} | ||
/** | ||
* {@link module:utils/keystrokehandler~KeystrokeHandler#set} method options. | ||
*/ | ||
export interface KeystrokeHandlerOptions { | ||
/** | ||
* The priority of the keystroke callback. The higher the priority value the sooner the callback will be executed. | ||
* Keystrokes having the same priority are called in the order they were added. | ||
*/ | ||
readonly priority?: PriorityString; | ||
/** | ||
* An optional callback function allowing for filtering keystrokes based on arbitrary criteria. | ||
* The callback function receives `keydown` DOM event as a parameter. | ||
*/ | ||
readonly filter?: (keyEvtData: KeyboardEvent) => boolean; | ||
} |
@@ -78,5 +78,2 @@ /** | ||
* @param options Additional options. | ||
* @param options.priority The priority of the keystroke | ||
* callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority | ||
* are called in the order they were added. | ||
*/ | ||
@@ -89,2 +86,5 @@ set(keystroke, callback, options = {}) { | ||
this._listener.listenTo(this._listener, '_keydown:' + keyCode, (evt, keyEvtData) => { | ||
if (options.filter && !options.filter(keyEvtData)) { | ||
return; | ||
} | ||
callback(keyEvtData, () => { | ||
@@ -91,0 +91,0 @@ // Stop the event in the DOM: no listener in the web page |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare const version = "0.0.0-nightly-20240730.0"; | ||
declare const version = "0.0.0-nightly-20240731.0"; | ||
export default version; | ||
@@ -8,0 +8,0 @@ export declare const releaseDate: Date; |
@@ -9,6 +9,6 @@ /** | ||
import CKEditorError from './ckeditorerror.js'; | ||
const version = '0.0.0-nightly-20240730.0'; | ||
const version = '0.0.0-nightly-20240731.0'; | ||
export default version; | ||
// The second argument is not a month. It is `monthIndex` and starts from `0`. | ||
export const releaseDate = new Date(2024, 6, 30); | ||
export const releaseDate = new Date(2024, 6, 31); | ||
/* istanbul ignore next -- @preserve */ | ||
@@ -15,0 +15,0 @@ if (globalThis.CKEDITOR_VERSION) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2038835
21039