Ace编辑器getValue换行格式?

时间:2017-02-12 02:20:47

标签: javascript python ace-editor

Ace编辑器只接受\ n和\"设置: 你可以看到setValue的内容有\ n和\"标签

var editor1 = ace.edit("editor1");
editor1.setTheme("ace/theme/twilight");
editor1.getSession().setMode("ace/mode/python");
editor1.setFontSize(15);
editor1.setValue("def main():\n    # Your code goes here\n\nif __name__ == \"__main__\":\n    main()");

但是当我使用editor1.getValue()从ace编辑器获取值时。 它将获得非下列标签:

def main():
    # Your code goes here

if __name__ == "__main__":
    main()

但是如何将非\ n的值再次用于editor1.setValue。 我想实现可以修改数据库中旧代码存储的函数。 代码将editor1.getValue()存储到数据库中。 所以这是错误的 editor1.setValue(

def main():
    # Your code goes here

if __name__ == "__main__":
    main()

这是我的项目:https://github.com/easytrader/StrategyWebsite

如何解决这个问题? 非常感谢你。

0 个答案:

没有答案
相关问题