Skip to content

Commit

Permalink
Merge pull request #387 from Progress1/lint_v4
Browse files Browse the repository at this point in the history
Fixed: first key is acting as shorcut in empty editor
  • Loading branch information
Progress1 authored Oct 17, 2024
2 parents 3ffdcb4 + fb64415 commit f9fee91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/gui/src/assets/keyboard_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ const keyboardMixin = targetId => ({
break;
}
}
// window.console.debug("keyAlias:", keyAlias, "activeElement:", document.activeElement);
// window.console.debug("keyAlias:", keyAlias, ", type:", document.activeElement.type, ", class:", document.activeElement.className, ", activeElement:", document.activeElement);
if ((document.activeElement == search_field ||
document.activeElement.className == "ql-editor" ||
document.activeElement.className.includes("ql-editor") ||
document.activeElement.type == "text" ||
document.activeElement.type == "textarea") && (keyAlias !== 'close_item' || press.keyCode !== 27)) {
// when search field, editor, text or textarea is active, ignore all keypresses except Escape
// example problem: Assess, create report from item and you type N in description field -> all is canceled and it creates new report again
// maybe we should check some specific shortcuts on "v-card" class? It's easier, less conditions
return;
}

Expand Down
11 changes: 10 additions & 1 deletion src/gui/src/components/assess/NewsItemSingleDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<v-tab href="#tab-2">
<span>{{ $t('assess.attributes') }}</span>
</v-tab>
<v-tab href="#tab-3">
<v-tab href="#tab-3" @click="onTabClick(3)">
<span>{{ $t('assess.comments') }}</span>
</v-tab>

Expand Down Expand Up @@ -305,6 +305,15 @@
handleDeletion() {
this.showDeletePopup = false;
this.cardItemToolbar('delete')
},
onTabClick(tabNumber) {
if (tabNumber === 3) { // Set the editor's focus so the user can start typing immediately
this.$nextTick(() => {
setTimeout(() => {
this.$refs.assessDetailComments.quill.focus();
}, 100);
});
}
}
}
}
Expand Down

0 comments on commit f9fee91

Please sign in to comment.