npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-jodit-pro

v3.0.1

Published

Angular wrapper for Jodit Pro WYSIWYG editor

Downloads

599

Readme

ngx-jodit-pro v3.x

Angular wrapper for Jodit PRO WYSIWYG editor. It supports Angular >= 16 and jodit-pro v2 beta. You need a license key in order to use this wrapper. Buy here.

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

Demo

You can find a demo of ngx-jodit-pro 3.x here.

Remarks

ESM for Jodit-Pro is not currently working. See issue 34. You have to include the es2021 build (see installation).

Installation

  1. Make sure that jodit-pro@4 AND jodit@4 is installed:

    npm install jodit-pro@4 jodit@4 --save
  2. npm install ngx-jodit-pro --save
  3. Add the following paths to your app's styles and scripts in angular.json (or project.json for Nx):

    ...
     ,
     "styles": [
       "node_modules/jodit-pro/es2021/jodit.min.css",
       ...
     ],
     "scripts": [
       "node_modules/jodit-pro/es2021/jodit.min.js",
       ...
     ],
    ...
  4. Add NgxJoditProComponent (standalone) to the imports array in your app.module.ts:

    @NgModule({
     ...
     imports: [
       ...,
       NgxJoditProComponent
     ],
     ...
     })
  5. Add "skipLibCheck": true to compilerOptions in your tsconfig.app.json. This is needed because the 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 :):

    ...
      "compilerOptions": {
        ...,
        "skipLibCheck": true
      }
    ...
  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".

  7. Now you can use the component. See example here.

  • Without AngularForms:

      <ngx-jodit-pro [(value)]="value" [options]="options"></ngx-jodit-pro>
  • With AngularForms (make sure to import AngularForms):

    • Template driven

        <ngx-jodit-pro [(ngModel)]="value" [options]="options"></ngx-jodit-pro>
    • Reactive

        <form [formGroup]="formGroup">
          <ngx-jodit-pro [options]="options" formControlName="editor"></ngx-jodit-pro>
        </form>

If you are facing any issues have a look on Troubleshooting first. Create an issue if it's not solved.

How to import plugins

You can install plugins from Jodit and Jodit Pro. For more information about Jodit Pro plugins see Jodit Pro Docs.

  1. Open folder "node_modules/jodit-pro" or "node_modules/jodit" depending on if you want to add jodit oder jodit-pro plugins.
  2. Open the plugin folder in "esm/plugins", e.g. "tune-block" in "jodit-pro".
  3. Look for the main file named like the plugin e.g. "tune-block.js".
  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:
import "node_modules/jodit-pro/esm/plugins/tune-block/tune-block.js";

declare const Jodit: any; // <- needed because of missing ESM, see issue 34
Jodit.lang.de = de;

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.

Now you can apply the plugin options to ngx-jodit-pro options property. For example:

import {JoditProConfig} from 'ngx-jodit-pro';
import "node_modules/jodit-pro/esm/plugins/tune-block/tune-block.js";

declare const Jodit: any; // <- needed because of missing ESM, see issue 34

options: JoditProConfig = {
  tuneBlock: {
    popup: {
      p: Jodit.atom(['align', 'tune.up', 'tune.remove', 'tune.down'])
    }
  }
}

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 AND JoditPro are supported. Use type "JoditProConfig" for options.

Options for ngx-jodit

Events for ngx-jodit

You can bind events using the Angular way, e.g.:


<ngx-jodit-pro (joditChange)="onChange($event)"></ngx-jodit-pro>

Troubleshooting

  • Some of the buttons don't show any iconCheck 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. If that doesn't helpt look in the web console for an error message that indicates a missing plugin.