diff --git a/packages/sn-controls-react/src/fieldcontrols/html-editor.tsx b/packages/sn-controls-react/src/fieldcontrols/html-editor.tsx index 3c4665c25..b420a5116 100644 --- a/packages/sn-controls-react/src/fieldcontrols/html-editor.tsx +++ b/packages/sn-controls-react/src/fieldcontrols/html-editor.tsx @@ -15,12 +15,12 @@ export const HtmlEditor: React.FC< ReactClientFieldSetting & { theme?: Theme setValue?: (value: string) => void - handleChange?: (value: string) => void } > = (props) => { const initialState = props.fieldValue || (props.actionName === 'new' && changeTemplatedValue(props.settings.DefaultValue)) || '' const [value, setValue] = useState(initialState) + const readonly = props.actionName === 'browse' || props.settings.ReadOnly const editorRef = useRef(null) const containerRef = useRef(null) @@ -35,7 +35,6 @@ export const HtmlEditor: React.FC< containerRef.current!.style.height = `${contentHeight}px` }) }, [editorRef]) - const readonly = props.actionName === 'browse' || props.settings.ReadOnly const editorChangeHandler = (newValue: string) => { setValue(newValue) @@ -53,7 +52,7 @@ export const HtmlEditor: React.FC< width="100%" height="100%" value={value} - onChange={props.handleChange || editorChangeHandler} + onChange={editorChangeHandler} options={{ automaticLayout: true, contextmenu: true, diff --git a/packages/sn-controls-react/test/html-editor.test.tsx b/packages/sn-controls-react/test/html-editor.test.tsx index f5f6ccc66..378e20081 100644 --- a/packages/sn-controls-react/test/html-editor.test.tsx +++ b/packages/sn-controls-react/test/html-editor.test.tsx @@ -33,7 +33,6 @@ describe('Html Editor', () => { localization: defaultLocalization, fieldValue: '

Test

', fieldOnChange: onChange, - handleChange: onChange, } const wrapper = mount() @@ -52,7 +51,6 @@ describe('Html Editor', () => { //should be called with onChange - expect(props.handleChange).toBeCalledWith('

Changed Test

') expect(props.fieldOnChange).toBeCalledWith('

Changed Test

') }) })