Mercurial Hosting > chat
changeset 78:2a602ef53eef
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 09 Mar 2025 22:20:36 -0600 |
parents | 624654817f99 |
children | b5a316575e64 |
files | src/chat.js src/index.html.luan |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/chat.js Sun Mar 09 19:29:41 2025 -0600 +++ b/src/chat.js Sun Mar 09 22:20:36 2025 -0600 @@ -71,6 +71,13 @@ } } +function editTextareaKey(event) { + if( event.keyCode===13 && !event.shiftKey && !event.ctrlKey && !isMobile ) { + event.preventDefault(); + savePost(event.target); + } +} + function fixPosts() { let divs = document.querySelectorAll('div[post][fix]'); for( let div of divs ) {
--- a/src/index.html.luan Sun Mar 09 19:29:41 2025 -0600 +++ b/src/index.html.luan Sun Mar 09 22:20:36 2025 -0600 @@ -84,7 +84,7 @@ </dialog> <dialog edit_post> <h2>Edit Message</h2> - <p><textarea onfocus="fixTextarea(event)" oninput="fixTextarea(event)"></textarea></p> + <p><textarea onfocus="fixTextarea(event)" oninput="fixTextarea(event)" onkeydown="editTextareaKey(event)"></textarea></p> <div buttons> <button onclick="closeModal(this)">Cancel</button> <button onclick="savePost(this)">Save</button>