【发布时间】:2018-06-01 11:11:36
【问题描述】:
我正在使用来自https://github.com/TypeCtrl/ngx-codemirror 的代码镜像包装器
我正在尝试获取 Codemirror 或编辑器的实例来编辑某些操作,但我无法获取该实例。
我需要在单击按钮时在当前光标位置添加文本,因此需要 CodeMirror API。
【问题讨论】:
-
你已经尝试了什么?您是否尝试过使用 tplRef 和 ViewChild?
-
在第一种情况下尝试了 viewchild 和 document.getElementByClassName('CodeMirror') 它的 ElementRef 不能分配给 Editor 在第二种情况下它的 Element 并且这也不能分配给 Editor 实例
-
嗨@TanmoyBhattacharjee 我有一个类似的问题,我在ngx-codemirror repo 中打开了一个问题仅供参考:github.com/TypeCtrl/ngx-codemirror/issues/109
标签: typescript angular5 codemirror