diff --git a/demo/mode_list.html b/demo/mode_list.html index 9aa3f295..7285c77d 100644 --- a/demo/mode_list.html +++ b/demo/mode_list.html @@ -21,16 +21,20 @@
-Editor.prototype.showKeyboardShortcuts = function () {
- showKeyboardShortcuts(this);
-};
-editor.commands.addCommands([{
- name: "showKeyboardShortcuts",
- bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
- exec: function(editor, line) {
- editor.showKeyboardShortcuts();
- }
-}]);
+var editor = ace.edit("editor");
+editor.setTheme("ace/theme/twilight");
+(function () {
+ var modelist = ace.require('ace/ext/modelist');
+ // the file path could come from an xmlhttp request, a drop event,
+ // or any other scriptable file loading process.
+ // Extensions could consume the modelist and use it to dynamically
+ // set the editor mode. Webmasters could use it in their scripts
+ // for site specific purposes as well.
+ var filePath = 'blahblah/weee/some.js';
+ var mode = modelist.getModeFromPath(filePath).mode;
+ console.log(mode);
+ editor.getSession().setMode(mode);
+}());