webui: restore command+enter keyboard shortcut for diff comments
This used to exist. I missed it. Bring it back.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s6cd4f7fa81a2ee71k
diff --git a/webui/src/web-components/sketch-monaco-view.ts b/webui/src/web-components/sketch-monaco-view.ts
index 9f3fa50..b74097a 100644
--- a/webui/src/web-components/sketch-monaco-view.ts
+++ b/webui/src/web-components/sketch-monaco-view.ts
@@ -373,6 +373,7 @@
placeholder="Type your comment here..."
.value="${this.commentText}"
@input="${this.handleCommentInput}"
+ @keydown="${this.handleCommentKeydown}"
></textarea>
<div class="flex justify-end gap-2">
<button
@@ -403,6 +404,17 @@
}
/**
+ * Handle keyboard shortcuts in the comment textarea
+ */
+ private handleCommentKeydown(e: KeyboardEvent) {
+ // Check for Command+Enter (Mac) or Ctrl+Enter (other platforms)
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
+ e.preventDefault();
+ this.submitComment();
+ }
+ }
+
+ /**
* Get CSS class for selected text preview based on number of lines
*/
private getPreviewCssClass(): string {