import { Component } from 'vue-property-decorator'; import { VueLifeCycleProcessing,EditorBase } from '@ibizstudio-ex/template-vue'; import { ModelTool } from '@ibizstudio-ex/runtime'; import { AppMavonEditor } from '../../components'; /** * MarkDown查看器插件类 * * @export * @class MarkdownObserver * @extends {EditorBase} */ @Component({ components:{ 'app-mavon-editor':AppMavonEditor } }) @VueLifeCycleProcessing() export class MarkdownObserver extends EditorBase { /** * 编辑器初始化 * * @memberof CustomStyleSelector */ public async initEditor() { await super.initEditor(); let unitName = this.parentItem?.unitName; let appDeField: any = this.parentItem?.getPSAppDEField(); this.customProps.type = ModelTool.isNumberField(appDeField) ? 'number' : 'text'; this.customProps.unit = unitName; this.customProps.precision = ModelTool.getPrecision(this.editorInstance, appDeField); } /** * 编辑器change事件 * * @param {*} value * @memberof CustomStyleSelector */ public handleChange($event: any) { this.editorChange({ name: this.editorInstance.name, value: $event }); } /** * 编辑器enter事件 * * @param {*} value * @memberof CustomStyleSelector */ public handleEnter($event: any) { this.$emit('enter', arguments); } /** * 绘制默认内容 * * @returns {*} * @memberof CustomStyleSelector */ public renderTextbox() { return this.$createElement('app-mavon-editor', { props: { name: this.editorInstance.name, itemValue: this.value, disabled: this.disabled, ...this.customProps, }, on: { change: this.handleChange, enter: this.handleEnter, }, style: this.customStyle, }); } /** * 绘制内容 * * @returns {*} * @memberof CustomStyleSelector */ public render(): any { if (!this.editorIsLoaded) { return null; } return this.renderTextbox(); } }