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.
@@ -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<ReturnType<T['make']>['options']>;
11
+ config?: DeepPartial<Config>;
11
12
  className?: string;
12
13
  id?: string;
13
14
  name?: string;
@@ -30,6 +30,7 @@ const Form = () => {
30
30
  const [isSource, setSource] = useState(false);
31
31
 
32
32
  const [config, setConfig] = useState({
33
+ toolbarAdaptive: false,
33
34
  readonly: false,
34
35
  toolbar: true
35
36
  });
package/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export type * from './build/types/index.d.ts';
1
+ import JoditEditor from './build/types/JoditEditor';
2
+ import { Jodit } from './build/types/include.jodit';
3
+ export default JoditEditor;
4
+ export { Jodit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit-react",
3
- "version": "5.0.0-beta.2",
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.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
23
- "react-dom": "~0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
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"
@@ -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<ReturnType<T['make']>['options']>;
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.split(/\s+/).forEach(cl => classList?.remove(cl));
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.split(/\s+/).forEach(cl => classList?.add(cl));
95
+ className
96
+ .split(/\s+/)
97
+ .filter(Boolean)
98
+ .forEach(cl => classList?.add(cl));
92
99
  }
93
100
  }, [className, preClassName]);
94
101