代码之家  ›  专栏  ›  技术社区  ›  Antediluvian

从froala上传图像到服务器

  •  0
  • Antediluvian  · 技术社区  · 4 年前

    // rte.component.html
    <div [froalaEditor]="froalaOptions" [formControl]="formControl"></div>
    
    // rte.component.ts
    froalaOptions: object = {
        key: environment.froalaKey,
        zIndex: 9999,
        crossDomain: true,
        imageAllowedTypes: ['jpeg', 'jpg', 'gif'],
        imageUpload: true,
        imageUploadMethod: 'POST',
        imageUploadUrl: 'http://secure.url',
        imageUploadRemoteUrls: false,
        toolbarButtons: ...
    };
    
    @Input() options: object | null = null;
    
    ngOnInit() {
        if (this.options) {
            this.froalaOptions =  {
                ...this.froalaOptions,
                ...this.options
            };
        }
    }
    
    // my.component.html
    <my-rte [options]="options" [formControl]="..."></my-rte>
    
    // my.component.ts
    options = {
        height: 500
    };
    
    0 回复  |  直到 4 年前