Browse Source

Add callback events to i18n

type-event-callbacks
Artur Arseniev 1 month ago
parent
commit
8029fb1209
  1. 5
      packages/core/src/editor/types.ts
  2. 8
      packages/core/src/i18n/types.ts

5
packages/core/src/editor/types.ts

@ -6,6 +6,7 @@ import { CommandEvent, CommandsEventCallback } from '../commands/types';
import { DataSourceEvent, DataSourcesEventCallback } from '../data_sources/types';
import { DeviceEvent, DevicesEventCallback } from '../device_manager/types';
import { ComponentEvent } from '../dom_components';
import { I18nEvent, I18nEventCallback } from '../i18n/types';
import { KeymapEvent } from '../keymaps';
import { ModalEvent } from '../modal_dialog';
import { RichTextEditorEvent } from '../rich_text_editor';
@ -19,6 +20,7 @@ type GeneralEvent = 'canvasScroll' | 'undo' | 'redo' | 'load' | 'update';
type EditorBuiltInEvents =
| DataSourceEvent
| DeviceEvent
| I18nEvent
| ComponentEvent
| BlockEvent
| AssetEvent
@ -44,7 +46,8 @@ export interface EditorEventCallbacks
CanvasEventCallback,
CommandsEventCallback,
DataSourcesEventCallback,
DevicesEventCallback
DevicesEventCallback,
I18nEventCallback
{
[key: string]: any[];
}

8
packages/core/src/i18n/types.ts

@ -27,5 +27,13 @@ export enum I18nEvents {
}
/**{END_EVENTS}*/
export type I18nEvent = `${I18nEvents}`;
export interface I18nEventCallback {
[I18nEvents.add]: [Messages];
[I18nEvents.update]: [Messages];
[I18nEvents.locale]: [{ value: string; valuePrev: string | undefined }];
}
// need this to avoid the TS documentation generator to break
export default I18nEvents;

Loading…
Cancel
Save