Allowing RichtextWidget to be readonly
This commit is contained in:
@@ -57,7 +57,7 @@ const StyledLabelledOutlined = styled(LabelledOutlined)(({ theme }) => [{
|
|||||||
const RichtextWidget = <T = any, S extends CrudTextRJSFSchema = CrudTextRJSFSchema, F extends FormContextType = any>(
|
const RichtextWidget = <T = any, S extends CrudTextRJSFSchema = CrudTextRJSFSchema, F extends FormContextType = any>(
|
||||||
props: WidgetProps<T, S, F>
|
props: WidgetProps<T, S, F>
|
||||||
) => {
|
) => {
|
||||||
const { schema, value, onChange, label, id } = props;
|
const { schema, value, onChange, label, id, readonly } = props;
|
||||||
const isMultiline = schema.props.multiline === true;
|
const isMultiline = schema.props.multiline === true;
|
||||||
|
|
||||||
let editorOptions: UseEditorOptions;
|
let editorOptions: UseEditorOptions;
|
||||||
@@ -92,14 +92,15 @@ const RichtextWidget = <T = any, S extends CrudTextRJSFSchema = CrudTextRJSFSche
|
|||||||
<TextContainer>
|
<TextContainer>
|
||||||
<RichTextEditorProvider editor={editor}>
|
<RichTextEditorProvider editor={editor}>
|
||||||
<TableBubbleMenu />
|
<TableBubbleMenu />
|
||||||
<RichTextField
|
{!readonly && <RichTextField
|
||||||
controls={
|
controls={
|
||||||
<MenuControlsContainer>
|
<MenuControlsContainer>
|
||||||
{isMultiline ? multilineButtons : singlelineButtons}
|
{isMultiline ? multilineButtons : singlelineButtons}
|
||||||
</MenuControlsContainer>
|
</MenuControlsContainer>
|
||||||
}
|
}
|
||||||
variant="standard"
|
variant="standard"
|
||||||
/>
|
/>}
|
||||||
|
{readonly && <RichTextField variant="standard" disabled={true}/>}
|
||||||
</RichTextEditorProvider>
|
</RichTextEditorProvider>
|
||||||
</TextContainer>
|
</TextContainer>
|
||||||
<RightContainer> </RightContainer>
|
<RightContainer> </RightContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user