Skip to content

Commit 55c761d

Browse files
committed
feat: add EnterSubmit hook
1 parent fd5063d commit 55c761d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

assets/js/app.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,17 @@ const Hooks = {
570570
});
571571
},
572572
},
573+
EnterSubmit: {
574+
mounted() {
575+
this.el.addEventListener("keydown", (e) => {
576+
if (e.key == "Enter") {
577+
this.el.form.dispatchEvent(
578+
new Event("submit", { bubbles: true, cancelable: true })
579+
);
580+
}
581+
});
582+
},
583+
},
573584
ExpandableText: {
574585
mounted() {
575586
const button = document.querySelector(`#${this.el.dataset.expandId}`);

0 commit comments

Comments
 (0)