diff options
author | Ananya Sen | 2012-04-27 17:12:37 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-27 17:12:37 -0700 |
commit | 1314a030f5f883e2222958aa2ba1b8c031be9364 (patch) | |
tree | d6913dc0886745eee9efc7f0beda6a6507a22dec | |
parent | 7aee2bd02218d9572ac1c00f191d08efe57f5bcb (diff) | |
download | ninja-1314a030f5f883e2222958aa2ba1b8c031be9364.tar.gz |
added key shortcuts' list dropdown in view option bar
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
4 files changed, 66 insertions, 6 deletions
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css index 442a5183..ed314fc9 100644 --- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css | |||
@@ -51,3 +51,41 @@ | |||
51 | border-color: #616161; | 51 | border-color: #616161; |
52 | } | 52 | } |
53 | 53 | ||
54 | .viewOptions .shortKeys{ | ||
55 | float: right; | ||
56 | margin-right:30px; | ||
57 | border: 1px solid #616161; | ||
58 | border-radius: 6px; | ||
59 | padding-left: 5px; | ||
60 | padding-right: 5px; | ||
61 | cursor:pointer; | ||
62 | position:relative; | ||
63 | } | ||
64 | |||
65 | .viewOptions .shortKeys .dropdownArrow{ | ||
66 | font-size: 0.7em; | ||
67 | color:#d1d1d1; | ||
68 | } | ||
69 | |||
70 | .viewOptions .shortKeys .list{ | ||
71 | position:absolute; | ||
72 | border: 1px solid #616161; | ||
73 | bottom: 16px; | ||
74 | left: -2px; | ||
75 | opacity: 1; | ||
76 | white-space: nowrap; | ||
77 | padding:5px; | ||
78 | background-color: #313131; | ||
79 | } | ||
80 | |||
81 | .viewOptions .shortKeys .list div{ | ||
82 | display: block; | ||
83 | } | ||
84 | |||
85 | .viewOptions .shortKeys .hide{ | ||
86 | visibility: hidden; | ||
87 | } | ||
88 | |||
89 | .viewOptions .shortKeys .show{ | ||
90 | visibility: visible; | ||
91 | } \ No newline at end of file | ||
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html index fadc4683..8a46a0b1 100644 --- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html | |||
@@ -38,7 +38,8 @@ | |||
38 | "format":{"#": "format"}, | 38 | "format":{"#": "format"}, |
39 | "comment":{"#":"comment"}, | 39 | "comment":{"#":"comment"}, |
40 | "uncomment":{"#":"uncomment"}, | 40 | "uncomment":{"#":"uncomment"}, |
41 | "themeSelect":{"#":"themeSelect"} | 41 | "themeSelect":{"#":"themeSelect"}, |
42 | "shortKeys":{"#":"shortKeys"} | ||
42 | } | 43 | } |
43 | } | 44 | } |
44 | } | 45 | } |
@@ -72,6 +73,15 @@ | |||
72 | <option value="xq-dark" >XQ-DARK</option> | 73 | <option value="xq-dark" >XQ-DARK</option> |
73 | </select> | 74 | </select> |
74 | </div> | 75 | </div> |
76 | <div id="shortKeys" class="shortKeys"> | ||
77 | <div class="list hide"> | ||
78 | <div><span>ctrl+space : code hints</span></div> | ||
79 | <div><span>ctrl+/ : comment selection</span></div> | ||
80 | <div><span>ctrl+shift+/ : uncomment selection</span></div> | ||
81 | </div> | ||
82 | <span>ShortKeys</span> | ||
83 | <span class="dropdownArrow">▼</span> | ||
84 | </div> | ||
75 | </div> | 85 | </div> |
76 | </div> | 86 | </div> |
77 | </body> | 87 | </body> |
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js index 41fd991e..6c0e3f05 100644 --- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js | |||
@@ -46,6 +46,7 @@ var CodeEditorViewOptions = exports.CodeEditorViewOptions = Montage.create(Compo | |||
46 | this.comment.addEventListener("click", this.handleComment.bind(this), false); | 46 | this.comment.addEventListener("click", this.handleComment.bind(this), false); |
47 | this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false); | 47 | this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false); |
48 | this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false); | 48 | this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false); |
49 | this.shortKeys.addEventListener("click", this.handleShortKeys.bind(this), false); | ||
49 | } | 50 | } |
50 | }, | 51 | }, |
51 | 52 | ||
@@ -71,6 +72,19 @@ var CodeEditorViewOptions = exports.CodeEditorViewOptions = Montage.create(Compo | |||
71 | this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; | 72 | this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; |
72 | this.application.ninja.codeEditorController.handleThemeSelection(); | 73 | this.application.ninja.codeEditorController.handleThemeSelection(); |
73 | } | 74 | } |
75 | }, | ||
76 | |||
77 | handleShortKeys:{ | ||
78 | value:function(evt){ | ||
79 | var list = this.shortKeys.querySelector(".list"); | ||
80 | if(list && list.classList.contains("hide")){ | ||
81 | list.classList.remove("hide"); | ||
82 | list.classList.add("show"); | ||
83 | }else if(list && list.classList.contains("show")){ | ||
84 | list.classList.remove("show"); | ||
85 | list.classList.add("hide"); | ||
86 | } | ||
87 | } | ||
74 | } | 88 | } |
75 | 89 | ||
76 | }); \ No newline at end of file | 90 | }); \ No newline at end of file |
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index f4ca6018..0223165f 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js | |||
@@ -140,16 +140,14 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
140 | || (keyEvent.keyCode === 190)//period | 140 | || (keyEvent.keyCode === 190)//period |
141 | || (keyEvent.keyCode === 189)//underscore, dash | 141 | || (keyEvent.keyCode === 189)//underscore, dash |
142 | ) | 142 | ) |
143 | && !( (keyEvent.keyCode === 219)//open bracket [ | 143 | && !(keyEvent.ctrlKey //ctrl |
144 | || (keyEvent.ctrlKey || keyEvent.metaKey)//ctrl | 144 | || keyEvent.metaKey//cmd |
145 | || (keyEvent.keyCode === 219)//open bracket [ | ||
145 | || (keyEvent.keyCode === 221)//close bracket ] | 146 | || (keyEvent.keyCode === 221)//close bracket ] |
146 | || (keyEvent.shiftKey && keyEvent.keyCode === 219)//open bracket { | 147 | || (keyEvent.shiftKey && keyEvent.keyCode === 219)//open bracket { |
147 | || (keyEvent.shiftKey && keyEvent.keyCode === 221)//close bracket } | 148 | || (keyEvent.shiftKey && keyEvent.keyCode === 221)//close bracket } |
148 | || (keyEvent.shiftKey && keyEvent.keyCode === 57)//open bracket ( | 149 | || (keyEvent.shiftKey && keyEvent.keyCode === 57)//open bracket ( |
149 | || (keyEvent.shiftKey && keyEvent.keyCode === 48)//close bracket ) | 150 | || (keyEvent.shiftKey && keyEvent.keyCode === 48)//close bracket ) |
150 | || ((keyEvent.keyCode === 83) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+S | ||
151 | || ((keyEvent.keyCode === 90) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+z | ||
152 | || ((keyEvent.keyCode === 89) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+y | ||
153 | ) | 151 | ) |
154 | ){ | 152 | ){ |
155 | status = true; | 153 | status = true; |