4
我试图在Ace编辑器中保存更改操作,然后播放它们。下面有一些伪代码 - 要点是applyDeltas API似乎没有为我的编辑器做任何事情。我绑定到编辑器更改事件,将更改变量推送到数组,并尝试稍后再播放 - 我在下面运行代码时看不到任何错误,但我也没有看到编辑器内容更改。applyDeltas在ACE编辑器
感谢
穆斯塔法
shouldRecord = true;
myStoredArray = new Array();
editor.on('change', function(e) {
if(shouldRecord) {
myStoredArray.push(e.data);
}
});
//on a button click
shouldRecord = false;
editor.getSession().setValue(''); //clear
for(var currentDelta in myStoredArray) {
editor.getSession().getDocument().applyDeltas(currentDelta);
}
我试过,但我得到的错误:遗漏的类型错误:无法读取的未定义的属性“行” ace.js 4368.我在做什么错? – bewithaman