Add keybinding selection to textarea bookmarklet

This commit is contained in:
Chester Wood 2013-01-04 17:34:12 -07:00 • committed by nightwing
commit bd2e5381cc

View file

@ -324,6 +324,19 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
editorDiv.style.fontSize = value; editorDiv.style.fontSize = value;
break; break;
case "keybindings":
switch (value) {
case "vim":
editor.setKeyboardHandler(require("ace/keyboard/vim").handler);
break;
case "emacs":
editor.setKeyboardHandler(require("ace/keyboard/emacs").handler);
break;
default:
editor.setKeyboardHandler(null);
}
break;
case "softWrap": case "softWrap":
switch (value) { switch (value) {
case "off": case "off":
@ -391,6 +404,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
theme: "Theme:", theme: "Theme:",
fontSize: "Font Size:", fontSize: "Font Size:",
softWrap: "Soft Wrap:", softWrap: "Soft Wrap:",
keybindings: "Keyboard",
showPrintMargin: "Show Print Margin:", showPrintMargin: "Show Print Margin:",
useSoftTabs: "Use Soft Tabs:", useSoftTabs: "Use Soft Tabs:",
showInvisibles: "Show Invisibles" showInvisibles: "Show Invisibles"
@ -456,6 +470,11 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
80: "80", 80: "80",
free: "Free" free: "Free"
}, },
keybindings: {
ace: "ace",
vim: "vim",
emacs: "emacs"
},
showPrintMargin: BOOL, showPrintMargin: BOOL,
useSoftTabs: BOOL, useSoftTabs: BOOL,
showInvisibles: BOOL showInvisibles: BOOL
@ -518,6 +537,7 @@ exports.options = {
gutter: "false", gutter: "false",
fontSize: "12px", fontSize: "12px",
softWrap: "off", softWrap: "off",
keybindings: "ace",
showPrintMargin: "false", showPrintMargin: "false",
useSoftTabs: "true", useSoftTabs: "true",
showInvisibles: "true" showInvisibles: "true"