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 9999 "Open Conversation Window" : " Open Conversation Window" ,
100100 "Store to Independent Conversation Page" : " Store to Independent Conversation Page" ,
101101 "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"
103104}
Original file line number Diff line number Diff line change 9999 "Open Conversation Window" : " 打开独立对话窗口" ,
100100 "Store to Independent Conversation Page" : " 收纳到独立对话页" ,
101101 "Keep Conversation Window in Background" : " 保持对话窗口在后台, 以便在任何程序中使用快捷键呼出" ,
102- "Max Response Token Length" : " 响应的最大token长度"
102+ "Max Response Token Length" : " 响应的最大token长度" ,
103+ "Always pin the floating window" : " 总是固定浮动窗口"
103104}
Original file line number Diff line number Diff line change 9999 "Open Conversation Window" : " 開啟獨立對話視窗" ,
100100 "Store to Independent Conversation Page" : " 收納到獨立對話頁" ,
101101 "Keep Conversation Window in Background" : " 保持對話窗口在後臺, 以便在任何程序中使用快捷鍵呼出" ,
102- "Max Response Token Length" : " 響應的最大token長度"
102+ "Max Response Token Length" : " 響應的最大token長度" ,
103+ "Always pin the floating window" : " 總是固定浮動視窗"
103104}
Original file line number Diff line number Diff line change @@ -61,6 +61,13 @@ function FloatingToolbar(props) {
6161 updatePosition ( ) // avoid jitter
6262 }
6363
64+ const onDock = ( ) => {
65+ props . container . className = 'chatgptbox-toolbar-container-not-queryable'
66+ setCloseable ( true )
67+ }
68+
69+ if ( config . alwaysPinWindow ) onDock ( )
70+
6471 return (
6572 < div data-theme = { config . themeMode } >
6673 < Draggable
@@ -83,10 +90,7 @@ function FloatingToolbar(props) {
8390 props . container . remove ( )
8491 } }
8592 dockable = { props . dockable }
86- onDock = { ( ) => {
87- props . container . className = 'chatgptbox-toolbar-container-not-queryable'
88- setCloseable ( true )
89- } }
93+ onDock = { onDock }
9094 onUpdate = { ( ) => {
9195 updatePosition ( )
9296 } }
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export const defaultConfig = {
6767 insertAtTop : isMobile ( ) ,
6868 lockWhenAnswer : false ,
6969 autoRegenAfterSwitchModel : false ,
70+ alwaysPinWindow : false ,
7071
7172 apiKey : '' , // openai ApiKey
7273
Original file line number Diff line number Diff line change @@ -268,6 +268,7 @@ async function prepareForRightClickMenu() {
268268}
269269
270270async function prepareForStaticCard ( ) {
271+ const userConfig = await getUserConfig ( )
271272 let siteRegex
272273 if ( userConfig . useSiteRegexOnly ) siteRegex = userConfig . siteRegex
273274 else
@@ -296,10 +297,7 @@ async function prepareForStaticCard() {
296297 }
297298}
298299
299- let userConfig
300-
301300async function run ( ) {
302- userConfig = await getUserConfig ( )
303301 await getPreferredLanguageKey ( ) . then ( ( lang ) => {
304302 changeLanguage ( lang )
305303 } )
Original file line number Diff line number Diff line change @@ -297,6 +297,17 @@ function GeneralPart({ config, updateConfig }) {
297297 />
298298 { t ( 'Regenerate the answer after switching model' ) }
299299 </ 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 >
300311 < br />
301312 </ >
302313 )
You can’t perform that action at this time.
0 commit comments