如何使用 Ace Editor 使用 getvalue? [英] How do I use getvalue using Ace Editor?

查看:32
本文介绍了如何使用 Ace Editor 使用 getvalue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆