Skip to content

Commit 42f319b

Browse files
committed
docs(ngx-jodit-pro): update README.md
1 parent 6d220b1 commit 42f319b

File tree

2 files changed

+84
-28
lines changed

2 files changed

+84
-28
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Buy here.</a>
3838
<thead><tr><th>Ngx-jodit-pro</th><th>Jodit Pro</th><th>Angular</th><th>Type</th><th>Demo</th><th>Readme</th></tr></thead>
3939
<tbody>
4040
<tr>
41-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro"></a></td><td>v1.x</td><td>>= v12</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/1.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/tree/main/libs/ngx-jodit-pro/README.md">Readme</a></td>
41+
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro"></a></td><td>v4.x</td><td>>= v16</td><td>Standalone</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/3.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/main/libs/ngx-jodit-pro/README.md">Readme</a></td>
4242
</tr>
4343
<tr>
44-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/2x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/2x"></a></td><td>v2.x</td><td>>= v12</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/2.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v2.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
44+
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/2x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/2x"></a></td><td>v4.x</td><td>v12 - v15</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/2.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v2.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
4545
</tr>
4646
<tr>
47-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/3x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/3x"></a></td><td>v2.x</td><td>>= v16</td><td>Standalone</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/3.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v3.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
47+
<td style="text-align:center;">v1.x <i>(deprecated)</i></td><td>v1.x</td><td>v12 - v15</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/1.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v1.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
4848
</tr>
4949
</tbody>
5050
</table>

libs/ngx-jodit-pro/README.md

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,58 @@
1-
# ngx-jodit-pro v2.x (beta)
1+
# ngx-jodit-pro v2.x
22

33
Angular wrapper for <a href="https://xdsoft.net/jodit/pro/">Jodit PRO</a> WYSIWYG editor. It supports Angular >= 12 and jodit-pro beta. You need a license key in order to use this wrapper. <a href="https://xdsoft.net/jodit/pro/#compare">Buy here.</a>
44

55
## License
6-
This package does not contain the source code of Jodit Pro. You have to install it as described here (scroll down). This wrapper is licensed under MIT License, Jodit Pro is licensed seperately ([see license](https://xdsoft.net/jodit/pro/license/)).
6+
7+
This package does not contain the source code of Jodit Pro. You have to install it as described here (scroll down). This
8+
wrapper is licensed under MIT License, Jodit Pro is licensed
9+
seperately ([see license](https://xdsoft.net/jodit/pro/license/)).
710

811
## Compatibility table
912

1013
<table>
1114
<thead><tr><th>Ngx-jodit-pro</th><th>Jodit Pro</th><th>Angular</th><th>Type</th><th>Demo</th><th>Readme</th></tr></thead>
1215
<tbody>
1316
<tr>
14-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro"></a></td><td>v1.x</td><td>>= v12</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/1.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/tree/main/libs/ngx-jodit-pro/README.md">Readme</a></td>
17+
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro"></a></td><td>v4.x</td><td>>= v16</td><td>Standalone</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/3.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/main/libs/ngx-jodit-pro/README.md">Readme</a></td>
1518
</tr>
1619
<tr>
17-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/2x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/2x"></a></td><td>v2.x</td><td>>= v12</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/2.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v2.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
20+
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/2x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/2x"></a></td><td>v4.x</td><td>v12 - v15</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/2.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v2.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
1821
</tr>
1922
<tr>
20-
<td style="text-align:center;"><a href="https://www.npmjs.com/package/ngx-jodit-pro/v/3x"><img alt="npm" src="https://img.shields.io/npm/v/ngx-jodit-pro/3x"></a></td><td>v2.x</td><td>>= v16</td><td>Standalone</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/3.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v3.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
23+
<td style="text-align:center;">v1.x <i>(deprecated)</i></td><td>v1.x</td><td>v12 - v15</td><td>Module</td><td><a href="https://github.julianpoemp.com/ngx-jodit-pro/1.x/">Demo</a></td><td><a href="https://github.com/julianpoemp/ngx-jodit/blob/v1.x/libs/ngx-jodit-pro/README.md">Readme</a></td>
2124
</tr>
2225
</tbody>
2326
</table>
2427

2528
## Demo
2629

27-
You can find a demo of ngx-jodit-pro 2.x [here](https://github.julianpoemp.com/ngx-jodit-pro/2.x/).
30+
You can find a demo of ngx-jodit-pro 3.x [here](https://github.julianpoemp.com/ngx-jodit-pro/2.x/).
31+
32+
## Remarks
33+
34+
ESM for Jodit-Pro is not currently working. See [issue 34](https://github.com/julianpoemp/ngx-jodit/issues/34). You have to include the es2021 build (see installation).
2835

2936
## Installation
3037

31-
1. Make sure that jodit-pro@beta AND jodit@beta is installed:
38+
1. Make sure that jodit-pro@4 AND jodit@4 is installed:
3239
```
33-
npm install jodit-pro@beta jodit@beta --save
40+
npm install jodit-pro@4 jodit@4 --save
3441
```
3542
2. ```
3643
npm install ngx-jodit-pro@2x --save
3744
```
38-
3. Add the following path to your app's styles in angular.json (or project.json for
45+
3. Add the following paths to your app's styles and scripts in angular.json (or project.json for
3946
Nx):
4047
```
4148
...
4249
,
4350
"styles": [
44-
"node_modules/jodit-pro/es2021/jodit.fat.min.css",
51+
"node_modules/jodit-pro/es2021/jodit.min.css",
52+
...
53+
],
54+
"scripts": [
55+
"node_modules/jodit-pro/es2021/jodit.min.js",
4556
...
4657
],
4758
...
@@ -58,17 +69,43 @@ You can find a demo of ngx-jodit-pro 2.x [here](https://github.julianpoemp.com/n
5869
...
5970
})
6071
```
61-
6. Now you can use the component
62-
63-
```angular2html
64-
<ngx-jodit-pro [(value)]="value" [options]="options" #joditComponent></ngx-jodit-pro>
72+
5. Add `"skipLibCheck": true` to compilerOptions in your `tsconfig.app.json`. This is needed because the
73+
check fails to typing errors of the jodit package. **This is still the issue in v4**. If you know any other solution, let me know :):
74+
```
75+
...
76+
"compilerOptions": {
77+
...,
78+
"skipLibCheck": true
79+
}
80+
...
6581
```
6682

67-
## Usage
83+
6. Each toolbar element by Jodit v4 is considered as plugin. While basic plugins are imported automatically, you have to import other plugins manually. See section "How to import plugins".
84+
85+
7. Now you can use the component. See [example here](https://github.com/julianpoemp/ngx-jodit/tree/v2.x/apps/demo-pro).
86+
87+
- Without AngularForms:
88+
89+
```angular2html
90+
<ngx-jodit-pro [(value)]="value" [options]="options"></ngx-jodit-pro>
91+
```
92+
93+
- With AngularForms (make sure to import AngularForms):
94+
- Template driven
95+
96+
```angular2html
97+
<ngx-jodit-pro [(ngModel)]="value" [options]="options"></ngx-jodit-pro>
98+
```
99+
- Reactive
100+
```angular2html
101+
<form [formGroup]="formGroup">
102+
<ngx-jodit-pro [options]="options" formControlName="editor"></ngx-jodit-pro>
103+
</form>
104+
```
68105
69-
### Using Jodit Pro API
106+
If you are facing any issues have a look on [Troubleshooting](https://github.com/julianpoemp/ngx-jodit/blob/main/libs/ngx-jodit/README.md#troubleshooting) first. Create an issue if it's not solved.
70107
71-
### Use (Pro) plugins
108+
## How to import plugins
72109
73110
You can install plugins from Jodit and Jodit Pro. For more information about Jodit Pro plugins see [Jodit Pro Docs](https://xdsoft.net/jodit/pro/docs/).
74111
@@ -78,16 +115,23 @@ You can install plugins from Jodit and Jodit Pro. For more information about Jod
78115
4. Import "jodit" and the path to this file in a Typescript file of your application. E.g. the Angular component that includes ngx-jodit-pro. For example:
79116
80117
```typescript
81-
import "jodit";
82118
import "node_modules/jodit-pro/esm/plugins/tune-block/tune-block.js";
119+
120+
declare const Jodit: any; // <- needed because of missing ESM, see issue 34
121+
Jodit.lang.de = de;
83122
```
84123

124+
You can import your plugins wherever you want, e.g. in a global ts file that's imported anyway like index.ts or main.ts files.
125+
85126
Now you can apply the plugin options to ngx-jodit-pro `options` property. For example:
86127

87128
```typescript
88129
import {JoditProConfig} from 'ngx-jodit-pro';
130+
import "node_modules/jodit-pro/esm/plugins/tune-block/tune-block.js";
131+
132+
declare const Jodit: any; // <- needed because of missing ESM, see issue 34
89133

90-
options:JoditProConfig = {
134+
options: JoditProConfig = {
91135
tuneBlock: {
92136
popup: {
93137
p: Jodit.atom(['align', 'tune.up', 'tune.remove', 'tune.down'])
@@ -101,23 +145,26 @@ options:JoditProConfig = {
101145
You can access the initialized Jodit from the attribute "jodit" of the NgxJoditProComponent to use the Pro API:
102146

103147
Any component.ts:
148+
104149
````Typescript
105150
import {ViewChild} from '@angular/core';
106151

107152
//...
108153
@ViewChild("joditComponent") joditComponent?: NgxJoditProComponent;
109154

110155
// in ngAfterViewInit
111-
if (this.joditComponent){
156+
if (this.joditComponent) {
112157
// example:
113-
this.joditComponent.jodit.plugins.add("hello", ()=>{
158+
this.joditComponent.jodit.plugins.add("hello", () => {
114159
alert("hello!");
115160
});
116161
}
117162
````
118163

119164
Any component.html:
165+
120166
```HTML
167+
121168
<ngx-jodit-pro #joditComponent ...></ngx-jodit-pro>
122169
```
123170

@@ -149,10 +196,15 @@ All [options](https://xdsoft.net/jodit/docs/classes/config.Config.html) from Jod
149196
</tbody>
150197
</table>
151198

152-
### Events for ngx-jodit
153-
<p>
154-
You can bind events using the Angular way, e.g.:<br/><code>&lt;ngx-jodit (joditChange)="onChange($event)">&lt;/ngx-jodit></code>
155-
</p>
199+
## Events for ngx-jodit
200+
201+
You can bind events using the Angular way, e.g.:
202+
203+
```angular2html
204+
205+
<ngx-jodit-pro (joditChange)="onChange($event)"></ngx-jodit-pro>
206+
```
207+
156208
<table class="table table-sm table-striped table-bordered">
157209
<thead>
158210
<tr>
@@ -219,3 +271,7 @@ All [options](https://xdsoft.net/jodit/docs/classes/config.Config.html) from Jod
219271
</tr>
220272
</tbody>
221273
</table>
274+
275+
## Troubleshooting
276+
277+
- **Some of the buttons don't show any icon**<br/>Check your options if you used the correct button names. If yes, check the folder `node_modules/jodit/es2021/plugins/` for a folder named like the button you want to use. Then import the found plugin to your app as described [here](https://github.com/julianpoemp/ngx-jodit/blob/main/libs/ngx-jodit-pro/README.md#how-to-import-plugins). If that doesn't helpt look in the web console for an error message that indicates a missing plugin.

0 commit comments

Comments
 (0)