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