##// END OF EJS Templates
allow selecting codemirror keymap in menu
Min RK -
Show More
@@ -54,6 +54,30 b' define(['
54 54 this.element.find('#menu-replace').click(function () {
55 55 editor.codemirror.execCommand("replace");
56 56 });
57 this.element.find('#menu-keymap-default').click(function () {
58 editor.update_codemirror_options({
59 vimMode: false,
60 keyMap: null
61 });
62 });
63 this.element.find('#menu-keymap-sublime').click(function () {
64 editor.update_codemirror_options({
65 vimMode: false,
66 keyMap: 'sublime'
67 });
68 });
69 this.element.find('#menu-keymap-emacs').click(function () {
70 editor.update_codemirror_options({
71 vimMode: false,
72 keyMap: 'emacs'
73 });
74 });
75 this.element.find('#menu-keymap-vim').click(function () {
76 editor.update_codemirror_options({
77 vimMode: true,
78 keyMap: 'vim'
79 });
80 });
57 81
58 82 // View
59 83 this.element.find('#menu-line-numbers').click(function () {
@@ -67,6 +91,9 b' define(['
67 91 var text = lineNumbers ? "Hide" : "Show";
68 92 text = text + " Line Numbers";
69 93 that.element.find('#menu-line-numbers').find("a").text(text);
94 var keyMap = editor.codemirror.getOption('keyMap') || "default";
95 that.element.find(".selected-keymap").removeClass("selected-keymap");
96 that.element.find("#menu-keymap-" + keyMap).addClass("selected-keymap");
70 97 });
71 98 };
72 99
@@ -46,6 +46,12 b' data-file-path="{{file_path}}"'
46 46 <ul id="edit-menu" class="dropdown-menu">
47 47 <li id="menu-find"><a href="#">Find</a></li>
48 48 <li id="menu-replace"><a href="#">Find &amp; Replace</a></li>
49 <li class="divider"></li>
50 <li>Key Map</li>
51 <li id="menu-keymap-default"><a href="#">Default<i class="fa"></i></a></li>
52 <li id="menu-keymap-sublime"><a href="#">Sublime Text<i class="fa"></i></a></li>
53 <li id="menu-keymap-vim"><a href="#">Vim<i class="fa"></i></a></li>
54 <li id="menu-keymap-emacs"><a href="#">emacs<i class="fa"></i></a></li>
49 55 </ul>
50 56 </li>
51 57 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
General Comments 0
You need to be logged in to leave comments. Login now