1
- import React from ' react' ;
2
- import PropTypes from ' prop-types' ;
1
+ import React from " react" ;
2
+ import PropTypes from " prop-types" ;
3
3
import { isEmpty } from 'lodash' ;
4
- import { LabelIconWrapper } from ' strapi- helper-plugin' ;
5
- import Editor from ' ../editorjs' ;
4
+ import { LabelIconWrapper } from "@ strapi/ helper-plugin" ;
5
+ import Editor from " ../editorjs" ;
6
6
7
7
import cn from 'classnames' ;
8
- import { Description , ErrorMessage , Label } from ' @buffetjs/styles' ;
9
- import { Error } from ' @buffetjs/core' ;
8
+ import { Description , ErrorMessage , Label } from " @buffetjs/styles" ;
9
+ import { Error } from " @buffetjs/core" ;
10
10
import Wrapper from './wrapper' ;
11
11
12
12
// eslint-disable-next-line react/prefer-stateless-function
@@ -36,29 +36,33 @@ class WysiwygWithErrors extends React.Component {
36
36
} = this . props ;
37
37
38
38
return (
39
- < Error inputError = { inputError } name = { name } type = "text" validations = { validations } >
39
+ < Error
40
+ inputError = { inputError }
41
+ name = { name }
42
+ type = "text"
43
+ validations = { validations }
44
+ >
40
45
{ ( { canCheck, onBlur, error, dispatch } ) => {
41
46
const hasError = Boolean ( error ) ;
42
47
43
48
return (
44
- < Wrapper
45
- className = { `${ cn ( ! isEmpty ( className ) && className ) } ${ hasError ? 'bordered' : '' } ` }
46
- style = { style }
47
- >
48
- < Label htmlFor = { name } >
49
- < span > { label } </ span >
50
- { labelIcon && (
51
- < LabelIconWrapper title = { labelIcon . title } > { labelIcon . icon } </ LabelIconWrapper >
49
+
50
+ < Wrapper size = { 1 } className = { `${ cn ( ! isEmpty ( className ) && className ) } ${ hasError ? 'bordered' : '' } ` }
51
+ style = { style } >
52
+ < Label htmlFor = { name } >
53
+ < span > { label } </ span >
54
+ { labelIcon && (
55
+ < LabelIconWrapper title = { labelIcon . title } >
56
+ { labelIcon . icon }
57
+ </ LabelIconWrapper >
58
+ ) }
59
+ </ Label >
60
+ < Editor name = { name } onChange = { onChange } value = { value } />
61
+ { ! hasError && inputDescription && (
62
+ < Description > { inputDescription } </ Description >
52
63
) }
53
- </ Label >
54
- < Editor
55
- name = { name }
56
- onChange = { onChange }
57
- value = { value }
58
- />
59
- { ! hasError && inputDescription && < Description > { inputDescription } </ Description > }
60
- { hasError && < ErrorMessage > { error } </ ErrorMessage > }
61
- </ Wrapper >
64
+ { hasError && < ErrorMessage > { error } </ ErrorMessage > }
65
+ </ Wrapper >
62
66
) ;
63
67
} }
64
68
</ Error >
@@ -68,21 +72,21 @@ class WysiwygWithErrors extends React.Component {
68
72
69
73
WysiwygWithErrors . defaultProps = {
70
74
autoFocus : false ,
71
- className : '' ,
75
+ className : "" ,
72
76
deactivateErrorHighlight : false ,
73
77
didCheckErrors : false ,
74
78
disabled : false ,
75
79
error : null ,
76
- inputClassName : '' ,
77
- inputDescription : '' ,
80
+ inputClassName : "" ,
81
+ inputDescription : "" ,
78
82
inputStyle : { } ,
79
- label : '' ,
83
+ label : "" ,
80
84
labelIcon : null ,
81
85
onBlur : false ,
82
- placeholder : '' ,
86
+ placeholder : "" ,
83
87
resetProps : false ,
84
88
style : { } ,
85
- tabIndex : '0' ,
89
+ tabIndex : "0" ,
86
90
validations : { } ,
87
91
value : null ,
88
92
} ;
0 commit comments