开发者

Is there a way for the Ace editor to preserve indentation upon a newline?

Would be helpful for editing a YAML or Python, 开发者_如何学JAVAfor example.


Indentation preservation is configured in the language mode (see f.e. getNextLineIndent), if you don't have this it probably is due to no language mode selected. Change the language mode by:

<script src="src/mode-python.js" type="text/javascript" charset="utf-8"></script>

<script>
var PythonMode = require("ace/mode/python").Mode;
editor.getSession().setMode(new PythonMode());
</script>

To get syntax highlighting and auto-indent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜