@Component({
selector: 'app-root',
template: `
<ejs-richtexteditor #t id='defaultRTE' [(value)]='value'></ejs-richtexteditor>
<button (click)="h(t)">Assign</button>
<ejs-grid #grid [dataSource]='data' allowTextWrap='true'
[textWrapSettings]='wrapSettings' height='400'>
<e-columns>
<e-column field='Mainfieldsofinvention' headerText='Main fields of invention' width='150'></e-column>
</e-columns>
</ejs-grid>`,
providers: [ToolbarService, LinkService, ImageService, HtmlEditorService],
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
public data: Object[];
public wrapSettings: TextWrapSettingsModel;
public value = `
<p>The RichTextEditor triggers events based on its actions. </p>
<p> The events can be used as an extension point to perform custom operations.</p>
<ul>
<li>created - Triggers when the component is rendered.</li>
. . . . . .
</ul>`;
ngOnInit(): void {
this.data = [];
this.wrapSettings = { wrapMode: 'Content' };
}
h(t: HTMLTextAreaElement) {
this.data = [{ 'Mainfieldsofinvention': t.value }]; // you can save the text in grid cell.
}
} |
<ejs-grid [dataSource]='data'>
<e-columns>
<e-column field='XML' width='120' disableHtmlEncode="true"></e-column>
</e-columns>
</ejs-grid>
@Component({
selector: 'app-container',
.....
styles: [`
.e-grid.e-responsive .e-rowcell {
white-space: pre;
}
`]
})
export class AppComponent implements OnInit {. . . . }
|
public onCreate(args): void {
this.rteObj.focusIn();
this.rteObj.contentModule.getDocument().execCommand('insertText', true, this.content);
}
|