mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #7052 from overleaf/td-suppress-comment-page-up-down
Suppress Page Up/Down keypresses in comment textarea GitOrigin-RevId: 244bfdc4f1a1470870180a166ba7d2b2792fe614
This commit is contained in:
parent
7560404d93
commit
64dd07a50f
2 changed files with 11 additions and 0 deletions
|
@ -480,6 +480,7 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
|
||||||
expandable-text-area
|
expandable-text-area
|
||||||
ng-model="state.content"
|
ng-model="state.content"
|
||||||
ng-keypress="handleCommentKeyPress($event);"
|
ng-keypress="handleCommentKeyPress($event);"
|
||||||
|
ng-keydown="handleCommentKeyDown($event);"
|
||||||
placeholder=translate("add_your_comment_here")
|
placeholder=translate("add_your_comment_here")
|
||||||
focus-on="comment:new:open"
|
focus-on="comment:new:open"
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,6 +31,16 @@ App.directive('addCommentEntry', () => ({
|
||||||
scope.onCancel()
|
scope.onCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ignoreKeysInTextAreas = ['PageDown', 'PageUp']
|
||||||
|
|
||||||
|
scope.handleCommentKeyDown = function (ev) {
|
||||||
|
if (ignoreKeysInTextAreas.includes(ev.key)) {
|
||||||
|
if (ev.target.closest('textarea')) {
|
||||||
|
ev.preventDefault()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scope.handleCommentKeyPress = function (ev) {
|
scope.handleCommentKeyPress = function (ev) {
|
||||||
if (ev.keyCode === 13 && !ev.shiftKey && !ev.ctrlKey && !ev.metaKey) {
|
if (ev.keyCode === 13 && !ev.shiftKey && !ev.ctrlKey && !ev.metaKey) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
|
|
Loading…
Reference in a new issue