File tree Expand file tree Collapse file tree 7 files changed +27
-10
lines changed
components/FloatingToolbar Expand file tree Collapse file tree 7 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 99
99
"Open Conversation Window" : " Open Conversation Window" ,
100
100
"Store to Independent Conversation Page" : " Store to Independent Conversation Page" ,
101
101
"Keep Conversation Window in Background" : " Keep conversation window in background, so that you can use shortcut keys to call it up in any program" ,
102
- "Max Response Token Length" : " Max Response Token Length"
102
+ "Max Response Token Length" : " Max Response Token Length" ,
103
+ "Always pin the floating window" : " Always pin the floating window"
103
104
}
Original file line number Diff line number Diff line change 99
99
"Open Conversation Window" : " 打开独立对话窗口" ,
100
100
"Store to Independent Conversation Page" : " 收纳到独立对话页" ,
101
101
"Keep Conversation Window in Background" : " 保持对话窗口在后台, 以便在任何程序中使用快捷键呼出" ,
102
- "Max Response Token Length" : " 响应的最大token长度"
102
+ "Max Response Token Length" : " 响应的最大token长度" ,
103
+ "Always pin the floating window" : " 总是固定浮动窗口"
103
104
}
Original file line number Diff line number Diff line change 99
99
"Open Conversation Window" : " 開啟獨立對話視窗" ,
100
100
"Store to Independent Conversation Page" : " 收納到獨立對話頁" ,
101
101
"Keep Conversation Window in Background" : " 保持對話窗口在後臺, 以便在任何程序中使用快捷鍵呼出" ,
102
- "Max Response Token Length" : " 響應的最大token長度"
102
+ "Max Response Token Length" : " 響應的最大token長度" ,
103
+ "Always pin the floating window" : " 總是固定浮動視窗"
103
104
}
Original file line number Diff line number Diff line change @@ -61,6 +61,13 @@ function FloatingToolbar(props) {
61
61
updatePosition ( ) // avoid jitter
62
62
}
63
63
64
+ const onDock = ( ) => {
65
+ props . container . className = 'chatgptbox-toolbar-container-not-queryable'
66
+ setCloseable ( true )
67
+ }
68
+
69
+ if ( config . alwaysPinWindow ) onDock ( )
70
+
64
71
return (
65
72
< div data-theme = { config . themeMode } >
66
73
< Draggable
@@ -83,10 +90,7 @@ function FloatingToolbar(props) {
83
90
props . container . remove ( )
84
91
} }
85
92
dockable = { props . dockable }
86
- onDock = { ( ) => {
87
- props . container . className = 'chatgptbox-toolbar-container-not-queryable'
88
- setCloseable ( true )
89
- } }
93
+ onDock = { onDock }
90
94
onUpdate = { ( ) => {
91
95
updatePosition ( )
92
96
} }
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export const defaultConfig = {
67
67
insertAtTop : isMobile ( ) ,
68
68
lockWhenAnswer : false ,
69
69
autoRegenAfterSwitchModel : false ,
70
+ alwaysPinWindow : false ,
70
71
71
72
apiKey : '' , // openai ApiKey
72
73
Original file line number Diff line number Diff line change @@ -268,6 +268,7 @@ async function prepareForRightClickMenu() {
268
268
}
269
269
270
270
async function prepareForStaticCard ( ) {
271
+ const userConfig = await getUserConfig ( )
271
272
let siteRegex
272
273
if ( userConfig . useSiteRegexOnly ) siteRegex = userConfig . siteRegex
273
274
else
@@ -296,10 +297,7 @@ async function prepareForStaticCard() {
296
297
}
297
298
}
298
299
299
- let userConfig
300
-
301
300
async function run ( ) {
302
- userConfig = await getUserConfig ( )
303
301
await getPreferredLanguageKey ( ) . then ( ( lang ) => {
304
302
changeLanguage ( lang )
305
303
} )
Original file line number Diff line number Diff line change @@ -297,6 +297,17 @@ function GeneralPart({ config, updateConfig }) {
297
297
/>
298
298
{ t ( 'Regenerate the answer after switching model' ) }
299
299
</ label >
300
+ < label >
301
+ < input
302
+ type = "checkbox"
303
+ checked = { config . alwaysPinWindow }
304
+ onChange = { ( e ) => {
305
+ const checked = e . target . checked
306
+ updateConfig ( { alwaysPinWindow : checked } )
307
+ } }
308
+ />
309
+ { t ( 'Always pin the floating window' ) }
310
+ </ label >
300
311
< br />
301
312
</ >
302
313
)
You can’t perform that action at this time.
0 commit comments