Browse Source

Add support for committing a text entry on cmd/shift click (#1185)

alaoui abdellah 5 years ago
parent
commit
980d08ce56
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/element/textWysiwyg.tsx

+ 7 - 0
src/element/textWysiwyg.tsx

@@ -109,6 +109,13 @@ export function textWysiwyg({
       ev.preventDefault();
       handleSubmit();
     }
+    if (ev.key === KEYS.ENTER && (ev.shiftKey || ev.metaKey)) {
+      ev.preventDefault();
+      if (ev.isComposing || ev.keyCode === 229) {
+        return;
+      }
+      handleSubmit();
+    }
     if (ev.key === KEYS.ENTER && !ev.shiftKey) {
       ev.stopPropagation();
     }