Merge pull request #4678 from continuedev/nate/edit-updates

always exit edit mode on accept/reject
This commit is contained in:
Nate Sesti 2025-03-16 12:05:54 -07:00 • committed by GitHub
commit ac373eaa7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 24 deletions

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "1.1.10",
"version": "1.1.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "1.1.10",
"version": "1.1.11",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
@ -171,7 +171,7 @@
"@babel/preset-env": "^7.24.7",
"@biomejs/biome": "1.6.4",
"@google/generative-ai": "^0.11.4",
"@types/diff": "^5.2.2",
"@types/diff": "^7.0.1",
"@types/follow-redirects": "^1.14.4",
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.29",

View file

@ -283,9 +283,7 @@ async function processDiff(
});
}
if (action === "accept") {
await sidebar.webviewProtocol.request("exitEditMode", undefined);
}
await sidebar.webviewProtocol.request("exitEditMode", undefined);
}
function waitForSidebarReady(

2
gui/package-lock.json generated
View file

@ -172,7 +172,7 @@
"@babel/preset-env": "^7.24.7",
"@biomejs/biome": "1.6.4",
"@google/generative-ai": "^0.11.4",
"@types/diff": "^5.2.2",
"@types/diff": "^7.0.1",
"@types/follow-redirects": "^1.14.4",
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.29",

View file

@ -204,17 +204,21 @@ const Layout = () => {
);
const isInEditMode = useAppSelector(selectIsInEditMode);
useWebviewListener("exitEditMode", async () => {
if (!isInEditMode) {
return;
}
dispatch(
loadLastSession({
saveCurrentSession: false,
}),
);
dispatch(exitEditMode());
});
useWebviewListener(
"exitEditMode",
async () => {
if (!isInEditMode) {
return;
}
dispatch(
loadLastSession({
saveCurrentSession: false,
}),
);
dispatch(exitEditMode());
},
[isInEditMode],
);
useEffect(() => {
const handleKeyDown = (event: any) => {

View file

@ -6,6 +6,8 @@ import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
vscButtonBackground,
vscButtonForeground,
vscForeground,
vscInputBackground,
} from "..";
@ -46,14 +48,15 @@ const StyledDiv = styled.div<{ isHidden?: boolean }>`
}
`;
const EnterButton = styled.button`
const EnterButton = styled.button<{ isPrimary?: boolean }>`
all: unset;
padding: 2px 4px;
display: flex;
align-items: center;
background-color: ${lightGray}33;
background-color: ${(props) =>
props.isPrimary ? vscButtonBackground : lightGray + "33"};
border-radius: ${defaultBorderRadius};
color: ${vscForeground};
color: ${(props) => (props.isPrimary ? vscButtonForeground : vscForeground)};
cursor: pointer;
:disabled {
@ -79,6 +82,7 @@ interface InputToolbarProps {
activeKey: string | null;
toolbarOptions?: ToolbarOptions;
disabled?: boolean;
isMainInput?: boolean;
}
function InputToolbar(props: InputToolbarProps) {
@ -207,6 +211,7 @@ function InputToolbar(props: InputToolbarProps) {
)}
<EnterButton
isPrimary={props.isMainInput}
data-testid="submit-input-button"
onClick={async (e) => {
if (props.onEnter) {

View file

@ -424,7 +424,8 @@ function TipTapEditor(props: TipTapEditorProps) {
},
Escape: () => {
if (inDropdownRef.current || !isInEditModeRef.current) {
return false;
ideMessenger.post("focusEditor", undefined);
return true;
}
(async () => {
await dispatch(
@ -988,6 +989,7 @@ function TipTapEditor(props: TipTapEditorProps) {
}}
/>
<InputToolbar
isMainInput={props.isMainInput}
toolbarOptions={props.toolbarOptions}
activeKey={activeKey}
hidden={shouldHideToolbar && !props.isMainInput}

View file

@ -85,7 +85,7 @@ const StyledMarkdown = styled.div<{
code:not(pre > code) {
font-family: var(--vscode-editor-font-family);
color: #f78383;
color: var(--vscode-input-placeholderForeground);
}
background-color: ${(props) => props.bgColor};

View file

@ -44,7 +44,12 @@ function SymbolLink({ symbol, content }: SymbolLinkProps) {
data-tooltip-id={id}
data-tooltip-delay-show={500}
>
<code className="align-middle underline underline-offset-2">
<code
className="align-middle"
style={{
color: "var(--vscode-textLink-foreground)",
}}
>
{content}
</code>
</span>