fix: i18nInit doesn't have to be async, richtext i18n types (#5176)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { i18n } from 'i18next'
|
||||
import type { I18n } from '@payloadcms/translations'
|
||||
import type { SanitizedConfig } from 'payload/config'
|
||||
import type { Field } from 'payload/types'
|
||||
import type { Editor } from 'slate'
|
||||
@@ -16,9 +16,9 @@ export const wrapLink = (editor: Editor): void => {
|
||||
const isCollapsed = selection && Range.isCollapsed(selection)
|
||||
|
||||
const link = {
|
||||
type: 'link',
|
||||
children: isCollapsed ? [{ text: '' }] : [],
|
||||
newTab: false,
|
||||
type: 'link',
|
||||
url: undefined,
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ export const wrapLink = (editor: Editor): void => {
|
||||
*/
|
||||
export function transformExtraFields(
|
||||
customFieldSchema:
|
||||
| ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: i18n }) => Field[])
|
||||
| ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: I18n }) => Field[])
|
||||
| Field[],
|
||||
config: SanitizedConfig,
|
||||
i18n: i18n,
|
||||
i18n: I18n,
|
||||
): Field[] {
|
||||
const baseFields: Field[] = getBaseFields(config)
|
||||
|
||||
@@ -68,6 +68,7 @@ export function transformExtraFields(
|
||||
if (Array.isArray(customFieldSchema) || fields.length > 0) {
|
||||
fields.push({
|
||||
name: 'fields',
|
||||
type: 'group',
|
||||
admin: {
|
||||
style: {
|
||||
borderBottom: 0,
|
||||
@@ -79,7 +80,6 @@ export function transformExtraFields(
|
||||
fields: Array.isArray(customFieldSchema)
|
||||
? customFieldSchema.concat(extraFields)
|
||||
: extraFields,
|
||||
type: 'group',
|
||||
})
|
||||
}
|
||||
return fields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { i18n as Ii18n } from 'i18next'
|
||||
import type { I18n } from '@payloadcms/translations'
|
||||
import type { SanitizedConfig } from 'payload/config'
|
||||
import type { Field, RichTextFieldProps } from 'payload/types'
|
||||
import type { Editor } from 'slate'
|
||||
@@ -59,7 +59,7 @@ export type AdapterArguments = {
|
||||
leaves?: RichTextLeaf[]
|
||||
link?: {
|
||||
fields?:
|
||||
| ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: Ii18n }) => Field[])
|
||||
| ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: I18n }) => Field[])
|
||||
| Field[]
|
||||
}
|
||||
placeholder?: Record<string, string> | string
|
||||
|
||||
Reference in New Issue
Block a user