Skip to content

Commit

Permalink
New version 5.0.0-beta.3. Read more https://github.com/jodit/jodit-re…
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Dec 11, 2024
1 parent 5c634d5 commit 16a9da9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions examples/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Form = () => {
const [isSource, setSource] = useState(false);

const [config, setConfig] = useState({
toolbarAdaptive: false,
readonly: false,
toolbar: true
});
Expand Down
5 changes: 4 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export type * from './build/types/index.d.ts';
import JoditEditor from './build/types/JoditEditor';
import { Jodit } from './build/types/include.jodit';
export default JoditEditor;
export { Jodit };
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jodit-react",
"version": "5.0.0-beta.2",
"version": "5.0.0-beta.3",
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
"main": "build/jodit-react.js",
"author": "Chupurnov <[email protected]> (https://xdsoft.net/)",
Expand All @@ -19,8 +19,8 @@
"jodit": "^4.2.47"
},
"peerDependencies": {
"react": "~0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "~0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
"react": "~0.14 || ^15 || ^16 || ^17 || ^18 || ^19",
"react-dom": "~0.14 || ^15 || ^16 || ^17 || ^18 || ^19"
},
"devDependencies": {
"@eslint/compat": "^1.2.4",
Expand All @@ -40,6 +40,7 @@
"react-dom": "^18.3.1",
"style-loader": "^4.0.0",
"swc-loader": "^0.2.6",
"typescript": "^5.7.2",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
Expand Down
13 changes: 10 additions & 3 deletions src/JoditEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useRef, forwardRef, useLayoutEffect } from 'react';
import type { IJodit } from 'jodit/types/types/jodit';
import type { Jodit as JoditConstructorType } from 'jodit';
import type { Config } from 'jodit/config';
import { Jodit } from './include.jodit';

function usePrevious(value: string): string {
Expand All @@ -19,7 +20,7 @@ type DeepPartial<T> = T extends object

interface Props<T extends typeof JoditConstructorType = typeof Jodit> {
JoditConstructor?: T;
config?: DeepPartial<ReturnType<T['make']>['options']>;
config?: DeepPartial<Config>;
className?: string;
id?: string;
name?: string;
Expand Down Expand Up @@ -84,11 +85,17 @@ const JoditEditor = forwardRef<IJodit, Props>(
preClassName !== className &&
typeof preClassName === 'string'
) {
preClassName.split(/\s+/).forEach(cl => classList?.remove(cl));
preClassName
.split(/\s+/)
.filter(Boolean)
.forEach(cl => classList?.remove(cl));
}

if (className && typeof className === 'string') {
className.split(/\s+/).forEach(cl => classList?.add(cl));
className
.split(/\s+/)
.filter(Boolean)
.forEach(cl => classList?.add(cl));
}
}, [className, preClassName]);

Expand Down

0 comments on commit 16a9da9

Please sign in to comment.