5.0.0 • Published 1 month ago

ngx-simple-text-editor v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

npm version CircleCI Coverage Status GitHub issues npm bundle size NPM demo

ngc simple text editor logo

Ngx Simple Text editor

Ngx Simple Text editor or ST editor is a simple native text editor component for Angular 9+.

Version compatibility

Angular versionNgx simple text editor versionFont awesome version
9 - 130.0.0 - 1.x.x5.0.0-6.x.x
142.x.x5.0.0-6.x.x
153.x.x5.0.0-6.x.x
164.x.x5.0.0-6.x.x
175.x.x5.0.0-6.x.x

Instalation

npm install ngx-simple-text-editor --save

then add NgxSimpleTextEditorModule into module imports

import {NgxSimpleTextEditorModule} from 'ngx-simple-text-editor';

@NgModule({
// ...
  imports: [
    // ...
    NgxSimpleTextEditorModule,
    // ...
  ],
// ...
})

If you want to use default button icons, you must install Font awesome. npm install @fortawesome/fontawesome-free and declare in styles in angular.json

...
"styles": [
  "src/styles.scss",
  "node_modules/@fortawesome/fontawesome-free/css/all.css"
]
...

Usage

You can use Ngx simple text editor as classic template-driven form input or as reactive form input.

<st-editor [(ngModel)]="content" [config]="config"></st-editor>

The editor has got only one @Input with config object, which is optional. The config object is defined by placeholder and buttons, both are optional and can be omitted.

import { Component } from '@angular/core';
import {EditorConfig, ST_BUTTONS} from 'ngx-simple-text-editor';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  content = '';
  config: EditorConfig = {
    placeholder: 'Type something...',
    buttons: ST_BUTTONS,
  };
}

You can pass all predefined buttons with predefined order, or you can use only buttons you want with order as you want.

import {EditorConfig, UNDO_BUTTON, SEPARATOR, BOLD_BUTTON, ITALIC_BUTTON} from 'ngx-simple-text-editor';
...
config: EditorConfig = {
    buttons: [UNDO_BUTTON, SEPARATOR, BOLD_BUTTON, ITALIC_BUTTON],
  };
...

Demo

Online demo or Stackblitz coming soon.

License

MIT

5.0.0

1 month ago

4.0.3

6 months ago

4.0.2

7 months ago

4.0.1

8 months ago

4.0.0

8 months ago

3.0.0

1 year ago

1.4.0

2 years ago

2.0.0

1 year ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago