fix(typing): add registerEventListener to CMS interface (#4804)

This commit is contained in:
Kenny Huynh 2021-01-05 04:41:13 -08:00 committed by GitHub
parent 567438fdd1
commit 5c265c1352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -403,6 +403,13 @@ declare module 'netlify-cms-core' {
config?: CmsMediaLibraryOptions; config?: CmsMediaLibraryOptions;
} }
export interface CmsEventListener {
name: 'prePublish' | 'postPublish' | 'preUnpublish' | 'postUnpublish' | 'preSave' | 'postSave';
handler: { entry: Map<string, any>; author: { login: string; name: string } };
}
export type CmsEventListenerOptions = any; // TODO: type properly
export type CmsLocalePhrases = any; // TODO: type properly export type CmsLocalePhrases = any; // TODO: type properly
export interface CmsRegistry { export interface CmsRegistry {
@ -455,6 +462,10 @@ declare module 'netlify-cms-core' {
init: (options?: InitOptions) => void; init: (options?: InitOptions) => void;
registerBackend: (name: string, backendClass: CmsBackendClass) => void; registerBackend: (name: string, backendClass: CmsBackendClass) => void;
registerEditorComponent: (options: EditorComponentOptions) => void; registerEditorComponent: (options: EditorComponentOptions) => void;
registerEventListener: (
eventListener: CmsEventListener,
options: CmsEventListenerOptions,
) => void;
registerLocale: (locale: string, phrases: CmsLocalePhrases) => void; registerLocale: (locale: string, phrases: CmsLocalePhrases) => void;
registerMediaLibrary: (mediaLibrary: CmsMediaLibrary, options?: CmsMediaLibraryOptions) => void; registerMediaLibrary: (mediaLibrary: CmsMediaLibrary, options?: CmsMediaLibraryOptions) => void;
registerPreviewStyle: (filePath: string, options?: PreviewStyleOptions) => void; registerPreviewStyle: (filePath: string, options?: PreviewStyleOptions) => void;