【发布时间】:2020-07-01 12:15:54
【问题描述】:
我在我的 Angular 项目中实现了 ngX-CodeMirror。我在一个角材料模态中添加了代码编辑器。它工作正常我无法移动光标,以便我可以单击任何文本。我可以点击一些文本,但不是我们想要的。
我在 stackblitz 中添加了这个问题:Code Mirror Cursor Issue
这是我的 component.html 文件中的 sn-p
<ngx-codemirror
#codeMirror
[options]="codeMirrorOptions"
[(ngModel)]="codeObj">
</ngx-codemirror>
在component.ts中,
import { Component, OnInit, ViewChild, ElementRef, Input } from "@angular/core";
import { CodemirrorComponent } from "@ctrl/ngx-codemirror";
export class CodeEditorComponent implements OnInit {
@Input()
configs: any;
testData: any;
@ViewChild("textArea") textArea: ElementRef;
codeMirrorOptions: any = {
theme: "idea",
mode: "application/json",
lineNumbers: true,
autoRefresh: true
};
codeObj: any;
constructor() {}
ngOnInit(): void {
this.codeObj = JSON.stringify(this.configs, undefined, 2);
}
}
我不确定为什么会发生这种情况,或者我们是否需要提供任何特定选项来查看鼠标光标。 我在codeMirrorDiscussionForum 看到了一个相关的查询,但还没有找到解决方案。
请通过参考 stackblitz 链接帮助我解决这个问题。
【问题讨论】:
标签: angular typescript codemirror ngx-codemirror