Working with Ace,ace web编辑器,一款可以语法高亮的牛逼编辑器

Working with Ace

In all of these examples Ace has been invoked as shown in the embedding guide.

Configuring the editor

there are several ways to pass configuration to Ace

// pass options to ace.edit
ace.edit(element, {
mode: "ace/mode/javascript",
selectionStyle: "text"
})
// use setOptions method to set several options at once
editor.setOptions({
autoScrollEditorIntoView: true,
copyWithEmptySelection: true,
});
// use setOptions method
editor.setOption("mergeUndoDeltas", "always");
 
// some options are also available as methods e.g.
editor.setTheme(...)
 
// to get the value of the option use
editor.getOption("optionName");
 

See Configuring-Ace wiki page for a more detailed list of options.

posted @ 2025-04-25 10:12  青山下  阅读(6)  评论(0)    收藏  举报