Keyboard shortcuts to expand and collapse all comments
This change adds keyboard shortcuts to the "gr-diff-comment-thread"
expand all comments when 'e' is pressed and collapse all comments when
'shift + e' is pressed. Note that the keyboard event is detected on the
thread instead of the comment to minimize the number of events getting
triggered.
Feature: Issue 4738
Change-Id: Iab77349bd1527d7af5e05a827919a78a86909835
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js
index 791f949..2abd0a8 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js
@@ -81,7 +81,7 @@
},
patchNum: String,
showActions: Boolean,
- _commentCollapsed: {
+ collapsed: {
type: Boolean,
value: true,
observer: '_toggleCollapseClass',
@@ -103,7 +103,7 @@
attached: function() {
if (this.editing) {
- this._commentCollapsed = false;
+ this.collapsed = false;
}
},
@@ -226,11 +226,11 @@
},
_handleToggleCollapsed: function() {
- this._commentCollapsed = !this._commentCollapsed;
+ this.collapsed = !this.collapsed;
},
- _toggleCollapseClass: function(_commentCollapsed) {
- if (_commentCollapsed) {
+ _toggleCollapseClass: function(collapsed) {
+ if (collapsed) {
this.$.container.classList.add('collapsed');
} else {
this.$.container.classList.remove('collapsed');