Skip to content

Commit

Permalink
define types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain-Zheng committed Nov 8, 2024
1 parent f753bec commit 1bec03b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/roosterjs-content-model-types/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = <K extends keyof ContentModelFormatState>(
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;
};

0 comments on commit 1bec03b

Please sign in to comment.