Code Monkey home page Code Monkey logo

jodit-angular's Introduction

Hey. Due to the fact that I do not use Angular in my projects, I cannot fix plugin errors in a timely manner. If you want the plugin to develop, send PR or better become a contributor

Jodit Angular Component

npm npm npm

This package is a wrapper around Jodit to make it easier to use in a Angular application.

for contributors

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.

Installation

$ npm install jodit-angular

Usage

Loading the component

Import the EditorModule from the npm package like this:

import { JoditAngularModule } from 'jodit-angular';

And add it to you application module:

// This might look different depending on how you have set up your app
// but the important part is the imports array
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    JoditAngularModule // <- Important part
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Using the component in your templates Use the editor in your templates like this:

<jodit-editor [config]="{buttons: 'bold'}"></jodit-editor>

In config you can set all Jodit's options

Note about toolbar buttons override:

Jodit editor apply a different toolbar buttons layout based on width available for the editor itself. So a different width size for editor will show a different buttons layout. The "buttons" config setting in the example above will override only the default toolbar buttons for large widths. If you want to override buttons displayed on all editor sizes use something like this:

<jodit-editor
  [config]="{
      buttons: 'bold,strikethrough,underline,italic'
      buttonsMD: 'bold,strikethrough,underline,italic'
      buttonsSM: 'bold,strikethrough,underline,italic'
      buttonsXS: 'bold,strikethrough,underline,italic'
      };"
></jodit-editor>     

Event binding

You can also bind editor events via a shorthand prop on the editor, for example:

<jodit-editor (onChange)="handleEvent($event)"></jodit-editor>

Events list

  • onChange
  • onKeydown
  • onMousedown
  • onClick
  • onFocus
  • onPaste
  • onResize
  • onBeforeEnter
  • onBeforeCommand
  • onAfterCommand
  • onAfterExec
  • onAfterPaste
  • onChangeSelection

Where the handler gets called with an object containing the properties event, which is the event object, and editor, which is a reference to the editor.


License

This package is available under MIT License.

jodit-angular's People

Contributors

xdan avatar dexster avatar dependabot[bot] avatar mrelectronick avatar stockmind avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.