删除ACE编辑器

时间:2016-07-12 08:17:38

标签: javascript word-wrap ace-editor

我需要删除在ACE编辑器中打破行后自动创建的offseting 4“”

我尝试使用同样有效的editor.setTabSize(0),但后来我无法使用TAB识别代码,因为它会将“undefined”抛出代码。我在ACE网页上搜索过,但没有那样的东西,当搜索论坛时,它用setBehaviosrEnabled告诉了一些东西,但是这个都没有用

知道如何摆脱这4个空间吗?

问题: enter image description here

代码:

var editor = ace.edit("edittext");
editor.setOptions({
    maxLines: Infinity
});
editor.getSession().setUseWrapMode(true);
editor.setBehavioursEnabled(false);
editor.renderer.setOption('showLineNumbers', false);
editor.setTheme("ace/theme/xcode");

1 个答案:

答案 0 :(得分:6)

这由ace中的indentedSoftWrap设置控制,您可以通过运行

将其关闭
editor.setOption("indentedSoftWrap", false);

行为设置完全不相关,并控制关闭括号和标签的自动插入。

所以你上面的代码会变成

var editor = ace.edit("edittext");
editor.setOptions({
    maxLines: Infinity,  // this is going to be very slow on large documents
    useWrapMode: true,   // wrap text to view
    indentedSoftWrap: false, 
    behavioursEnabled: false, // disable autopairing of brackets and tags
    showLineNumbers: false, // hide the gutter
    theme: "ace/theme/xcode"
});