@performant-software/shared-components 1.0.8-beta.0 → 1.0.8-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/main.css +946 -0
- package/package.json +1 -1
- package/src/components/RichTextArea.css +2 -0
- package/src/components/RichTextArea.js +19 -22
- package/types/components/RichTextArea.js.flow +19 -22
- package/webpack.config.js +11 -1
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { lazy } from 'react';
|
|
4
4
|
import withSuspense from '../hooks/Suspense';
|
|
5
|
-
import 'react-quill/dist/quill.snow.css';
|
|
6
5
|
import './RichTextArea.css';
|
|
7
6
|
|
|
8
7
|
type Props = {
|
|
@@ -13,32 +12,30 @@ type Props = {
|
|
|
13
12
|
value: ?string
|
|
14
13
|
};
|
|
15
14
|
|
|
15
|
+
const ReactQuill = lazy(() => import('react-quill'));
|
|
16
|
+
|
|
16
17
|
const SEARCH_EMPTY = '<p><br></p>';
|
|
17
18
|
const REPLACE_EMPTY = '';
|
|
18
19
|
|
|
19
|
-
const RichTextArea = withSuspense((props: Props) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
modules={props.modules}
|
|
27
|
-
onChange={(value) => {
|
|
28
|
-
let newValue = value;
|
|
20
|
+
const RichTextArea = withSuspense((props: Props) => (
|
|
21
|
+
<ReactQuill
|
|
22
|
+
className='rich-text-area'
|
|
23
|
+
formats={props.formats}
|
|
24
|
+
modules={props.modules}
|
|
25
|
+
onChange={(value) => {
|
|
26
|
+
let newValue = value;
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (value === SEARCH_EMPTY) {
|
|
29
|
+
newValue = REPLACE_EMPTY;
|
|
30
|
+
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
32
|
+
props.onChange(newValue);
|
|
33
|
+
}}
|
|
34
|
+
placeholder={props.placeholder}
|
|
35
|
+
theme='snow'
|
|
36
|
+
value={props.value}
|
|
37
|
+
/>
|
|
38
|
+
));
|
|
42
39
|
|
|
43
40
|
RichTextArea.defaultProps = {
|
|
44
41
|
formats: [
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { lazy } from 'react';
|
|
4
4
|
import withSuspense from '../hooks/Suspense';
|
|
5
|
-
import 'react-quill/dist/quill.snow.css';
|
|
6
5
|
import './RichTextArea.css';
|
|
7
6
|
|
|
8
7
|
type Props = {
|
|
@@ -13,32 +12,30 @@ type Props = {
|
|
|
13
12
|
value: ?string
|
|
14
13
|
};
|
|
15
14
|
|
|
15
|
+
const ReactQuill = lazy(() => import('react-quill'));
|
|
16
|
+
|
|
16
17
|
const SEARCH_EMPTY = '<p><br></p>';
|
|
17
18
|
const REPLACE_EMPTY = '';
|
|
18
19
|
|
|
19
|
-
const RichTextArea = withSuspense((props: Props) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
modules={props.modules}
|
|
27
|
-
onChange={(value) => {
|
|
28
|
-
let newValue = value;
|
|
20
|
+
const RichTextArea = withSuspense((props: Props) => (
|
|
21
|
+
<ReactQuill
|
|
22
|
+
className='rich-text-area'
|
|
23
|
+
formats={props.formats}
|
|
24
|
+
modules={props.modules}
|
|
25
|
+
onChange={(value) => {
|
|
26
|
+
let newValue = value;
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (value === SEARCH_EMPTY) {
|
|
29
|
+
newValue = REPLACE_EMPTY;
|
|
30
|
+
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
32
|
+
props.onChange(newValue);
|
|
33
|
+
}}
|
|
34
|
+
placeholder={props.placeholder}
|
|
35
|
+
theme='snow'
|
|
36
|
+
value={props.value}
|
|
37
|
+
/>
|
|
38
|
+
));
|
|
42
39
|
|
|
43
40
|
RichTextArea.defaultProps = {
|
|
44
41
|
formats: [
|
package/webpack.config.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
const { configure } = require('@performant-software/webpack-config');
|
|
2
|
+
const path = require('path');
|
|
2
3
|
|
|
3
|
-
module.exports = configure(__dirname
|
|
4
|
+
module.exports = configure(__dirname, {
|
|
5
|
+
resolve: {
|
|
6
|
+
alias: {
|
|
7
|
+
'./react-quill/dist/quill.snow.css$': path.resolve(
|
|
8
|
+
__dirname,
|
|
9
|
+
'../../node_modules/react-quill/dist/quill.snow.css'
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|