Socket
Socket
Sign inDemoInstall

ngx-jodit-pro

Package Overview
Dependencies
9
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-jodit-pro

Angular wrapper for Jodit Pro WYSIWYG editor


Version published
Weekly downloads
249
increased by35.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ngx-jodit-pro v1.x

Third-party Angular wrapper for Jodit PRO WYSIWYG editor. It supports Angular >= 12. You need a license key in order to use this wrapper. Buy here.

Third-party-package

This is a third-party package with no affiliation to Jodit. See License.

License

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).

Compatibility table

Ngx-jodit-proJodit ProAngularType
npmv1.x>= v12Modulemore information
npmv2.x>= v12Modulemore information
npmv2.x>= v16Standalonemore information

Demo

The demo for ngx-jodit-pro is not available. You can find a demo of ngx-jodit (not Pro!) here.

Installation

  1. Make sure that jodit@^3 is installed (v4 is still in beta and supported only with ngx-jodit >= v2, see compatibility table):

    npm install jodit@^3 jodit-pro@^1 --save
    

    jodit@^3 is needed for typings.

  2. npm install ngx-jodit-pro --save
    
  3. Add node_modules/jodit-pro/build/jodit.css to your app's styles in angular.json (or project.json for Nx):

    ...
     ,
     "styles": [
       "node_modules/jodit-pro/build/jodit.css",
       ...
     ],
    ...
    
  4. Add node_modules/jodit-pro/build/jodit.js to your app's scripts in angular.json (or project.json for Nx):

    ...
     ,
     "scripts": [
           "node_modules/jodit-pro/build/jodit.js"
       ...
     ],
    ...
    
  5. Add NgxJoditProModule to the imports array in your app.module.ts:

    @NgModule({
     ...
     imports: [
       ...,
       NgxJoditProModule
     ],
     ...
     })
    
  6. Now you can use the component

      <ngx-jodit-pro [(value)]="value" [options]="options" #joditComponent></ngx-jodit-pro>
    

Usage

Using Jodit Pro API

Use Pro plugins

At the moment each Pro plugin you want to use must be imported into you angular.json/project.json scripts and styles array. For example the tune-block plugin:

...
styles: [
  ... (after jodit css file)...,
  "node_modules/jodit-pro/build/plugins/tune-block/tune-block.css",
],
scripts: [
  ... (after jodit js file) ...,
  "node_modules/jodit-pro/build/plugins/tune-block/tune-block.js",
]
...

After that change restart your angular app. Now you can apply the plugin options to ngx-jodit-pro options property.

Add custom plugins

You can access the initialized Jodit from the attribute "jodit" of the NgxJoditProComponent to use the Pro API:

Any component.ts:

import {ViewChild} from '@angular/core';

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

// in ngAfterViewInit
if (this.joditComponent){
   // example:
   this.joditComponent.jodit.plugins.add("hello", ()=>{
       alert("hello!");
   });
}

Any component.html:

<ngx-jodit-pro #joditComponent ...></ngx-jodit-pro>

Options

All options from Jodit are supported.

Options for ngx-jodit

NameTypeDescription
valuetwo-way data-bindingUpdates as soon as HTML value of the editor changed. You can set your value, too.
optionsone-way data-bindingSets options for Jodit

Events for ngx-jodit

You can bind events using the Angular way, e.g.:
<ngx-jodit (joditChange)="onChange($event)"></ngx-jodit>

NameDescription
joditChangeTriggers as soon as something of the HTML value changes.
joditKeyDownTriggers as soon as a key is pressed down.
joditKeyUpTriggers as soon as a key is released.
joditMousedownTriggers as soon as the left mouse button is pressed.
joditMouseupTriggers as soon as the left mouse button is released.
joditClickTriggers as soon as the user clicks on the editor.
joditFocusTriggers as soon as Jodit gets focus.
joditPasteTriggers as soon as something is pasted.
joditResizeTriggers as soon as the editor resizes.
joditBeforeEnterTriggers as soon as enter key is pressed.
joditBeforeCommandTriggers before a command is executed.
joditAfterExecTriggers after a command is executed.
joditAfterPasteTriggers after something pasted.
joditChangeSelectionTriggers as soon as selection is changed.

Keywords

FAQs

Last updated on 26 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc