Skip to content

Commit c92a7b6

Browse files
committed
fix: fix reflash wranring
1 parent f9062d5 commit c92a7b6

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

editor/src/components/editor/action/command-functions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ export const CommandFunctions = Extension.create({
9292
method: "POST",
9393
body: JSON.stringify({ prompt: prompt }),
9494
})
95+
let selection = editor.state.selection;
9596

9697
await response.body?.pipeThrough(new TextDecoderStream()).pipeTo(new WritableStream({
9798
write: (chunk) => {
98-
const pos = actionExecutor.position(editor.state.selection);
99+
const pos = actionExecutor.position(selection);
99100
editor.chain().focus().insertContentAt(pos, chunk).run();
100101
}
101102
}));
102103

103-
104104
editor.setEditable(true);
105105
if (action.changeForm == ChangeForm.DIFF) {
106106
// @ts-ignore

editor/src/components/editor/live-editor.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ const LiveEditor = () => {
9494
<div className={'editor-main'}>
9595
{editor && <MenuBar editor={editor}/>}
9696
<EditorContent editor={editor}/>
97-
{editor && <MenuBubble editor={editor}/>}
97+
<div>{editor && <MenuBubble editor={editor}/>}</div>
9898

9999
{editor && <div className="character-count">
100-
<span>{Math.abs(editor.state.selection.$from.pos - editor.state.selection.$to.pos)} selected</span>
101-
&nbsp;&nbsp;
102-
<span>{editor.storage.characterCount.characters()} characters</span>
103-
&nbsp;&nbsp;
104-
<span>{editor.storage.characterCount.words()} words</span>
105-
</div>}
100+
<p className={'p2'}>{editor.storage.characterCount.characters()} characters</p>
101+
<p className={'p2'}>{editor.storage.characterCount.words()} words</p>
102+
</div>
103+
}
106104
</div>
107105
</div>
108106
{editor && <AdviceView editor={editor}/>}

0 commit comments

Comments
 (0)