quill富文本编辑器自定义上传图片
自定义上传组件
富文本编辑器quill在上传图片的时候会转换为base64格式,这样后端直接存图片而不是图片地址了,需要修改为存图片地址的方式,在查看github之后发现可以增加一个自定义toolbar来解决
- 增加自定义的toolbar
<quill-editor (onEditorCreated)="EditorCreated($event)" [(ngModel)]="data['noticeContent']" formControlName="noticeContent">
<div quill-editor-toolbar>
<span class="ql-formats">
<button nz-button type="button" (click)="customButtonClick($event)" class="ql-image">imgage</button>
<input class="open-file" type="file" name="file" id="file"
accept="image/png, image/gif, image/jpeg, image/bmp, image/x-icon"
style="display: none;" (change)="upload($event)" multiple="false"
/>
</span>
</