Wrap Editor.js element to show a Rich Text editor allows to add formatted text.
app.component.html
<adf-rich-text-editor [data]="data" #editor> </adf-rich-text-editor>
<button (click)="saveContent()">Save</button>
app.component.ts
@Component({...}) class RichTextEditorDemo { @ViewChild('editor') editorRef; data = { time: 1658154611110, blocks: [ { id: '99jwc03ETP', type: 'header', data: { text: 'Header', level: 2 } }, { id: 'ffdulIdU1E', type: 'paragraph', data: { text: 'Sample paragraph', alignment: 'left' } }, ], version: 1 }; async saveContent(){ try { const editorContent = await this.editorRef.getEditorContent(); // do some stuff with editor content } catch (error) { // catch error } } }
| Name | Type | Default value | Description |
|---|---|---|---|
| data | OutputData | null | EditorJs data format (follow the official documentation ) |
| readOnly | boolean | false | If true users won't have the ability to change the document content |
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.