chore(richtext-*): roll-back richtext adapter change
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo } from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { RichTextField } from '../../../../../fields/config/types'
|
import type { RichTextField } from '../../../../../fields/config/types'
|
||||||
import type { RichTextAdapter } from './types'
|
import type { RichTextAdapter } from './types'
|
||||||
@@ -7,11 +7,7 @@ const RichText: React.FC<RichTextField> = (fieldprops) => {
|
|||||||
const editor: RichTextAdapter = fieldprops.editor
|
const editor: RichTextAdapter = fieldprops.editor
|
||||||
const { FieldComponent } = editor
|
const { FieldComponent } = editor
|
||||||
|
|
||||||
const FieldComponentImpl: React.FC<any> = useMemo(() => {
|
return <FieldComponent {...fieldprops} />
|
||||||
return FieldComponent()
|
|
||||||
}, [FieldComponent])
|
|
||||||
|
|
||||||
return <FieldComponentImpl {...fieldprops} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RichText
|
export default RichText
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ export type RichTextAdapter<
|
|||||||
AdapterProps = any,
|
AdapterProps = any,
|
||||||
ExtraFieldProperties = {},
|
ExtraFieldProperties = {},
|
||||||
> = {
|
> = {
|
||||||
CellComponent: () => React.FC<
|
CellComponent: React.FC<
|
||||||
CellComponentProps<RichTextField<Value, AdapterProps, ExtraFieldProperties>>
|
CellComponentProps<RichTextField<Value, AdapterProps, ExtraFieldProperties>>
|
||||||
>
|
>
|
||||||
FieldComponent: () => React.FC<RichTextFieldProps<Value, AdapterProps, ExtraFieldProperties>>
|
FieldComponent: React.FC<RichTextFieldProps<Value, AdapterProps, ExtraFieldProperties>>
|
||||||
afterReadPromise?: ({
|
afterReadPromise?: ({
|
||||||
field,
|
field,
|
||||||
incomingEditorState,
|
incomingEditorState,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo } from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { RichTextField } from '../../../../../../../../fields/config/types'
|
import type { RichTextField } from '../../../../../../../../fields/config/types'
|
||||||
import type { RichTextAdapter } from '../../../../../../forms/field-types/RichText/types'
|
import type { RichTextAdapter } from '../../../../../../forms/field-types/RichText/types'
|
||||||
@@ -9,11 +9,7 @@ const RichTextCell: React.FC<CellComponentProps<RichTextField>> = (props) => {
|
|||||||
const editor: RichTextAdapter = props.field.editor
|
const editor: RichTextAdapter = props.field.editor
|
||||||
const { CellComponent } = editor
|
const { CellComponent } = editor
|
||||||
|
|
||||||
const CellComponentImpl: React.FC<any> = useMemo(() => {
|
return <CellComponent {...props} />
|
||||||
return CellComponent()
|
|
||||||
}, [CellComponent])
|
|
||||||
|
|
||||||
return <CellComponentImpl {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RichTextCell
|
export default RichTextCell
|
||||||
|
|||||||
@@ -57,13 +57,11 @@ export function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapte
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
CellComponent: () =>
|
CellComponent: withMergedProps({
|
||||||
withMergedProps({
|
|
||||||
Component: RichTextCell,
|
Component: RichTextCell,
|
||||||
toMergeIntoProps: { editorConfig: finalSanitizedEditorConfig },
|
toMergeIntoProps: { editorConfig: finalSanitizedEditorConfig },
|
||||||
}),
|
}),
|
||||||
FieldComponent: () =>
|
FieldComponent: withMergedProps({
|
||||||
withMergedProps({
|
|
||||||
Component: RichTextField,
|
Component: RichTextField,
|
||||||
toMergeIntoProps: { editorConfig: finalSanitizedEditorConfig },
|
toMergeIntoProps: { editorConfig: finalSanitizedEditorConfig },
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -13,13 +13,11 @@ export function slateEditor(
|
|||||||
args: AdapterArguments,
|
args: AdapterArguments,
|
||||||
): RichTextAdapter<any[], AdapterArguments, AdapterArguments> {
|
): RichTextAdapter<any[], AdapterArguments, AdapterArguments> {
|
||||||
return {
|
return {
|
||||||
CellComponent: () =>
|
CellComponent: withMergedProps({
|
||||||
withMergedProps({
|
|
||||||
Component: RichTextCell,
|
Component: RichTextCell,
|
||||||
toMergeIntoProps: args,
|
toMergeIntoProps: args,
|
||||||
}),
|
}),
|
||||||
FieldComponent: () =>
|
FieldComponent: withMergedProps({
|
||||||
withMergedProps({
|
|
||||||
Component: RichTextField,
|
Component: RichTextField,
|
||||||
toMergeIntoProps: args,
|
toMergeIntoProps: args,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user