From 1a4af9aff99be8455c26c86cb42cfc0aaf5eeb82 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Thu, 4 Apr 2013 21:38:53 -0400 Subject: [PATCH] example code explains extension --- demo/show_keyboard_shortcuts.html | 15 ++++++++++----- demo/show_settings_menu.html | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/demo/show_keyboard_shortcuts.html b/demo/show_keyboard_shortcuts.html index 8d456c5b..c55902f6 100644 --- a/demo/show_keyboard_shortcuts.html +++ b/demo/show_keyboard_shortcuts.html @@ -21,12 +21,17 @@ -
function foo(items) {
-    var i;
-    for (i = 0; i < items.length; i++) {
-        alert("Ace Rocks " + items[i]);
+
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();
     }
-}
+}]); +
diff --git a/demo/show_settings_menu.html b/demo/show_settings_menu.html index b23d9a6b..72de2357 100644 --- a/demo/show_settings_menu.html +++ b/demo/show_settings_menu.html @@ -21,12 +21,18 @@ -
function foo(items) {
-    var i;
-    for (i = 0; i < items.length; i++) {
-        alert("Ace Rocks " + items[i]);
-    }
-}
+
Editor.prototype.showSettingsMenu = function () {
+    showSettingsMenu(this);
+};
+editor.commands.addCommands([{
+    name: "showSettingsMenu",
+    bindKey: {win: "Ctrl-q", mac: "Command-q"},
+    exec: function(editor, line) {
+        editor.showSettingsMenu();
+    },
+    readOnly: true
+}]);
+