Skip to content

Commit b2dbcaf

Browse files
authored
fix(components): corrected issue with wrong prop type declared (#15)
- allowedAttributes prop type was declared as an object when it excpects an array
1 parent 8cebd4a commit b2dbcaf

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,12 @@ To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com)
114114
This attribute is `['p']` by default. */
115115
}
116116
allowedAttributes={
117-
{
118-
a: ['href']
119-
}
117+
[]
120118
/* Array of allowed HTML attributes for editor.
121119
All attributes disabled` by default. */
122120
}
123121
onFocus={
124-
(resp) => console.log('onFocus!', resp)
122+
resp => console.log('onFocus!', resp)
125123
/* Function that will be run when the editor gains focus.
126124
An object will be returned with the following structure:
127125
{
@@ -131,7 +129,7 @@ To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com)
131129
*/
132130
}
133131
onBlur={
134-
(resp) => console.log('onBlur!', resp)
132+
resp => console.log('onBlur!', resp)
135133
/* Function that will be run when the editor looses focus.
136134
An object will be returned with the following structure:
137135
{
@@ -141,7 +139,7 @@ To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com)
141139
*/
142140
}
143141
onInput={
144-
(resp) => console.log('onInput!', resp)
142+
resp => console.log('onInput!', resp)
145143
/* Function that will be run when text is inputted.
146144
An object will be returned with the following structure:
147145
{

examples/advanced/app.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ const App = () => (
5252
placeholder={'Placeholder text...'}
5353
disabled={false}
5454
allowedTags={['p']}
55-
allowedAttributes={{
56-
a: ['href']
57-
}}
58-
onFocus={(resp) => console.log(resp)}
59-
onBlur={(resp) => console.log(resp)}
60-
onInput={(resp) => console.log(resp)}
55+
allowedAttributes={['style']}
56+
onFocus={resp => console.log(resp)}
57+
onBlur={resp => console.log(resp)}
58+
onInput={resp => console.log(resp)}
6159
/>
6260
);
6361

specs/Editor.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default () => {
1919
props.theme.should.be.eql({});
2020
props.role.should.be.eql('textbox');
2121
props.placeholder.should.be.eql('Placeholder text...');
22-
props.allowedAttributes.should.be.eql({});
22+
props.allowedAttributes.should.be.eql([]);
2323
props.allowedTags.should.be.eql(['p']);
2424
props.disabled.should.not.be.ok();
2525

src/editor/defaultProps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
theme: {},
66
role: 'textbox',
77
placeholder: 'Placeholder text...',
8-
allowedAttributes: {},
8+
allowedAttributes: [],
99
allowedTags: ['p'],
1010
disabled: false,
1111
isGhost: false,

src/editor/propTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
aria: PropTypes.object,
88
role: PropTypes.string,
99
placeholder: PropTypes.string,
10-
allowedAttributes: PropTypes.object,
10+
allowedAttributes: PropTypes.array,
1111
allowedTags: PropTypes.array,
1212
disabled: PropTypes.bool,
1313
isGhost: PropTypes.bool,

0 commit comments

Comments
 (0)