1.0.4 • Published 3 years ago

laniak-text-editor v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

LaniakTextEditor

This library component is developed by Shashank Kawle for Laniak This library was generated with Angular CLI version 11.0.4.

Overview

Laniak Text Editor is an Angular component to include basic text editor functionality in your web app.

Laniak Text Editor Themes

Usage

  • Install npm package for Laniak Text Editor in your project.
npm i laniak-text-editor
  • Import Laniak Text Editor in your app.module.ts
import {LaniakTextEditorModule} from 'laniak-text-editor'
  • Add module import entry in import array of app.module.ts
 imports: [
    LaniakTextEditorModule
  ],
  • In app.component.html add Laniak Text Editor component. Also add reference to editor to access the data. In below case we have added reference as #editor1
 <lan-text-editor #editor1></lan-text-editor>
  • In app.component.ts access the data as follows:
import { AfterViewInit } from '@angular/core';
import { publicApiObjct } from 'laniak-text-editor/lib/I_laniak-public-api';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements  AfterViewInit
{

  @ViewChild('editor1') ed1: publicApiObjct | undefined

  constructor() 
  {}

  ngAfterViewInit()
  {
    this.ed1?.setTheme("dark");
  }

  display()
  {
    console.log(this.ed1?.getRawText());
  }
}

Note: Don not change publicApiObjct as it is required to specify type of editor reference.

APIs

publicApiObject type provides three API for Laniak Text Editor.

APIDescription
setTheme()Possible parameter values: light & dark. Default value is light. Use in ngAfterViewInit life cycle hook to specify default theme of editor.
getRawText()Parameters : none. Use to get raw text (without HTML formatting) from text editor.
getFormattedText()Parameters : none. Use to get HTML formatted text from text editor.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

0.0.1

3 years ago