jodit-react 1.1.24 → 1.2.3
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/.idea/codeStyles/Project.xml +8 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/deployment.xml +154 -0
- package/.idea/encodings.xml +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +17 -0
- package/.idea/jodit-react.iml +8 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/markdown-navigator-enh.xml +29 -0
- package/.idea/markdown-navigator.xml +55 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vagrant.xml +7 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +281 -0
- package/CHANGELOG.md +16 -0
- package/SECURITY.md +10 -0
- package/build/jodit-react.js +1 -1
- package/examples/app.js +2 -2
- package/examples/components/Form.css +5 -0
- package/examples/components/Form.js +117 -0
- package/package.json +23 -2
- package/src/JoditEditor.js +64 -52
- package/src/include.jodit.js +3 -3
- package/src/index.js +3 -3
- package/.editorconfig +0 -15
- package/examples/components/From.js +0 -88
- package/examples/webpack.config.js +0 -40
- package/webpack.config.js +0 -71
package/examples/app.js
CHANGED
|
@@ -5,6 +5,6 @@ import ReactDOM from 'react-dom';
|
|
|
5
5
|
|
|
6
6
|
import 'jodit';
|
|
7
7
|
import 'jodit/build/jodit.min.css';
|
|
8
|
-
import
|
|
8
|
+
import Form from './components/Form';
|
|
9
9
|
|
|
10
|
-
ReactDOM.render(<
|
|
10
|
+
ReactDOM.render(<Form />, document.getElementById('editor'));
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import JoditEditor from '../../src/';
|
|
4
|
+
import './Form.css';
|
|
5
|
+
|
|
6
|
+
const Form = () => {
|
|
7
|
+
const [isSource, setSource] = useState(false);
|
|
8
|
+
|
|
9
|
+
const [config, setConfig] = useState({
|
|
10
|
+
readonly: false,
|
|
11
|
+
toolbar: true
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const [textAreaValue, setTextAreaValue] = useState('Test');
|
|
15
|
+
|
|
16
|
+
const [inputValue, setInputValue] = useState('');
|
|
17
|
+
|
|
18
|
+
const [spin, setSpin] = useState(1);
|
|
19
|
+
|
|
20
|
+
const toggleToolbar = useCallback(
|
|
21
|
+
() =>
|
|
22
|
+
setConfig(config => ({
|
|
23
|
+
...config,
|
|
24
|
+
toolbar: !config.toolbar
|
|
25
|
+
})),
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const toggleReadOnly = useCallback(
|
|
30
|
+
() =>
|
|
31
|
+
setConfig(config => ({
|
|
32
|
+
...config,
|
|
33
|
+
readonly: !config.readonly
|
|
34
|
+
})),
|
|
35
|
+
[]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const handleBlurAreaChange = useCallback((textAreaValue, event) => {
|
|
39
|
+
console.log('handleBlurAreaChange', textAreaValue, event);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
const handleWYSIWYGChange = useCallback(newTextAreaValue => {
|
|
43
|
+
console.log('handleWYSIWYGChange', newTextAreaValue);
|
|
44
|
+
|
|
45
|
+
setTextAreaValue(newTextAreaValue);
|
|
46
|
+
setInputValue(newTextAreaValue);
|
|
47
|
+
|
|
48
|
+
return setTextAreaValue(() => newTextAreaValue);
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
const handleNativeTextAreaChange = useCallback(e => {
|
|
52
|
+
console.log('handleNativeTextAreaChange', e.target.value);
|
|
53
|
+
setTextAreaValue(e.target.value);
|
|
54
|
+
setInputValue(e.target.value);
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
const handleInputChange = useCallback(e => {
|
|
58
|
+
const { value } = e.target;
|
|
59
|
+
setInputValue(() => value);
|
|
60
|
+
handleWYSIWYGChange(value);
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const handleSpin = useCallback(() => setSpin(spin => ++spin), []);
|
|
64
|
+
|
|
65
|
+
const onSourceChange = useCallback(e => {
|
|
66
|
+
setSource(e.target.checked);
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div>
|
|
71
|
+
<label>
|
|
72
|
+
<input
|
|
73
|
+
type="checkbox"
|
|
74
|
+
onChange={onSourceChange}
|
|
75
|
+
checked={isSource}
|
|
76
|
+
/>{' '}
|
|
77
|
+
Source
|
|
78
|
+
</label>
|
|
79
|
+
|
|
80
|
+
{!isSource ? (
|
|
81
|
+
<JoditEditor
|
|
82
|
+
config={config}
|
|
83
|
+
onChange={handleWYSIWYGChange}
|
|
84
|
+
onBlur={handleBlurAreaChange}
|
|
85
|
+
value={textAreaValue}
|
|
86
|
+
/>
|
|
87
|
+
) : (
|
|
88
|
+
<textarea
|
|
89
|
+
className={'simple-textarea'}
|
|
90
|
+
onChange={handleNativeTextAreaChange}
|
|
91
|
+
value={textAreaValue}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
|
|
95
|
+
<input
|
|
96
|
+
onChange={handleInputChange}
|
|
97
|
+
placeholder={'enter some text'}
|
|
98
|
+
type={'text'}
|
|
99
|
+
value={inputValue}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
<button onClick={toggleReadOnly} type={'button'}>
|
|
103
|
+
{'Toggle Read-Only'}
|
|
104
|
+
</button>
|
|
105
|
+
|
|
106
|
+
<button onClick={toggleToolbar} type={'button'}>
|
|
107
|
+
{'Toggle Toolbar'}
|
|
108
|
+
</button>
|
|
109
|
+
|
|
110
|
+
<button type={'button'} onClick={handleSpin}>
|
|
111
|
+
{`Spin ${spin}`}
|
|
112
|
+
</button>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default Form;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jodit-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
|
|
5
5
|
"main": "build/jodit-react.js",
|
|
6
6
|
"author": "Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)s",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@babel/core": "^7.16.0",
|
|
27
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
27
28
|
"@babel/preset-env": "^7.16.0",
|
|
28
29
|
"@babel/preset-react": "^7.16.0",
|
|
29
30
|
"@types/react": "^16.14.2",
|
|
@@ -32,6 +33,13 @@
|
|
|
32
33
|
"babel-loader": "^8.2.2",
|
|
33
34
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
34
35
|
"css-loader": "^3.6.0",
|
|
36
|
+
"eslint": "^8.9.0",
|
|
37
|
+
"eslint-config-prettier": "^8.4.0",
|
|
38
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
39
|
+
"eslint-plugin-react": "^7.28.0",
|
|
40
|
+
"husky": "^7.0.4",
|
|
41
|
+
"lint-staged": "^12.3.4",
|
|
42
|
+
"prettier": "^2.5.1",
|
|
35
43
|
"react": "^16.14.0",
|
|
36
44
|
"react-dom": "^16.14.0",
|
|
37
45
|
"style-loader": "^0.20.3",
|
|
@@ -40,8 +48,10 @@
|
|
|
40
48
|
"webpack-dev-server": "^3.11.0"
|
|
41
49
|
},
|
|
42
50
|
"scripts": {
|
|
43
|
-
"newversion": "npm update && rm -rf build/ && npm run build && npm version patch --no-git-tag-version && npm run github && npm publish ./",
|
|
51
|
+
"newversion": "npm run lint && npm update && rm -rf build/ && npm run build && npm version patch --no-git-tag-version && npm run github && npm publish ./",
|
|
52
|
+
"lint": "eslint ./",
|
|
44
53
|
"demo": "cd examples && export NODE_ENV=development && webpack-dev-server --config ./webpack.config.js --mode development --port 4000 --hot --inline",
|
|
54
|
+
"start": "npm run demo",
|
|
45
55
|
"build": "export NODE_ENV=production && webpack --mode production",
|
|
46
56
|
"github": "git add --all && git commit -m \"New version $npm_package_version. Read more https://github.com/jodit/jodit-react/releases/tag/$npm_package_version \" && git tag $npm_package_version && git push --tags origin HEAD:master"
|
|
47
57
|
},
|
|
@@ -53,5 +63,16 @@
|
|
|
53
63
|
"bugs": {
|
|
54
64
|
"url": "https://github.com/jodit/jodit-react/issues"
|
|
55
65
|
},
|
|
66
|
+
"husky": {
|
|
67
|
+
"hooks": {
|
|
68
|
+
"pre-commit": "lint-staged"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"lint-staged": {
|
|
72
|
+
"**/*.js": [
|
|
73
|
+
"eslint ./ --fix",
|
|
74
|
+
"git add"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
56
77
|
"homepage": "https://xdsoft.net/jodit/"
|
|
57
78
|
}
|
package/src/JoditEditor.js
CHANGED
|
@@ -1,64 +1,76 @@
|
|
|
1
|
-
import React, { useEffect, useRef, forwardRef, useLayoutEffect } from 'react'
|
|
2
|
-
import { func, number, object, string } from 'prop-types'
|
|
3
|
-
import { Jodit } from './include.jodit'
|
|
1
|
+
import React, { useEffect, useRef, forwardRef, useLayoutEffect } from 'react';
|
|
2
|
+
import { func, number, object, string } from 'prop-types';
|
|
3
|
+
import { Jodit } from './include.jodit';
|
|
4
|
+
const { isFunction } = Jodit.modules.Helpers;
|
|
4
5
|
|
|
5
|
-
const JoditEditor = forwardRef(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
tabIndex,
|
|
12
|
-
value,
|
|
13
|
-
editorRef
|
|
14
|
-
}, ref) => {
|
|
15
|
-
const textArea = useRef()
|
|
6
|
+
const JoditEditor = forwardRef(
|
|
7
|
+
(
|
|
8
|
+
{ config, id, name, onBlur, onChange, tabIndex, value, editorRef },
|
|
9
|
+
ref
|
|
10
|
+
) => {
|
|
11
|
+
const textArea = useRef();
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
if (ref) {
|
|
15
|
+
if (isFunction(ref)) {
|
|
16
|
+
ref(textArea.current);
|
|
17
|
+
} else {
|
|
18
|
+
ref.current = textArea.current;
|
|
19
|
+
}
|
|
23
20
|
}
|
|
24
|
-
}
|
|
25
|
-
}, [textArea])
|
|
21
|
+
}, [textArea]);
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const element = textArea.current;
|
|
25
|
+
textArea.current = Jodit.make(element, config);
|
|
26
|
+
textArea.current.workplace.tabIndex = tabIndex || -1;
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
// adding event handlers
|
|
29
|
+
textArea.current.events.on(
|
|
30
|
+
'blur',
|
|
31
|
+
e => onBlur && onBlur(textArea.current.value, e)
|
|
32
|
+
);
|
|
33
|
+
textArea.current.events.on(
|
|
34
|
+
'change',
|
|
35
|
+
value => onChange && onChange(value)
|
|
36
|
+
);
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
if (id) {
|
|
39
|
+
element.id = id;
|
|
40
|
+
}
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if (name) {
|
|
43
|
+
element.name = name;
|
|
44
|
+
}
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
textArea.current.destruct()
|
|
46
|
+
if (isFunction(editorRef)) {
|
|
47
|
+
editorRef(textArea.current);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
return () => {
|
|
51
|
+
if (textArea?.current) {
|
|
52
|
+
textArea.current.destruct();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
textArea.current = element;
|
|
56
|
+
};
|
|
57
|
+
}, [config]);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (textArea?.current?.value !== value) {
|
|
61
|
+
textArea.current.value = value;
|
|
62
|
+
}
|
|
63
|
+
}, [value]);
|
|
51
64
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
return (
|
|
66
|
+
<div className={'jodit-react-container'}>
|
|
67
|
+
<textarea ref={textArea} />
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
<textarea ref={textArea} />
|
|
60
|
-
)
|
|
61
|
-
})
|
|
73
|
+
JoditEditor.displayName = 'JoditEditor';
|
|
62
74
|
|
|
63
75
|
JoditEditor.propTypes = {
|
|
64
76
|
config: object,
|
|
@@ -68,7 +80,7 @@ JoditEditor.propTypes = {
|
|
|
68
80
|
onChange: func,
|
|
69
81
|
editorRef: func,
|
|
70
82
|
tabIndex: number,
|
|
71
|
-
value: string
|
|
72
|
-
}
|
|
83
|
+
value: string
|
|
84
|
+
};
|
|
73
85
|
|
|
74
|
-
export default JoditEditor
|
|
86
|
+
export default JoditEditor;
|
package/src/include.jodit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Jodit } from 'jodit'
|
|
2
|
-
import 'jodit/build/jodit.min.css'
|
|
1
|
+
import { Jodit } from 'jodit';
|
|
2
|
+
import 'jodit/build/jodit.min.css';
|
|
3
3
|
|
|
4
|
-
export {Jodit};
|
|
4
|
+
export { Jodit };
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import JoditEditor from './JoditEditor';
|
|
2
|
-
|
|
3
|
-
export default JoditEditor;
|
|
1
|
+
import JoditEditor from './JoditEditor';
|
|
2
|
+
|
|
3
|
+
export default JoditEditor;
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
indent_size = 2
|
|
7
|
-
indent_style = tab
|
|
8
|
-
trim_trailing_whitespace = true
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
|
|
11
|
-
[{LICENSE,.gitattributes,.gitignore,.npmignore,.eslintignore}]
|
|
12
|
-
indent_style = space
|
|
13
|
-
|
|
14
|
-
[*.{json,yml,md,yaspellerrc,bowerrc,babelrc,snakeskinrc,eslintrc,tsconfig,pzlrrc}]
|
|
15
|
-
indent_style = space
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
|
|
3
|
-
import JoditEditor from "../../src/";
|
|
4
|
-
|
|
5
|
-
const From = () => {
|
|
6
|
-
const [config, setConfig] = useState({
|
|
7
|
-
readonly: false,
|
|
8
|
-
toolbar: true,
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const [textAreaValue, setTextAreaValue] = useState('Test')
|
|
12
|
-
|
|
13
|
-
const [inputValue, setInputValue] = useState('')
|
|
14
|
-
|
|
15
|
-
const [spin, setSpin] = useState(1)
|
|
16
|
-
|
|
17
|
-
const toggleToolbar = () => (
|
|
18
|
-
setConfig(config => ({
|
|
19
|
-
...config,
|
|
20
|
-
toolbar: !config.toolbar,
|
|
21
|
-
}))
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const toggleReadOnly = () => (
|
|
25
|
-
setConfig(config => ({
|
|
26
|
-
...config,
|
|
27
|
-
readonly: !config.readonly,
|
|
28
|
-
}))
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
const handleBlurAreaChange = (textAreaValue, event) => {
|
|
32
|
-
console.log('handleBlurAreaChange', textAreaValue, event)
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleTextAreaChange = newTextAreaValue => {
|
|
36
|
-
console.log('handleTextAreaChange', newTextAreaValue)
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
setTextAreaValue(() => newTextAreaValue)
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const handleInputChange = e => {
|
|
44
|
-
const {value} = e.target
|
|
45
|
-
setInputValue(() => value)
|
|
46
|
-
handleTextAreaChange(value)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const handleSpin = () => setSpin(spin => ++spin)
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div>
|
|
53
|
-
<JoditEditor
|
|
54
|
-
config={config}
|
|
55
|
-
onChange={handleTextAreaChange}
|
|
56
|
-
onBlur={handleBlurAreaChange}
|
|
57
|
-
value={textAreaValue}
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<input
|
|
61
|
-
onChange={handleInputChange}
|
|
62
|
-
placeholder={"enter some text"}
|
|
63
|
-
type={"text"}
|
|
64
|
-
value={inputValue}
|
|
65
|
-
/>
|
|
66
|
-
|
|
67
|
-
<button
|
|
68
|
-
onClick={toggleReadOnly}
|
|
69
|
-
type={"button"}>
|
|
70
|
-
{'Toggle Read-Only'}
|
|
71
|
-
</button>
|
|
72
|
-
|
|
73
|
-
<button
|
|
74
|
-
onClick={toggleToolbar}
|
|
75
|
-
type={"button"}>
|
|
76
|
-
{'Toggle Toolbar'}
|
|
77
|
-
</button>
|
|
78
|
-
|
|
79
|
-
<button
|
|
80
|
-
type={"button"}
|
|
81
|
-
onClick={handleSpin}>
|
|
82
|
-
{`Spin ${spin}`}
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default From
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
entry: './app.js',
|
|
5
|
-
devtool: "eval",
|
|
6
|
-
module: {
|
|
7
|
-
rules: [
|
|
8
|
-
{
|
|
9
|
-
test: /\.js$/,
|
|
10
|
-
use: [
|
|
11
|
-
{
|
|
12
|
-
loader: 'babel-loader',
|
|
13
|
-
options: {
|
|
14
|
-
presets: [
|
|
15
|
-
"@babel/preset-env",
|
|
16
|
-
"@babel/preset-react"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
test: /\.css$/,
|
|
24
|
-
use: [
|
|
25
|
-
'style-loader',
|
|
26
|
-
'css-loader'
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
output: {
|
|
33
|
-
path: path.join(__dirname, '/build/'),
|
|
34
|
-
filename: 'app.js'
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
devServer: {
|
|
38
|
-
contentBase: './'
|
|
39
|
-
}
|
|
40
|
-
};
|
package/webpack.config.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const webpack = require("webpack");
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
module.exports = (env, argv, dir = process.cwd()) => {
|
|
5
|
-
const debug = !argv || !argv.mode || !argv.mode.match(/production/);
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
context: dir,
|
|
9
|
-
|
|
10
|
-
entry: './src/index.js',
|
|
11
|
-
devtool: debug ? 'inline-source-map' : false,
|
|
12
|
-
|
|
13
|
-
module: {
|
|
14
|
-
rules: [
|
|
15
|
-
{
|
|
16
|
-
test: /\.js$/,
|
|
17
|
-
use: {
|
|
18
|
-
loader: 'babel-loader',
|
|
19
|
-
options: require(path.join(dir, './babel.config.json'))
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
test: /\.css$/,
|
|
24
|
-
use: [
|
|
25
|
-
'style-loader',
|
|
26
|
-
'css-loader'
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
resolve: {
|
|
33
|
-
alias: {
|
|
34
|
-
"jodit-react": path.join(__dirname, './src')
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
output: {
|
|
39
|
-
path: path.join(dir, './build/'),
|
|
40
|
-
filename: 'jodit-react.js',
|
|
41
|
-
library: 'JoditEditor',
|
|
42
|
-
libraryTarget: 'umd'
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
plugins: [
|
|
46
|
-
new webpack.DefinePlugin({
|
|
47
|
-
'process.env': {
|
|
48
|
-
NODE_ENV: JSON.stringify(debug ? 'development' : 'production'),
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
externals: {
|
|
55
|
-
jodit: 'jodit',
|
|
56
|
-
Jodit: 'Jodit',
|
|
57
|
-
react: {
|
|
58
|
-
root: 'React',
|
|
59
|
-
commonjs2: 'react',
|
|
60
|
-
commonjs: 'react',
|
|
61
|
-
amd: 'react'
|
|
62
|
-
},
|
|
63
|
-
'react-dom': {
|
|
64
|
-
root: 'ReactDOM',
|
|
65
|
-
commonjs2: 'react-dom',
|
|
66
|
-
commonjs: 'react-dom',
|
|
67
|
-
amd: 'react-dom'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|