Tinymce富文本

Tinymce富文本。

如何使用

安装依赖

npm i -S ngx-tinymce

  • 1、在 app.config.ts 下注册 provideTinymce()

  • 2、在 json-schema 注册 withTinymceWidget

关于更多 tinymce 配置请参考 ngx-tinymce

代码演示

基础样例

最简单的用法。

expand code expand code
import { Component, inject } from '@angular/core';

import { DelonFormModule, SFSchema } from '@delon/form';
import type { TinymceWidgetSchema } from '@delon/form/widgets-third/tinymce';
import { NzMessageService } from 'ng-zorro-antd/message';

@Component({
  selector: 'form-tinymce-simple',
  template: `<sf [schema]="schema" (formSubmit)="submit($event)" />`,
  standalone: true,
  imports: [DelonFormModule]
})
export class FormTinymceSimpleComponent {
  private readonly msg = inject(NzMessageService);
  schema: SFSchema = {
    properties: {
      remark: {
        type: 'string',
        title: '描述',
        ui: {
          widget: 'tinymce'
        } as TinymceWidgetSchema
      }
    }
  };

  submit(value: {}): void {
    this.msg.success(JSON.stringify(value));
  }
}

API

ui属性

成员说明类型默认值
configanysee configure
loadingstring,TemplateRef-Loading status of tinymce
disabledbooleanfalseSet tinymce mode is readonly if true
inlinebooleanfalseInline editor
delaynumber0Delayed rendering, unit is 'millisecond'
placeholderstring-Placeholder for tinymce, NOTE: dependent on tinymce-placeholder
readyEventEmitter<any>-Tinymce ready callback
Loading...