angular - 无法在 Angular 7 中的 Ace 编辑器上执行 applyDeltas
问题描述
我正在尝试更新我从这里安装的 Ace-Code-Editor https://www.npmjs.com/package/ng2-ace-editor
在 API 中,我试图在applyDeltas()
这里找到https://ace.c9.io/#nav=api&api=document但我找不到它。
代码片段
this._thiscurrentdelta = this.codeeditorservice._currentCode.subscribe(changes => {
this._changes = changes;
if(this._last_applied_change != changes){
this.editor.applyDeltas([changes] // doesn't work
this.editor.getSession().applyDeltas([changes]) // doesn't work
this.editor.getSession().getDocument().applyDeltas([changes]) // doesn't work
this.editor.getDocument().applyDeltas([changes]) // doesn't work
}
});
所有三种方法都在抛出,“找不到函数”
解决方案
事实证明,方法调用在 Node.js 和 Angular 中使用是不同的 b/w:
https://github.com/fxmontigny/ng2-ace-editor/issues/62
this.editor.getEditor().sesson.getDocument().applydeltas(event);
推荐阅读
- php - 遍历一个关联数组后跟一个字符串模式?
- caddy - Caddyv2 Caddyfile TLS 配置
- soap - openapi oneOf 的 WSDL 等效项是什么?
- string - 如何防止 Google Apps 脚本将现有字符串(日期、持续时间等)更改为 Google 表格中的时间戳
- r - 为什么尝试在 Linux 上运行 R 脚本时出现 exec 格式错误?
- asp.net - ValidationExpression (asp.net RegularExpressionValidator) 不允许重复数字
- sling - Wildfly 24.0.1-Final 中的 Apache Sling 部署问题
- swift - SKSpriteNodes 相互碰撞并粘在上面
- python - 如何使用 Plotly 使用倾斜或旋转的线绘制椭圆体?
- reactjs - React 转换 xml 以显示为 html