This package is a wrapper around Jodit to make it easier to use in a Angular application.
The editor component itselt is located in the jodit-angular
folder and packaged into a redistributable package with the ng-packagr tool. A test app has been created with the @angular/cli. It is located in the src directory and a dev server can be started by using the npm start
command.
Copy$ npm install jodit-angular
Import the EditorModule from the npm package like so:
Copyimport { JoditAngularModule } from 'jodit-angular';
Then add it to your application module:
Copy// Your setup might differ, but the important part is the imports array @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, JoditAngularModule // <- Crucial part ], providers: [], bootstrap: [AppComponent] })
Using the Component in Your Templates You can use the editor in your templates as follows:
Copy<jodit-editor [config]="{buttons: 'bold'}"></jodit-editor>
In the config, you can set all Jodit's options
You can bind editor events via a shorthand prop on the editor, like so:
Copy<jodit-editor (onChange)="handleEvent($event)"></jodit-editor>
The handler is called with an object containing the properties event (the event object) and editor (a reference to the editor).
This package is available under MIT
License.