]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Support control/command-enter submit comment form
authorshamoon <4887959+shamoon@users.noreply.github.com>
Fri, 17 Mar 2023 05:56:33 +0000 (22:56 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Sat, 18 Mar 2023 01:47:03 +0000 (18:47 -0700)
src-ui/src/app/components/document-comments/document-comments.component.html
src-ui/src/app/components/document-comments/document-comments.component.ts

index ffc8bfb9f7276be03d7faa5586c1a4d6b183c976..b303524147c395adfaeadf4f773d03aab724c49e 100644 (file)
@@ -1,7 +1,7 @@
 <div *ngIf="comments">
     <form [formGroup]="commentForm" class="needs-validation mt-3" *appIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Comment }" novalidate>
         <div class="form-group">
-            <textarea class="form-control form-control-sm" [class.is-invalid]="newCommentError" rows="3" formControlName="newComment" placeholder="Enter comment" i18n-placeholder required></textarea>
+            <textarea class="form-control form-control-sm" [class.is-invalid]="newCommentError" rows="3" formControlName="newComment" placeholder="Enter comment" i18n-placeholder (keydown)="commentFormKeydown($event)" required></textarea>
             <div class="invalid-feedback" i18n>
                 Please enter a comment.
             </div>
index 602d6bdb1d9260070e39764395433f5a2a078609..316a2ff289c83cbacc5672a92b8e2d3719245d01 100644 (file)
@@ -106,4 +106,10 @@ export class DocumentCommentsComponent extends ComponentWithPermissions {
     }
     return nameComponents.join(' ')
   }
+
+  commentFormKeydown(event: KeyboardEvent) {
+    if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
+      this.addComment()
+    }
+  }
 }