jodit-react 5.0.0-beta.2 → 5.0.0-beta.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/build/jodit-react.js +1 -1
- package/build/types/JoditEditor.d.ts +2 -1
- package/examples/components/Form.tsx +1 -0
- package/index.d.ts +4 -1
- package/package.json +4 -3
- package/src/JoditEditor.tsx +10 -3
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { IJodit } from 'jodit/types/types/jodit';
|
|
3
3
|
import type { Jodit as JoditConstructorType } from 'jodit';
|
|
4
|
+
import type { Config } from 'jodit/config';
|
|
4
5
|
import { Jodit } from './include.jodit';
|
|
5
6
|
type DeepPartial<T> = T extends object ? {
|
|
6
7
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
8
|
} : T;
|
|
8
9
|
interface Props<T extends typeof JoditConstructorType = typeof Jodit> {
|
|
9
10
|
JoditConstructor?: T;
|
|
10
|
-
config?: DeepPartial<
|
|
11
|
+
config?: DeepPartial<Config>;
|
|
11
12
|
className?: string;
|
|
12
13
|
id?: string;
|
|
13
14
|
name?: string;
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jodit-react",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.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/)",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"jodit": "^4.2.47"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"react": "~0.14 || ^15
|
|
23
|
-
"react-dom": "~0.14 || ^15
|
|
22
|
+
"react": "~0.14 || ^15 || ^16 || ^17 || ^18 || ^19",
|
|
23
|
+
"react-dom": "~0.14 || ^15 || ^16 || ^17 || ^18 || ^19"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@eslint/compat": "^1.2.4",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"react-dom": "^18.3.1",
|
|
41
41
|
"style-loader": "^4.0.0",
|
|
42
42
|
"swc-loader": "^0.2.6",
|
|
43
|
+
"typescript": "^5.7.2",
|
|
43
44
|
"webpack": "^5.97.1",
|
|
44
45
|
"webpack-cli": "^5.1.4",
|
|
45
46
|
"webpack-dev-server": "^5.1.0"
|
package/src/JoditEditor.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, forwardRef, useLayoutEffect } from 'react';
|
|
2
2
|
import type { IJodit } from 'jodit/types/types/jodit';
|
|
3
3
|
import type { Jodit as JoditConstructorType } from 'jodit';
|
|
4
|
+
import type { Config } from 'jodit/config';
|
|
4
5
|
import { Jodit } from './include.jodit';
|
|
5
6
|
|
|
6
7
|
function usePrevious(value: string): string {
|
|
@@ -19,7 +20,7 @@ type DeepPartial<T> = T extends object
|
|
|
19
20
|
|
|
20
21
|
interface Props<T extends typeof JoditConstructorType = typeof Jodit> {
|
|
21
22
|
JoditConstructor?: T;
|
|
22
|
-
config?: DeepPartial<
|
|
23
|
+
config?: DeepPartial<Config>;
|
|
23
24
|
className?: string;
|
|
24
25
|
id?: string;
|
|
25
26
|
name?: string;
|
|
@@ -84,11 +85,17 @@ const JoditEditor = forwardRef<IJodit, Props>(
|
|
|
84
85
|
preClassName !== className &&
|
|
85
86
|
typeof preClassName === 'string'
|
|
86
87
|
) {
|
|
87
|
-
preClassName
|
|
88
|
+
preClassName
|
|
89
|
+
.split(/\s+/)
|
|
90
|
+
.filter(Boolean)
|
|
91
|
+
.forEach(cl => classList?.remove(cl));
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
if (className && typeof className === 'string') {
|
|
91
|
-
className
|
|
95
|
+
className
|
|
96
|
+
.split(/\s+/)
|
|
97
|
+
.filter(Boolean)
|
|
98
|
+
.forEach(cl => classList?.add(cl));
|
|
92
99
|
}
|
|
93
100
|
}, [className, preClassName]);
|
|
94
101
|
|