jodit-react 5.0.0-beta.1 → 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.1",
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
 
@@ -1,18 +0,0 @@
1
- <!-- BUGS: Please use this template -->
2
- <!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/jodit -->
3
-
4
- **Jodit Version:** 3.4.xxxxx
5
-
6
- **Browser:** <!-- Chrome/IE/Safary/FF -->
7
- **OS:** <!-- Windows/Mac/Linux -->
8
- **Is React App:** <!-- True/False -->
9
-
10
- **Code**
11
-
12
- ```js
13
- // A *self-contained* demonstration of the problem follows...
14
- ```
15
-
16
- **Expected behavior:**
17
-
18
- **Actual behavior:**
@@ -1,14 +0,0 @@
1
- <!--
2
-
3
- Thank you for submitting a pull request!
4
-
5
- Here's a checklist you might find useful.
6
- [ ] There is an associated issue that is labelled
7
- 'Bug' or 'help wanted' or is in the Community milestone
8
- [ ] Code is up-to-date with the `main` branch
9
- [ ] You've successfully run `npm test` locally
10
- [ ] There are new or updated tests validating the change
11
-
12
- -->
13
-
14
- Fixes #
@@ -1,42 +0,0 @@
1
- name: New version
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- repository_dispatch:
7
- types: [newversion]
8
-
9
- jobs:
10
- newversion:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v4
14
- with:
15
- persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
16
- fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
17
- - uses: actions/setup-node@v4 #Setup Node
18
- with:
19
- node-version-file: '.nvmrc'
20
- cache: 'npm'
21
- - name: Create local changes
22
- run: |
23
- npm ci
24
- npm i jodit
25
-
26
- git config --local user.email "github-actions[bot]@users.noreply.github.com"
27
- git config --local user.name "github-actions[bot]"
28
-
29
- npm version patch --no-git-tag-version
30
- npm run git
31
-
32
- - name: Push changes
33
- uses: ad-m/github-push-action@master
34
- with:
35
- github_token: ${{ secrets.GITHUB_TOKEN }}
36
- branch: ${{ github.ref }}
37
- tags: true
38
-
39
- - name: Trigger release action
40
- run: |
41
- curl -XPOST -u "${{ secrets.PAT_USERNAME}}:${{secrets.PAT_TOKEN}}" -H "Accept:application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/jodit/jodit-react/dispatches --data '{"event_type": "release" }'
42
-
@@ -1,36 +0,0 @@
1
- name: Publish Package to npmjs
2
-
3
- on:
4
- repository_dispatch:
5
- types: [ release ]
6
-
7
- push:
8
- tags: ["*"]
9
-
10
- jobs:
11
- release:
12
-
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
- - uses: actions/setup-node@v4 #Setup Node
18
- with:
19
- node-version-file: '.nvmrc'
20
- cache: 'npm'
21
-
22
- - name: Install dependencies
23
- run: |
24
- npm ci
25
-
26
- - name: Lint
27
- run: |
28
- npm run lint
29
-
30
- - name: Build
31
- run: |
32
- npm run build
33
-
34
- - name: Publish
35
- run: |
36
- NPM_TOKEN=${{ secrets.NPM_TOKEN }} npm publish ./ --access public --tag beta
@@ -1,43 +0,0 @@
1
- import path from 'node:path';
2
- import process from 'node:process';
3
-
4
- export default {
5
- entry: './app.tsx',
6
- context: path.join(process.cwd(), './examples/'),
7
- devtool: 'eval',
8
- module: {
9
- rules: [
10
- {
11
- test: /\.(js|jsx|ts|tsx)$/,
12
- use: {
13
- loader: 'swc-loader'
14
- }
15
- },
16
- {
17
- test: /\.css$/,
18
- use: ['style-loader', 'css-loader']
19
- }
20
- ]
21
- },
22
-
23
- resolve: {
24
- extensions: ['.js', '.jsx', '.ts', '.tsx']
25
- },
26
-
27
- output: {
28
- path: path.join(process.cwd(), './examples/build/'),
29
- filename: 'app.js'
30
- },
31
-
32
- devServer: {
33
- static: './examples',
34
- open: true,
35
- allowedHosts: 'all',
36
- client: {
37
- progress: true,
38
- overlay: true
39
- },
40
- port: 4000,
41
- hot: true
42
- }
43
- };
package/webpack.config.ts DELETED
@@ -1,71 +0,0 @@
1
- import path from 'path';
2
- import webpack from 'webpack';
3
- import process from 'process';
4
-
5
- export default (env: unknown, argv: { mode?: string }, dir = process.cwd()) => {
6
- const debug = !argv || !argv.mode || !argv.mode.match(/production/);
7
-
8
- return {
9
- context: dir,
10
-
11
- entry: './src/index.ts',
12
- devtool: debug ? 'inline-source-map' : false,
13
-
14
- module: {
15
- rules: [
16
- {
17
- test: /\.(js|jsx|ts|tsx)$/,
18
- use: {
19
- loader: 'swc-loader'
20
- }
21
- },
22
- {
23
- test: /\.css$/,
24
- use: ['style-loader', 'css-loader']
25
- }
26
- ]
27
- },
28
-
29
- resolve: {
30
- extensions: ['.ts', '.tsx', '.js', '.jsx'],
31
- alias: {
32
- 'jodit-react': path.join(__dirname, './src')
33
- }
34
- },
35
-
36
- output: {
37
- path: path.join(dir, './build/'),
38
- filename: 'jodit-react.js',
39
- library: ['JoditEditor', 'Jodit'],
40
- libraryTarget: 'umd'
41
- },
42
-
43
- plugins: [
44
- new webpack.DefinePlugin({
45
- 'process.env': {
46
- NODE_ENV: JSON.stringify(
47
- debug ? 'development' : 'production'
48
- )
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
- };