在ACE编辑器中显示渲染的HTML

时间:2019-08-19 14:42:32

标签: javascript angular ace-editor

我在ace 7中使用ace编辑器和ng2-ace-editor。我正在尝试为某些特定语法创建编辑器。在编辑器中动态添加内容并替换为某种HTML之前,我想识别某些模式。我想将HTML显示为呈现的部分,而不是代码。当前,当我在ace中添加内容时,将其渲染为代码。

enter image description here

我想显示为:

enter image description here

我正在使用@ViewChild在组件上获取编辑器

export class ViewAceEditorComponent  {
  @ViewChild('editor') aceComponent: AceEditorComponent;

然后,我使用setTxt()方法将代码动态分配给编辑器。

this.aceComponent.setText(this.myTextWithHtmlCode);

关于如何呈现HTML而不是代码的任何想法?

0 个答案:

没有答案