Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix key events for results view #1710

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions src/views/htmlcontent/src/js/components/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,22 +796,30 @@ export class AppComponent implements OnInit, AfterViewChecked {
*
*/
async keyEvent(e: any): Promise<void> {
if (e.target.classList.contains('slick-cell')) {
// set selection to none for messages so that ctrl + A
// only selects the results grid
const isGridSelection: boolean = e.target.classList.contains('slick-cell');
if (isGridSelection) {
$('#messages').css('user-select', 'none');
let eString = this.shortcuts.buildEventString(e);
let result = await this.shortcuts.getEvent(eString);
if (result) {
let eventName = <string> result;
this.shortcutfunc[eventName]();
if (eventName === 'event.selectAll') {
window.getSelection().empty();
rangy.getSelection().removeAllRanges();
}
e.stopImmediatePropagation();
}
} else {
// otherwise make the messages selectable
$('#messages').css('user-select', 'text');
}
let eString = this.shortcuts.buildEventString(e);
let result = await this.shortcuts.getEvent(eString);
if (result) {
let eventName = <string> result;
// Don't select all the grid if it's not grid selection
// otherwise run every shortcut function
if (!(eventName === 'event.selectAll' && !isGridSelection)) {
this.shortcutfunc[eventName]();
}
if (eventName === 'event.selectAll') {
window.getSelection().empty();
rangy.getSelection().removeAllRanges();
}
e.stopImmediatePropagation();
}
}

/**
Expand Down