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