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>(
|
||||
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;
|
||||
|
||||
let editorOptions: UseEditorOptions;
|
||||
@@ -92,14 +92,15 @@ const RichtextWidget = <T = any, S extends CrudTextRJSFSchema = CrudTextRJSFSche
|
||||
<TextContainer>
|
||||
<RichTextEditorProvider editor={editor}>
|
||||
<TableBubbleMenu />
|
||||
<RichTextField
|
||||
controls={
|
||||
<MenuControlsContainer>
|
||||
{isMultiline ? multilineButtons : singlelineButtons}
|
||||
</MenuControlsContainer>
|
||||
}
|
||||
variant="standard"
|
||||
/>
|
||||
{!readonly && <RichTextField
|
||||
controls={
|
||||
<MenuControlsContainer>
|
||||
{isMultiline ? multilineButtons : singlelineButtons}
|
||||
</MenuControlsContainer>
|
||||
}
|
||||
variant="standard"
|
||||
/>}
|
||||
{readonly && <RichTextField variant="standard" disabled={true}/>}
|
||||
</RichTextEditorProvider>
|
||||
</TextContainer>
|
||||
<RightContainer> </RightContainer>
|
||||
|
||||
Reference in New Issue
Block a user