@@ -54,6 +54,12 @@ window.MaxExtensionButtons = {
5454 ` ;
5555
5656 // --- Tooltip & Shortcut ---
57+ // Determine auto-send status from global config to add to tooltip
58+ const autoSendEnabled = ( type === 'copy' )
59+ ? window . globalCrossChatConfig ?. autosendCopy
60+ : window . globalCrossChatConfig ?. autosendPaste ;
61+ const autoSendDescription = autoSendEnabled ? ' (Auto-sends)' : '' ;
62+
5763 let shortcutDescription = '' ;
5864 if ( shortcutKey ) {
5965 buttonElement . dataset . shortcutKey = shortcutKey . toString ( ) ;
@@ -62,7 +68,8 @@ window.MaxExtensionButtons = {
6268 }
6369
6470 const updateTooltip = ( text ) => {
65- buttonElement . setAttribute ( 'title' , text + shortcutDescription ) ;
71+ // Combine base text, auto-send status, and shortcut info
72+ buttonElement . setAttribute ( 'title' , text + autoSendDescription + shortcutDescription ) ;
6673 } ;
6774
6875 updateTooltip ( baseTooltips [ type ] ) ;
@@ -84,23 +91,28 @@ window.MaxExtensionButtons = {
8491 chrome . runtime . sendMessage ( { type : 'saveStoredPrompt' , promptText : text } , ( ) => {
8592 logConCgp ( '[buttons-cross-chat] Prompt saved.' ) ;
8693 // Visually indicate success by briefly changing the tooltip
87- const originalTitle = buttonElement . getAttribute ( 'title' ) ;
8894 updateTooltip ( 'Copied!' ) ;
8995 setTimeout ( ( ) => updateTooltip ( baseTooltips . copy ) , 1500 ) ;
9096 } ) ;
9197
92- if ( window . globalCrossChatConfig ?. autosendCopy ) {
93- processCustomSendButtonClick ( event , text , true ) ;
94- }
98+ // The `autosend` value passed here will be inverted by `processCustomSendButtonClick` if shift is held.
99+ // This ensures that shift+click correctly toggles the send behavior.
100+ const autoSend = window . globalCrossChatConfig ?. autosendCopy ;
101+ // Calling processCustomSendButtonClick with an empty string for the text
102+ // will prevent appending the text again, but will still trigger the auto-send
103+ // mechanism with the existing text.
104+ processCustomSendButtonClick ( event , '' , autoSend ) ;
105+
95106 } else if ( type === 'paste' ) {
96107 chrome . runtime . sendMessage ( { type : 'getStoredPrompt' } , ( response ) => {
97108 if ( response ?. promptText ) {
98- // Use shift key to override autosend setting, consistent with other buttons
99- const autoSend = event . shiftKey ? ! window . globalCrossChatConfig . autosendPaste : window . globalCrossChatConfig . autosendPaste ;
109+ // The `autosend` value is taken directly from config.
110+ // `processCustomSendButtonClick` will handle shift+click to invert it.
111+ // This fixes a bug where shift+click was double-inverting the behavior.
112+ const autoSend = window . globalCrossChatConfig . autosendPaste ;
100113 processCustomSendButtonClick ( event , response . promptText , autoSend ) ;
101114 } else {
102115 logConCgp ( '[buttons-cross-chat] No prompt to paste.' ) ;
103- const originalTitle = buttonElement . getAttribute ( 'title' ) ;
104116 updateTooltip ( '*No prompt has been saved*' ) ;
105117 setTimeout ( ( ) => updateTooltip ( baseTooltips . paste ) , 2000 ) ;
106118 }
0 commit comments