Skip to content

Commit cfadef4

Browse files
committed
small fix to aimenu
1 parent 26eeb50 commit cfadef4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/xl-ai/src/components/AIMenu/AIMenu.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export const AIMenu = (props: AIMenuProps) => {
7979

8080
useEffect(() => {
8181
// this is a bit hacky to run a useeffect to reset the prompt when the AI response is done
82-
if (aiResponseStatus === "user-reviewing" || aiResponseStatus === "error") {
82+
if (
83+
aiResponseStatus === "ai-writing" ||
84+
aiResponseStatus === "user-reviewing" ||
85+
aiResponseStatus === "error"
86+
) {
8387
setPrompt("");
8488
}
8589
}, [aiResponseStatus]);
@@ -130,7 +134,7 @@ export const AIMenu = (props: AIMenuProps) => {
130134
props.onManualPromptSubmit || onManualPromptSubmitDefault
131135
}
132136
items={items}
133-
promptText={aiResponseStatus === "user-input" ? prompt : undefined}
137+
promptText={prompt}
134138
onPromptTextChange={setPrompt}
135139
placeholder={placeholder}
136140
disabled={

packages/xl-ai/src/components/AIMenu/AIMenuController.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import {
22
BlockPopover,
33
FloatingUIOptions,
44
useBlockNoteEditor,
5+
useExtension,
6+
useExtensionState,
57
} from "@blocknote/react";
6-
import { FC, useMemo } from "react";
7-
import { useExtension, useExtensionState } from "@blocknote/react";
88
import { offset, size } from "@floating-ui/react";
9+
import { FC, useMemo } from "react";
910

1011
import { AIExtension } from "../../AIExtension.js";
1112
import { AIMenu, AIMenuProps } from "./AIMenu.js";
@@ -59,7 +60,8 @@ export const AIMenuController = (props: {
5960
enabled:
6061
aiMenuState === "closed" || aiMenuState.status === "user-input",
6162
// We should just be able to set `referencePress: true` instead of
62-
// using this listener, but for some reason it doesn't seem to trigger.
63+
// using this listener, but this doesn't seem to trigger.
64+
// (probably because we don't assign the referenceProps to the reference element)
6365
outsidePress: (event) => {
6466
if (event.target instanceof Element) {
6567
const blockElement = event.target.closest(".bn-block");

0 commit comments

Comments
 (0)