npm i @kolkov/angular-editor
app.module.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { HttpClientModule} from '@angular/common/http'; import { AngularEditorModule } from '@kolkov/angular-editor'; import { AppComponent } from './app.component'; import { HelloComponent } from './hello.component'; @NgModule({ imports: [ BrowserModule, FormsModule, HttpClientModule, AngularEditorModule ], declarations: [ AppComponent, HelloComponent ], bootstrap: [ AppComponent ] }) export class AppModule { } |
app.component.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { Component } from '@angular/core'; import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic'; @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComponent { name = 'Angular'; public Editor = ClassicEditor; text = ` <font face="Arial" size="4">I am <i>dhiraj</i></font><div><font face="Arial" size="4">I am fine </font><b style="font-family: Arial; font-size: large; text-align: justify;">I am learning angular </b><b style="font-family: Arial; font-size: large; text-align: justify;">I am learning angular </b><b style="font-family: Arial; font-size: large; text-align: justify;">I am learning angular </b></div><h1 class="titleText"></h1><span class="quote"></span><h1 class="titleText"></h1><span class="quote"></span><h1 class="titleText"></h1><span class="quote"></span><div><font face="Arial" size="4"> </font><b style="font-family: Arial; font-size: large; text-align: justify;">I am learning angular </b></div><h1 class="titleText"></h1><span class="quote"></span><div style="text-align: justify;"><font face="Arial" size="4"><b>I am learning angular </b></font></div><h1 class="titleText"></h1><span class="quote"></span><div><font face="Arial" size="4"><b><br></b></font></div><div><font face="Arial" size="4"><b>I am df udhfu dihfuds fudi <span style="background-color: rgb(121, 93, 79);">iudfhuidh</span> dsiuhduih i h</b></font></div><div><font face="Arial" size="4"><b>du i</b></font></div><div><font face="Arial" size="4"><b><br></b></font></div><div><font face="Arial" size="4"><b><br></b></font></div><div><font face="Arial" size="4"><b>duh dh iuh i</b></font></div><div><font face="Arial" size="4"><b>dh i</b></font></div><div><font face="Arial" size="4"><b><br></b></font></div><div><font face="Arial" size="4"><b><br></b></font></div><div><font face="Arial" size="4"><b style="background-color: rgb(0, 84, 147);">uh iughfuigh hv hgjhgf dhfdjh dfhdsj</b></font></div> `; } |
app.component.html
1 2 3 4 5 6 |
<hello name="{{ name }}"></hello> <p> Start editing to see some magic happen :) </p> <div [innerHTML]="text"></div> |
FULL SOURCE CODE