refactor(editor): edgeless text toolbar config extension (#10811)

This commit is contained in:
fundon
2025-03-20 02:08:15 +00:00
parent cdd405bbe5
commit 1acc7e5a9e
9 changed files with 527 additions and 43 deletions

View File

@@ -11,13 +11,13 @@ export function getMostCommonValue<T, F extends keyof T>(
return record?.[field];
}
export function getMostCommonResolvedValue<
T,
F extends Exclude<keyof T, symbol>,
U,
>(records: T[], field: F, resolve: (value: T[F]) => U) {
export function getMostCommonResolvedValue<T, F extends keyof T, U>(
records: T[],
field: F,
resolve: (value: T[F]) => U
) {
return getMostCommonValue(
records.map(record => ({ [field]: resolve(record[field]) })),
field
String(field)
);
}