File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121</ head >
2222< body >
2323
24- < pre id ="editor "> Editor.prototype.showKeyboardShortcuts = function () {
25- showKeyboardShortcuts(this);
26- };
27- editor.commands.addCommands([{
28- name: "showKeyboardShortcuts",
29- bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
30- exec: function(editor, line) {
31- editor.showKeyboardShortcuts();
32- }
33- }]);
24+ < pre id ="editor "> var editor = ace.edit("editor");
25+ editor.setTheme("ace/theme/twilight");
26+ (function () {
27+ var modelist = ace.require('ace/ext/modelist');
28+ // the file path could come from an xmlhttp request, a drop event,
29+ // or any other scriptable file loading process.
30+ // Extensions could consume the modelist and use it to dynamically
31+ // set the editor mode. Webmasters could use it in their scripts
32+ // for site specific purposes as well.
33+ var filePath = 'blahblah/weee/some.js';
34+ var mode = modelist.getModeFromPath(filePath).mode;
35+ console.log(mode);
36+ editor.getSession().setMode(mode);
37+ }());
3438</ pre >
3539
3640< script src ="../build/src-noconflict/ace.js " type ="text/javascript " charset ="utf-8 "> </ script >
You can’t perform that action at this time.
0 commit comments