Skip to content

Commit 51ae1fa

Browse files
committed
Bump version to 1.71.0 and disable keyboard shortcuts when editing presets or previewing responses
1 parent d324813 commit 51ae1fa

7 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎packages/browser/src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Code Web Chat Connector",
55
"short_name": "CWC",
66
"description": "Connect your editor with free chatbots. Parse websites for context.",
7-
"version": "1.70.0",
7+
"version": "1.71.0",
88
"homepage_url": "https://github.com/robertpiosik/CodeWebChat",
99
"icons": {
1010
"16": "icons/icon-16.png",

‎packages/ui/src/components/editor/panel/Page/Page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Page: React.FC<Props> = (props) => {
2222
return () => {
2323
window.removeEventListener('mouseup', handle_mouse_up)
2424
}
25-
}, [props.on_back_click])
25+
}, [])
2626

2727
return (
2828
<div className={styles.container}>

‎packages/vscode/src/views/panel/frontend/Main/Main.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Props = {
5151
configurations_collapsed: boolean
5252
on_configurations_collapsed_change: (is_collapsed: boolean) => void
5353
currently_open_file_text?: string
54+
are_keyboard_shortcuts_disabled: boolean
5455
}
5556

5657
export const Main: React.FC<Props> = (props) => {
@@ -734,6 +735,7 @@ export const Main: React.FC<Props> = (props) => {
734735
}
735736
on_go_to_file={handle_go_to_file}
736737
currently_open_file_text={props.currently_open_file_text}
738+
are_keyboard_shortcuts_disabled={props.are_keyboard_shortcuts_disabled}
737739
/>
738740
)
739741
}

‎packages/vscode/src/views/panel/frontend/Main/MainView/MainView.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type Props = {
9191
on_configurations_collapsed_change: (is_collapsed: boolean) => void
9292
currently_open_file_text?: string
9393
on_go_to_file: (file_path: string) => void
94+
are_keyboard_shortcuts_disabled: boolean
9495
}
9596

9697
export const MainView: React.FC<Props> = (props) => {
@@ -152,6 +153,7 @@ export const MainView: React.FC<Props> = (props) => {
152153
api_prompt_type={props.api_prompt_type}
153154
on_api_prompt_type_change={props.on_api_prompt_type_change}
154155
on_quick_action_click={props.on_quick_action_click}
156+
are_keyboard_shortcuts_disabled={props.are_keyboard_shortcuts_disabled}
155157
/>
156158
<Scrollable>
157159
<UiSeparator height={4} />

‎packages/vscode/src/views/panel/frontend/Main/MainView/components/Header/Header.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Props = {
1919
on_web_prompt_type_change: (mode: WebPromptType) => void
2020
on_api_prompt_type_change: (mode: ApiPromptType) => void
2121
on_quick_action_click: (command: string) => void
22+
are_keyboard_shortcuts_disabled: boolean
2223
}
2324

2425
export const Header: React.FC<Props> = (props) => {
@@ -42,7 +43,8 @@ export const Header: React.FC<Props> = (props) => {
4243
handle_heading_click,
4344
on_web_prompt_type_change: props.on_web_prompt_type_change,
4445
on_api_prompt_type_change: props.on_api_prompt_type_change,
45-
on_show_home: props.on_show_home
46+
on_show_home: props.on_show_home,
47+
is_disabled: props.are_keyboard_shortcuts_disabled
4648
})
4749

4850
return (

‎packages/vscode/src/views/panel/frontend/Main/MainView/components/Header/hooks/use-keyboard-shortcuts.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,23 @@ type UseKeyboardShortcutsParams = {
1010
on_web_prompt_type_change: (mode: WebPromptType) => void
1111
on_api_prompt_type_change: (mode: ApiPromptType) => void
1212
on_show_home: () => void
13+
is_disabled: boolean
1314
}
1415

1516
export const use_keyboard_shortcuts = ({
1617
mode,
1718
handle_heading_click,
1819
on_web_prompt_type_change,
1920
on_api_prompt_type_change,
20-
on_show_home
21+
on_show_home,
22+
is_disabled
2123
}: UseKeyboardShortcutsParams) => {
2224
const is_mac = use_is_mac()
2325

2426
useEffect(() => {
2527
const handle_key_down = (event: KeyboardEvent) => {
28+
if (is_disabled) return
29+
2630
if (
2731
event.key == 'Escape' &&
2832
!event.metaKey &&
@@ -41,6 +45,8 @@ export const use_keyboard_shortcuts = ({
4145
}
4246

4347
const handle_mouse_up = (event: MouseEvent) => {
48+
if (is_disabled) return
49+
4450
if (event.button == 3) {
4551
on_show_home()
4652
}
@@ -53,10 +59,12 @@ export const use_keyboard_shortcuts = ({
5359
window.removeEventListener('keydown', handle_key_down)
5460
window.removeEventListener('mouseup', handle_mouse_up)
5561
}
56-
}, [is_mac, handle_heading_click, on_show_home])
62+
}, [is_disabled, on_show_home, is_mac, handle_heading_click])
5763

5864
useEffect(() => {
5965
const handle_key_down = (event: KeyboardEvent) => {
66+
if (is_disabled) return
67+
6068
if (!event.altKey || !event.shiftKey || event.metaKey || event.ctrlKey) {
6169
return
6270
}
@@ -91,5 +99,5 @@ export const use_keyboard_shortcuts = ({
9199
return () => {
92100
window.removeEventListener('keydown', handle_key_down)
93101
}
94-
}, [mode, on_web_prompt_type_change, on_api_prompt_type_change])
102+
}, [mode, on_web_prompt_type_change, on_api_prompt_type_change, is_disabled])
95103
}

‎packages/vscode/src/views/panel/frontend/Panel.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ export const Panel = () => {
191191
commit_button_enabling_trigger_count
192192
}
193193

194+
const are_keyboard_shortcuts_disabled = !!updating_preset || !!items_to_review
195+
194196
return (
195197
<LayoutContext.Provider value={layout_context_value}>
196198
<div className={styles.container}>
@@ -203,6 +205,9 @@ export const Panel = () => {
203205
>
204206
<Main
205207
scroll_reset_key={main_view_scroll_reset_key}
208+
are_keyboard_shortcuts_disabled={
209+
are_keyboard_shortcuts_disabled
210+
}
206211
vscode={vscode}
207212
on_preset_edit={(preset) => {
208213
post_message(vscode, {

0 commit comments

Comments
 (0)