首页 > 解决方案 > 无法在 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 
      }
    });

所有三种方法都在抛出,“找不到函数”

标签: angularrxjsace-editor

解决方案


事实证明,方法调用在 Node.js 和 Angular 中使用是不同的 b/w:

https://github.com/fxmontigny/ng2-ace-editor/issues/62

this.editor.getEditor().sesson.getDocument().applydeltas(event);


推荐阅读