feat: allow customizing the link fields (#2559)

This commit is contained in:
Michel v. Varendorff
2023-04-26 17:08:47 +02:00
committed by GitHub
parent ddb34c3d83
commit bf6522898d
7 changed files with 91 additions and 22 deletions

View File

@@ -413,7 +413,10 @@ export const richText = baseField.keys({
})),
}),
link: joi.object({
fields: joi.array().items(joi.link('#field')),
fields: joi.alternatives(
joi.array().items(joi.link('#field')),
joi.func(),
),
}),
}),
});

View File

@@ -1,9 +1,10 @@
/* eslint-disable no-use-before-define */
import { CSSProperties } from 'react';
import { Editor } from 'slate';
import type { TFunction } from 'i18next';
import type { TFunction, i18n as Ii18n } from 'i18next';
import type { EditorProps } from '@monaco-editor/react';
import { Operation, Where } from '../../types';
import { SanitizedConfig } from "../../config/types";
import { TypeWithID } from '../../collections/config/types';
import { PayloadRequest } from '../../express/types';
import { ConditionalDateProps } from '../../admin/components/elements/DatePicker/types';
@@ -353,7 +354,7 @@ export type RichTextField = FieldBase & {
}
}
link?: {
fields?: Field[];
fields?: Field[] | ((args: {defaultFields: Field[], config: SanitizedConfig, i18n: Ii18n}) => Field[]);
}
}
}