File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed
packages/sn-controls-react Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ export const HtmlEditor: React.FC<
15
15
ReactClientFieldSetting & {
16
16
theme ?: Theme
17
17
setValue ?: ( value : string ) => void
18
- handleChange ?: ( value : string ) => void
19
18
}
20
19
> = ( props ) => {
21
20
const initialState =
22
21
props . fieldValue || ( props . actionName === 'new' && changeTemplatedValue ( props . settings . DefaultValue ) ) || ''
23
22
const [ value , setValue ] = useState ( initialState )
23
+ const readonly = props . actionName === 'browse' || props . settings . ReadOnly
24
24
25
25
const editorRef = useRef < MonacoEditor > ( null )
26
26
const containerRef = useRef < HTMLDivElement > ( null )
@@ -35,7 +35,6 @@ export const HtmlEditor: React.FC<
35
35
containerRef . current ! . style . height = `${ contentHeight } px`
36
36
} )
37
37
} , [ editorRef ] )
38
- const readonly = props . actionName === 'browse' || props . settings . ReadOnly
39
38
40
39
const editorChangeHandler = ( newValue : string ) => {
41
40
setValue ( newValue )
@@ -53,7 +52,7 @@ export const HtmlEditor: React.FC<
53
52
width = "100%"
54
53
height = "100%"
55
54
value = { value }
56
- onChange = { props . handleChange || editorChangeHandler }
55
+ onChange = { editorChangeHandler }
57
56
options = { {
58
57
automaticLayout : true ,
59
58
contextmenu : true ,
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ describe('Html Editor', () => {
33
33
localization : defaultLocalization ,
34
34
fieldValue : '<p>Test</p>' ,
35
35
fieldOnChange : onChange ,
36
- handleChange : onChange ,
37
36
}
38
37
39
38
const wrapper = mount ( < HtmlEditor { ...props } /> )
@@ -52,7 +51,6 @@ describe('Html Editor', () => {
52
51
53
52
//should be called with onChange
54
53
55
- expect ( props . handleChange ) . toBeCalledWith ( '<p>Changed Test</p>' )
56
54
expect ( props . fieldOnChange ) . toBeCalledWith ( '<p>Changed Test</p>' )
57
55
} )
58
56
} )
You can’t perform that action at this time.
0 commit comments