parent
e681f1f36f
commit
868778b079
|
@ -99,7 +99,14 @@ async function onQuickReplyEnabledInput() {
|
|||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
// New function to handle input on quickActionEnabled
|
||||
async function onQuickActionEnabledInput() {
|
||||
extension_settings.quickReply.quickActionEnabled = $(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
async function sendQuickReply(index) {
|
||||
const existingText = $("#send_textarea").val();
|
||||
const prompt = extension_settings.quickReply.quickReplySlots[index]?.mes || '';
|
||||
|
||||
if (!prompt) {
|
||||
|
@ -107,8 +114,25 @@ async function sendQuickReply(index) {
|
|||
return;
|
||||
}
|
||||
|
||||
$("#send_textarea").val(prompt);
|
||||
$("#send_but").trigger('click');
|
||||
let newText;
|
||||
|
||||
if (existingText) {
|
||||
// If existing text, add space after prompt
|
||||
newText = existingText + ' ' + prompt + ' ';
|
||||
} else {
|
||||
// If no existing text, add prompt only
|
||||
newText = prompt + ' ';
|
||||
}
|
||||
|
||||
$("#send_textarea").val(newText);
|
||||
|
||||
// Set the focus back to the textarea
|
||||
$("#send_textarea").focus();
|
||||
|
||||
// Only trigger send button if quickActionEnabled is not checked
|
||||
if (!$("#quickActionEnabled").prop('checked')) {
|
||||
$("#send_but").trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
function addQuickReplyBar() {
|
||||
|
@ -309,6 +333,10 @@ jQuery(async () => {
|
|||
<input id="quickReplyEnabled" type="checkbox" />
|
||||
Enable Quick Replies
|
||||
</label>
|
||||
<label class="checkbox_label marginBot10 wide100p flexnowrap">
|
||||
<input id="quickActionEnabled" type="checkbox" />
|
||||
Disable Send / Insert In User Input
|
||||
</label>
|
||||
<div class="flex-container flexnowrap wide100p">
|
||||
<select id="quickReplyPresets" name="quickreply-preset">
|
||||
</select>
|
||||
|
@ -331,6 +359,8 @@ jQuery(async () => {
|
|||
|
||||
$('#extensions_settings2').append(settingsHtml);
|
||||
|
||||
// Add event handler for quickActionEnabled
|
||||
$('#quickActionEnabled').on('input', onQuickActionEnabledInput);
|
||||
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
||||
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
||||
$("#quickReplyPresetSaveButton").on('click', saveQuickReplyPreset);
|
||||
|
|
Loading…
Reference in New Issue