Control + enter to submit form

FossilOrigin-Name: 8f7945affc483246637b0cd636a609b1f697469350ceef114d1ac54ebe9180bf
This commit is contained in:
nekobit 2022-07-09 08:27:08 +00:00
parent f078d16523
commit da5e8039db
4 changed files with 37 additions and 2 deletions

12
dist/js/main.js vendored
View file

@ -25,6 +25,17 @@ function reply_get_mentions(reply, content)
return res;
}
function form_enter_submit(e, that)
{
if ((e.ctrlKey || e.metaKey) && e.keyCode === 13)
that.closest('form').submit();
}
// Submit form entry on enter when in textbox/textarea
document.querySelectorAll("input[type=text], input[type=url], input[type=email], input[type=password], textarea").forEach((i) => {
i.addEventListener("keydown", e => form_enter_submit(e, i));
});
function construct_quick_reply_form(status)
{
let src = document.createElement("form");
@ -87,6 +98,7 @@ function construct_quick_reply_form(status)
statusfooter.appendChild(statusfooter_sides.left);
statusfooter.appendChild(statusfooter_sides.right);
statusbox.appendChild(textarea);
textarea.addEventListener("keydown", e => form_enter_submit(e, textarea));
statusbox.appendChild(statusfooter);
src.appendChild(hiddeninput);
src.appendChild(statusbox);

View file

@ -262,3 +262,19 @@ ul.large-list li .edit-list-btn
{
background-color: #371b1b;
}
.statusbox .post-group input[type=radio].hidden:checked + .visibility-icon svg
{
stroke: #fff;
}
.statusbox .post-group .visibility-icon:hover
{
background-color: #4f4f4f;
}
.emoji-react-box
{
border: 1px solid #515151;
padding: 3px 7px;
}

9
dist/treebird.css vendored
View file

@ -1729,11 +1729,18 @@ input[type=radio].hidden:not(:checked) + .emoji-picker-emojos
{
display: inline-block;
list-style-type: none;
padding: 5px 7px;
padding: 3px 7px;
margin: 1px 2px;
vertical-align: middle;
}
.emoji-react-box .emoji
{
position: relative;
top: 1px;
font-size: 20px;
}
.emoji-react-box.custom-emoji-container
{
padding: 1px 5px;

View file

@ -43,7 +43,7 @@
<label>
<input type="radio" name="visibility" value="public" class="hidden" checked>
<div class="visibility-icon vis-public">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>
</div>
</label>
</div>