Ueditor Rich Text.
Note: third party widget is not registered by default, see details from Customize Widgets.
Installation dependencies
Since the Ueditor relies on a third-party plug-in ngx-ueditor, the dependency should be installed first when using it
yarn add ngx-ueditor
Import module
The project built using the latest scaffolding provides a third-party widget registration entry: src/app/shared/json-schema/json-schema.module.ts
.
UeditorWidget
needs to be declared in JsonSchemaModule
.
export const SCHEMA_THIRDS_COMPONENTS = [UeditorWidget];
@NgModule({
declarations: SCHEMA_THIRDS_COMPONENTS,
imports: [
SharedModule,
DelonFormModule.forRoot(),
UEditorModule.forRoot({
js: [`./assets/ueditor/ueditor.config.js`, `./assets/ueditor/ueditor.all.min.js`],
// 默认前端配置项
options: {
UEDITOR_HOME_URL: './assets/ueditor/'
}
}),
],
exports: SCHEMA_THIRDS_COMPONENTS
})
export class JsonSchemaModule {
}
Widget registration
export class JsonSchemaModule {
constructor(widgetRegistry: WidgetRegistry) {
widgetRegistry.register(UeditorWidget.KEY, UeditorWidget);
}
}
Import resources
Roughly the same as Tinymce
, Ueditor
also needs to import some static resource files to run normally
Source Code
Source Code。