jodit-pro-react 5.4.14 → 5.4.17
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/esm/JoditEditor.css +9504 -0
- package/build/esm/JoditEditor.d.mts +20 -0
- package/build/esm/JoditEditor.mjs +6 -0
- package/build/esm/chunk-O64OOYGL.mjs +48273 -0
- package/build/esm/index.css +2046 -7565
- package/build/esm/index.d.mts +7 -10
- package/build/esm/index.mjs +7 -48186
- package/build/jodit-react.js +1 -1
- package/build/jodit-react.js.LICENSE.txt +0 -16
- package/build/types/JoditEditor.d.ts +17 -0
- package/build/types/JoditEditor.js +101 -0
- package/build/types/include.jodit.d.ts +4 -3
- package/build/types/include.jodit.js +3 -3
- package/build/types/index.d.ts +4 -8
- package/build/types/index.js +1 -6
- package/package.json +2 -1
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/*!
|
|
8
|
-
* Jodit Editor PRO (https://xdsoft.net/jodit/)
|
|
9
|
-
* See LICENSE.md in the project root for license information.
|
|
10
|
-
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
7
|
/*!
|
|
14
8
|
* a-color-picker
|
|
15
9
|
* https://github.com/narsenico/a-color-picker
|
|
@@ -38,13 +32,3 @@
|
|
|
38
32
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
39
33
|
* Released under the MIT License.
|
|
40
34
|
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @license React
|
|
44
|
-
* react-jsx-runtime.production.js
|
|
45
|
-
*
|
|
46
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the MIT license found in the
|
|
49
|
-
* LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DeepPartial } from 'jodit/esm/types';
|
|
2
|
+
import { type Config, Jodit as JoditBaseConstructor } from './include.jodit';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface JoditEditorProps<T extends typeof JoditBaseConstructor = typeof JoditBaseConstructor> {
|
|
5
|
+
JoditConstructor?: T;
|
|
6
|
+
config?: DeepPartial<Config>;
|
|
7
|
+
className?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
onBlur?: (value: string, event: MouseEvent) => void;
|
|
11
|
+
onChange?: (value: string) => void;
|
|
12
|
+
tabIndex?: number;
|
|
13
|
+
value?: string;
|
|
14
|
+
editorRef?: (editor: JoditBaseConstructor) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const JoditEditor: React.ForwardRefExoticComponent<JoditEditorProps<typeof JoditBaseConstructor> & React.RefAttributes<JoditBaseConstructor>>;
|
|
17
|
+
export default JoditEditor;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Jodit as JoditBaseConstructor } from './include.jodit';
|
|
2
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
3
|
+
function usePrevious(value) {
|
|
4
|
+
const ref = useRef('');
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ref.current = value;
|
|
7
|
+
}, [value]);
|
|
8
|
+
return ref.current;
|
|
9
|
+
}
|
|
10
|
+
const JoditEditor = forwardRef(({ JoditConstructor = JoditBaseConstructor, className, config, id, name, onBlur, onChange, tabIndex, value, editorRef }, ref) => {
|
|
11
|
+
const textAreaRef = useRef(null);
|
|
12
|
+
const joditRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const element = textAreaRef.current;
|
|
15
|
+
const jodit = JoditConstructor.make(element, config);
|
|
16
|
+
joditRef.current = jodit;
|
|
17
|
+
if (typeof editorRef === 'function') {
|
|
18
|
+
editorRef(jodit);
|
|
19
|
+
}
|
|
20
|
+
return () => {
|
|
21
|
+
if (jodit.isReady) {
|
|
22
|
+
jodit.destruct();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
jodit
|
|
26
|
+
.waitForReady()
|
|
27
|
+
.then((joditInstance) => joditInstance.destruct());
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [JoditConstructor, config, editorRef]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (ref) {
|
|
33
|
+
if (typeof ref === 'function') {
|
|
34
|
+
ref(joditRef.current);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
ref.current = joditRef.current;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [textAreaRef, ref, joditRef]);
|
|
41
|
+
const preClassName = usePrevious(className ?? '');
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const classList = joditRef.current?.container?.classList;
|
|
44
|
+
if (preClassName !== className &&
|
|
45
|
+
typeof preClassName === 'string') {
|
|
46
|
+
preClassName
|
|
47
|
+
.split(/\s+/)
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.forEach((cl) => classList?.remove(cl));
|
|
50
|
+
}
|
|
51
|
+
if (className && typeof className === 'string') {
|
|
52
|
+
className
|
|
53
|
+
.split(/\s+/)
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.forEach((cl) => classList?.add(cl));
|
|
56
|
+
}
|
|
57
|
+
}, [className, preClassName]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (joditRef.current?.workplace) {
|
|
60
|
+
joditRef.current.workplace.tabIndex = tabIndex || -1;
|
|
61
|
+
}
|
|
62
|
+
}, [tabIndex]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const jodit = joditRef.current;
|
|
65
|
+
if (!jodit?.events || !(onBlur || onChange)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const onBlurHandler = (event) => onBlur && onBlur(joditRef?.current?.value ?? '', event);
|
|
69
|
+
const onChangeHandler = (value) => onChange && onChange(value);
|
|
70
|
+
// adding event handlers
|
|
71
|
+
jodit.events
|
|
72
|
+
.on('blur', onBlurHandler)
|
|
73
|
+
.on('change', onChangeHandler);
|
|
74
|
+
return () => {
|
|
75
|
+
// Remove event handlers
|
|
76
|
+
jodit.events
|
|
77
|
+
?.off('blur', onBlurHandler)
|
|
78
|
+
.off('change', onChangeHandler);
|
|
79
|
+
};
|
|
80
|
+
}, [onBlur, onChange]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const jodit = joditRef.current;
|
|
83
|
+
const updateValue = () => {
|
|
84
|
+
if (jodit && value !== undefined && jodit.value !== value) {
|
|
85
|
+
jodit.value = value;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
if (jodit) {
|
|
89
|
+
if (jodit.isReady) {
|
|
90
|
+
updateValue();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
jodit.waitForReady().then(updateValue);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [value]);
|
|
97
|
+
return (React.createElement("div", { className: 'jodit-react-container' },
|
|
98
|
+
React.createElement("textarea", { defaultValue: value, name: name, id: id, ref: textAreaRef })));
|
|
99
|
+
});
|
|
100
|
+
JoditEditor.displayName = 'JoditEditor';
|
|
101
|
+
export default JoditEditor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import 'jodit-pro/esm/plugins/all';
|
|
1
|
+
import 'jodit-pro/esm/plugins/all.js';
|
|
2
2
|
|
|
3
|
-
import { Jodit as JoditConstructor } from 'jodit-pro/esm/index';
|
|
4
|
-
export
|
|
3
|
+
import { Jodit as JoditConstructor } from 'jodit-pro/esm/index.js';
|
|
4
|
+
export { Config } from 'jodit-pro/esm/config';
|
|
5
|
+
export { JoditConstructor as Jodit };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'jodit-pro/esm/plugins/all';
|
|
1
|
+
import 'jodit-pro/esm/plugins/all.js';
|
|
2
2
|
import 'jodit-pro/es2021/jodit.fat.min.css';
|
|
3
|
-
import { Jodit as JoditConstructor } from 'jodit-pro/esm/index';
|
|
4
|
-
export
|
|
3
|
+
import { Jodit as JoditConstructor } from 'jodit-pro/esm/index.js';
|
|
4
|
+
export { JoditConstructor as Jodit };
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* See LICENSE.md in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
|
|
5
|
-
*/
|
|
6
|
-
import { Jodit } from './include.jodit';
|
|
7
|
-
import JoditEditor from 'jodit-react/build/types/JoditEditor';
|
|
1
|
+
import { Config, Jodit } from './include.jodit';
|
|
2
|
+
import JoditEditor from './JoditEditor';
|
|
8
3
|
export default JoditEditor;
|
|
9
|
-
export { Jodit };
|
|
4
|
+
export { Config, Jodit };
|
|
5
|
+
export type { JoditEditorProps } from './JoditEditor';
|
package/build/types/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor PRO (https://xdsoft.net/jodit/)
|
|
3
|
-
* See LICENSE.md in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
|
|
5
|
-
*/
|
|
6
1
|
import { Jodit } from './include.jodit';
|
|
7
|
-
import JoditEditor from '
|
|
2
|
+
import JoditEditor from './JoditEditor';
|
|
8
3
|
export default JoditEditor;
|
|
9
4
|
export { Jodit };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jodit-pro-react",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.17",
|
|
4
4
|
"description": "Jodit PRO is awesome and usefully wysiwyg editor with filebrowser",
|
|
5
5
|
"main": "build/jodit-react.js",
|
|
6
6
|
"module": "./build/esm/index.mjs",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@swc-node/register": "^1.10.9",
|
|
56
|
+
"@types/react": "^19.2.10",
|
|
56
57
|
"cross-env": "^10.1.0",
|
|
57
58
|
"css-loader": "^7.1.2",
|
|
58
59
|
"html-webpack-plugin": "^5.6.3",
|