如何使用Ace Editor使用getvalue? [英] How do I use getvalue using Ace Editor?
问题描述
我正在使用Ace编辑器,但我没有使用JavaScript很多,所以我发现很难在没有适当文档的情况下让它真正工作。
I am using the Ace Editor, but I do no use JavaScript a lot so I'm finding it hard to make it actually work without a proper documentation.
我正在研究一个本地的PHP文件编辑器..所以打开文件等,工作正常,setcontent就像一个魅力。但是现在我想将编辑器的信息保存回文件。
I'm working on a local PHP file editor.. so open files etc, works fine, setcontent works like a charm. But now I want to save the editor's information back to the file.
本身并不是真正的问题。但是我如何检索var代码。
如果我使用document.write,它将不会在编辑器中显示当前信息
In itself not really a problem. But how do I retrieve the var code. If I use document.write it will not show the current information in the editor
如果我可以打印出编辑器中的内容,我可以保存数据。但我不知道如何为getValue提供有效的回调
If I could print out what is in the editor I could save the data. But I don't know how to provide a valid callback for getValue
有人可以给我一些关于该做什么的更多信息吗?
Can someone please give me a little bit more information on what to do?
推荐答案
简单地说:
editor.getSession().on('change', function(){
editor.getSession().getValue();
});
这篇关于如何使用Ace Editor使用getvalue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!