Tinymce富文本

Tinymce富文本。

如何使用

安装依赖

npm i -S ngx-tinymce

导入模块

  • 1、在 app.module.ts 下导入 NgxTinymceModule.forRoot()

  • 2、在 json-schema.module.ts 导入 TinymceWidgetModule

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

代码演示

基础样例

最简单的用法。

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

import { YelonFormModule, SFSchema } from '@yelon/form';
import type { TinymceWidgetSchema } from '@yelon/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: [YelonFormModule]
})
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...