Gathering detailed insights and metrics for fusion-angular-wysiwyg
Gathering detailed insights and metrics for fusion-angular-wysiwyg
npm install fusion-angular-wysiwyg
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Latest Version
1.2.2
Package Id
fusion-angular-wysiwyg@1.2.2
Unpacked Size
2.93 MB
Size
2.58 MB
File Count
96
NPM Version
8.19.4
Node Version
16.20.2
Published on
May 02, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
12
32
Rich text editor What You See Is What You Get created using Angular 17.
Easy to use and customize.
[!WARNING] For version >=1.0.7 its a requirement to use node version >=18.18.2 because of the
eslint
dependencies.
Using npm:
npm install fusion-angular-wysiwyg
Using yarn:
yarn add fusion-angular-wysiwyg
Import module:
[!NOTE] Requires
HttpClientModule
for the image upload.
1// Needs to import HttpClientModule 2import { HttpClientModule} from '@angular/common/http'; 3import { AngularEditorModule } from 'fusion-angular-wysiwyg'; 4 5@NgModule({ 6 imports: [ HttpClientModule, AngularEditorModule ] 7}) 8
You can use the angular-editor
component. Like this:
1<angular-editor [placeholder]="'Jot something down...'" [(ngModel)]="htmlContent"></angular-editor>
You can add an id
attribute if you are going to use the same element multiple times.
You can customize the editor by passing configs through the [config]
attribute.
Like this:
1<angular-editor id="editor1" [config]="editorConfig"></angular-editor> 2<angular-editor id="editor2" [config]="editorConfig"></angular-editor>
Whe using multiple angular-editor
components, add a unique id
property to the component.
By default if you click on the image icon and select an image it will be inserted as base64
string on the img src=
attribute.
You can copy and paste external images if you want to add them also.
You can define backend endpoints to save the image or directly send the url of the image which should be passed to the img
element.
You can define the uploadUrl
config to make a request to the backend to insert the image.
1config: AngularEditorConfig = { 2 uploadUrl: 'http://localhost:9000/upload_img', 3 // ... 4};
You can also define the upload
config to make the request and map the response into a url to be inserted on the HTML on the editor.
1import { HttpClient, HttpResponse } from '@angular/common/http'; 2import { UploadResponse, AngularEditorConfig } from 'fusion-angular-wysiwyg'; 3import { map } from 'rxjs'; 4 5// ... 6 7export class AppComponent implements OnInit { 8 constructor( 9 // ... 10 private http: HttpClient, 11 ) {} 12 13 config: AngularEditorConfig = { 14 // ... 15 upload: (file) => { 16 const url = 'http://localhost:9000/upload_img'; 17 const uploadData: FormData = new FormData(); 18 uploadData.append('file', file, file.name); 19 return this.http 20 .post<{ file: string; url: string }>(url, uploadData, { 21 observe: 'response', 22 }) 23 .pipe( 24 map((response) => { 25 const imageUrl = response.body.url; 26 return { 27 ...response, 28 body: { imageUrl }, 29 } as HttpResponse<UploadResponse>; 30 }), 31 ); 32 }, 33 // ... 34 }; 35 // ... 36}
One of the main features of this project is image resizing option.
You can drag the image to make it bigger or smaller, set max and min sizes through config, etc.
The imageResizeSensitivity
config (default 2
) defines how fast the image will resize based on the mouse move.
You have the flexibility to define custom buttons with specific actions using the executeCommandFn
. This function accepts commands from execCommand, where the first argument is aCommandName
, and the second argument is aValueArgument
.
In the example below, a custom button is created that adds the Angular Editor logo into the editor:
1 2<angular-editor id="editor1" formControlName="htmlContent1" [config]="editorConfig"> 3 <ng-template #customButtons let-executeCommandFn="executeCommandFn"> 4 <ae-toolbar-set> 5 <ae-button 6 iconClass="fa fa-html5" 7 title="Insert Angular Editor Logo" 8 (buttonClick)="executeCommandFn('insertHtml', angularEditorLogo)"> 9 </ae-button> 10 </ae-toolbar-set> 11 </ng-template> 12</angular-editor>
Feel free to customize the iconClass
, title
, and buttonClick
event according to your requirements.
Name | Example Value |
---|---|
customClasses | [{"name": "quote","class": "angular-editor-quote"}] |
defaultFontName | |
defaultFontSize | 5 |
defaultParagraphSeparator | |
editHistoryLimit | 50 |
editable | true |
enableToolbar | true |
fonts | [{"class": "arial","name": "Arial"},{"class": "times-new-roman","name": "Times New Roman"},{"class": "calibri","name": "Calibri"},{"class": "comic-sans-ms","name": "Comic Sans MS"}] |
height | auto |
imageResizeSensitivity | 2 |
maxHeight | auto |
minHeight | 0 |
minWidth | 0 |
outline | true |
placeholder | Enter text here... |
sanitize | true |
showToolbar | true |
spellcheck | true |
textAreaBackgroundColor | white |
toolbarPosition | top |
translate | yes |
uploadWithCredentials | false |
width | auto |
textPatternsEnabled | true |
You can help make this project better by submitting issues and feature ideas on the repo issues page.
No vulnerabilities found.
No security vulnerabilities found.