0.2.7 • Published 5 years ago

ionic-rich-text v0.2.7

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

Ionic 3 Rich Text

npm

A simple rich text editor (or HTML editor) for Ionic 3 applications. I took the idea of judgewest2000 and adapted it to my needs.

Installing

npm i ionic-rich-text

Import it into your app.module

import { RichTextModule } from 'ionic-rich-text/dist/rich-text-module';

.
.
.

  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    RichTextModule
  ],

If you are using lazy loading, you might have to import the module into the page's module as well.

Usage

You can just use the editor with the tag

<rich-text [formControlItem]="item"></rich-text>

and in your .ts file:

constructor(public navCtrl: NavController, public navParams: NavParams, private fb: FormBuilder) {
    this.item = this.fb.control('');
  }

Options

You can pass an object to the component to enable/disable some of its functionalities (disabled ones will not be visible)

OptionDescription
boldIf the bold option is enabled
italicIf the italic option is enabled
underlineIf the underline option is enabled
strikethroughIf the strikethrough option is enabled
largeTextIf the large text option is enabled
smallTextIf the small text option is enabled
alignLeftIf the align left option is enabled
alignCenterIf the align center option is enabled
alignRightIf the align right option is enabled
justifyIf the justify option is enabled
lineJumpIf the line jump option is enabled
orderedListIf the ordered list option is enabled
unorderedListIf the unordered list option is enabled
canCloseIf the editor can be opened/closed on demand

There is a type for this object definition:

export interface RichTextOptions {
  undo?: boolean;
  redo?: boolean;
  bold?: boolean;
  italic?: boolean;
  underline?: boolean;
  largeText?: boolean;
  smallText?: boolean;
  alignLeft?: boolean;
  alignCenter?: boolean;
  alignRight?: boolean;
  justify?: boolean;
  lineJump?: boolean;
  orderedList?: boolean;
  unorderedList?: boolean;
  strikethrough?: boolean;
  canClose?: boolean;
}

So you can do

<rich-text [formControlItem]="item" [options]="{canClose: true, lineJump: false}"></rich-text>

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

0.2.7

5 years ago

0.2.6

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago