An open API service indexing awesome lists of open source software.

https://github.com/dimpu/ngx-quill

ngx-quill
https://github.com/dimpu/ngx-quill

Last synced: about 1 year ago
JSON representation

ngx-quill

Awesome Lists containing this project

README

          

# ngx-quill [![Build Status](https://travis-ci.org/dimpu/ngx-quill.svg?branch=develop)](https://travis-ci.org/dimpu/ngx-quill)
Angular (>=2) component for rich text editor Quill

# Example
[Demo Page](https://dimpu.github.io/ngx-quill/)

### Installation

``` bash
npm install @dimpu/ngx-quill --save
```

### Sample

Include NgxQuillModule in your main module:
``` typescript
import { NgxQuillModule } from '@dimpu/ngx-quill';

@NgModule({
// ...
imports: [
NgxQuillModule
],
// ...
})
export class AppModule {}
```

Then use it in your component:

``` html

```

``` javascript
import { Component } from '@angular/core';

@Component({
selector: 'sample',
template: require('./sample.html')
})
export class Sample {

public editor;
public editorContent = `

I am Example content

`;
public editorOptions = {
placeholder: "insert content..."
};

constructor() {}

onEditorBlured(quill) {
console.log('editor blur!', quill);
}

onEditorFocused(quill) {
console.log('editor focus!', quill);
}

onEditorCreated(quill) {
this.editor = quill;
console.log('quill is ready! this is current quill instance object', quill);
}

onContentChanged({ quill, html, text }) {
console.log('quill content is changed!', quill, html, text);
}

ngOnInit() {
setTimeout(() => {
this.editorContent = '

content changed!

';
console.log('you can use the quill instance object to do something', this.editor);
// this.editor.disable();
}, 2800)
}

onReady(quill) {
const customButton = document.querySelector('#custom-button');
customButton.addEventListener('click', function() {
const range = quill.getSelection();
if (range) {
quill.insertText(range.index, 'Ω');
}
});
}

}
```

### Configuration
- options : The configuration object for quill see https://quilljs.com/docs/quickstart/