diff --git a/packages/roosterjs-content-model-types/lib/index.ts b/packages/roosterjs-content-model-types/lib/index.ts index 888ccf1263b..424699a4fb5 100644 --- a/packages/roosterjs-content-model-types/lib/index.ts +++ b/packages/roosterjs-content-model-types/lib/index.ts @@ -445,6 +445,7 @@ export { ModelToTextCallbacks, ModelToTextChecker, } from './parameter/ModelToTextCallbacks'; +export { MergeFormatValueCallback, MergeFormatValueCallbacks } from './parameter/MergeFormatValueCallbacks'; export { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent'; export { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent'; diff --git a/packages/roosterjs-content-model-types/lib/parameter/MergeFormatValueCallback.ts b/packages/roosterjs-content-model-types/lib/parameter/MergeFormatValueCallback.ts new file mode 100644 index 00000000000..a525ff4ad4a --- /dev/null +++ b/packages/roosterjs-content-model-types/lib/parameter/MergeFormatValueCallback.ts @@ -0,0 +1,20 @@ +import type { ContentModelFormatState } from './ContentModelFormatState'; + +/** + * Callback function type to merge the values of a specific format key + * @param format The current retrieved format state + * @param newValue The new format value to merge + */ +export type MergeFormatValueCallback = ( + format: ContentModelFormatState, + newValue: ContentModelFormatState[K] | undefined +) => void; + +/** + * Callbacks to customize the behavior of merging different format values from selected content + * @param format The current retrieved format state + * @param newValue The new format value to merge + */ +export type MergeFormatValueCallbacks = { + [K in keyof ContentModelFormatState]?: MergeFormatValueCallback; +};