mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-20 21:41:32 +01:00
#2203 Fix copy not working in hidden messages
This commit is contained in:
parent
2fd59f5aef
commit
9db2f1cb91
@ -2097,7 +2097,6 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll
|
||||
|
||||
const newMessage = $(`#chat [mesid="${newMessageId}"]`);
|
||||
const isSmallSys = mes?.extra?.isSmallSys;
|
||||
newMessage.data('isSystem', isSystem);
|
||||
|
||||
if (isSmallSys === true) {
|
||||
newMessage.addClass('smallSysMes');
|
||||
@ -9351,14 +9350,9 @@ jQuery(async function () {
|
||||
else {
|
||||
$(document).on('pointerup', '.mes_copy', function () {
|
||||
if (this_chid !== undefined || selected_group) {
|
||||
const message = $(this).closest('.mes');
|
||||
|
||||
if (message.data('isSystem')) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var edit_mes_id = $(this).closest('.mes').attr('mesid');
|
||||
var text = chat[edit_mes_id]['mes'];
|
||||
const messageId = $(this).closest('.mes').attr('mesid');
|
||||
const text = chat[messageId]['mes'];
|
||||
navigator.clipboard.writeText(text);
|
||||
toastr.info('Copied!', '', { timeOut: 2000 });
|
||||
} catch (err) {
|
||||
@ -9617,8 +9611,8 @@ jQuery(async function () {
|
||||
}
|
||||
|
||||
hideSwipeButtons();
|
||||
let oldScroll = $('#chat')[0].scrollTop;
|
||||
const clone = JSON.parse(JSON.stringify(chat[this_edit_mes_id])); // quick and dirty clone
|
||||
const oldScroll = chatElement[0].scrollTop;
|
||||
const clone = structuredClone(chat[this_edit_mes_id]);
|
||||
clone.send_date = Date.now();
|
||||
clone.mes = $(this).closest('.mes').find('.edit_textarea').val();
|
||||
|
||||
@ -9631,7 +9625,7 @@ jQuery(async function () {
|
||||
|
||||
updateViewMessageIds();
|
||||
await saveChatConditional();
|
||||
$('#chat')[0].scrollTop = oldScroll;
|
||||
chatElement[0].scrollTop = oldScroll;
|
||||
showSwipeButtons();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user