Skip to content

Commit d090ce5

Browse files
committed
get inputdraft from chat.tsx
1 parent 4a8b98a commit d090ce5

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ import { selectSelectedChatModel } from "../../../../redux/slices/configSlice";
2222
import { AppDispatch } from "../../../../redux/store";
2323
import { exitEdit } from "../../../../redux/thunks/edit";
2424
import { getFontSize, isJetBrains } from "../../../../util";
25-
import {
26-
getLocalStorage,
27-
setLocalStorage,
28-
} from "../../../../util/localStorage";
25+
import { setLocalStorage } from "../../../../util/localStorage";
2926
import { CodeBlock, Mention, PromptBlock, SlashCommand } from "../extensions";
3027
import { TipTapEditorProps } from "../TipTapEditor";
3128
import {
@@ -394,11 +391,7 @@ export function createEditorConfig(options: {
394391
style: `font-size: ${getFontSize()}px;`,
395392
},
396393
},
397-
content:
398-
props.editorState ??
399-
(props.isMainInput
400-
? getLocalStorage(`inputDraft_${props.historyKey}`)
401-
: undefined),
394+
content: props.editorState,
402395
editable: !isStreaming || props.isMainInput,
403396
onUpdate: ({ editor }) => {
404397
const content = editor.getJSON();

gui/src/pages/gui/Chat.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ export function Chat() {
508508
onEnter={(editorState, modifiers, editor) =>
509509
sendInput(editorState, modifiers, undefined, editor)
510510
}
511+
editorState={getLocalStorage(
512+
`inputDraft_${isInEdit ? "edit" : "chat"}`,
513+
)}
511514
inputId={MAIN_EDITOR_INPUT_ID}
512515
/>
513516

0 commit comments

Comments
 (0)