Ckeditor 在清除表单后将值设置为空

问题描述 投票:0回答:1

ckeEditorCommonConfig:任何

ckeEditorCommonCongiguration(): void { this.ckeEditorCommonConfig = { 高度:“100%”, extraPlugins: 'codeTag,kbdTag', removePlugins: "导出pdf", 工具栏:[ { name: 'styles', items: ['Styles', 'Format'] }, { 名称:'basicstyles',组:['basicstyles','cleanup'], 项目:['粗体','斜体','下划线','删除','下标','上标','RemoveFormat','代码'] }, { 名称:'段落',组:['列表','缩进','块','对齐','bidi'], 项目:['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'] }, { name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source'] }, ], 工具栏组:[ { 名称:'样式'}, { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] }, { name: 'document', groups: ['mode', 'document', 'doctools'] }, { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] }, ], 删除按钮:“”, 语言:'en', forcePasteAsPlainText:假, 允许的内容:真实的, extraAllowedContent: 'img', } }

在 html 文件中:

当我重置表单时,ckediotr 的值未设置为 null (this.commentForm.reset()) 在 commentForm 中有一个名为 comment 的字段,用于存储 ckeditor 值。

angular ckeditor
1个回答
0
投票

您可能必须将变量“绑定”到“数据”属性:

<ckeditor [editor]="Editor" data="<p>Hello, world!</p>"></ckeditor>

在上面的示例中,您将像这样绑定一个变量:

<ckeditor [editor]="Editor" data="{{ myVariable }}"></ckeditor>

然后在 .ts 文件中声明一个 public myVariable 并将其设置为 null

public myVariable: string = null;
© www.soinside.com 2019 - 2024. All rights reserved.