mirror of
https://github.com/docmost/docmost.git
synced 2026-08-30 18:36:26 +08:00
- Add insert below and copy option
This commit is contained in:
@@ -128,7 +128,7 @@ const EditorAiMenu = ({ editor }: EditorAiMenuProps): JSX.Element | null => {
|
|||||||
if (item.id === "back") {
|
if (item.id === "back") {
|
||||||
return setActiveCommandSet("main");
|
return setActiveCommandSet("main");
|
||||||
}
|
}
|
||||||
if (item.id === "result-insert") {
|
if (item.id === "result-replace") {
|
||||||
const chain = editor.chain().focus();
|
const chain = editor.chain().focus();
|
||||||
|
|
||||||
if (lastAction.action === AiAction.CONTINUE_WRITING) {
|
if (lastAction.action === AiAction.CONTINUE_WRITING) {
|
||||||
@@ -139,6 +139,21 @@ const EditorAiMenu = ({ editor }: EditorAiMenuProps): JSX.Element | null => {
|
|||||||
|
|
||||||
return setShowAiMenu(false);
|
return setShowAiMenu(false);
|
||||||
}
|
}
|
||||||
|
if (item.id === "result-insert-below") {
|
||||||
|
editor
|
||||||
|
.chain()
|
||||||
|
.focus()
|
||||||
|
.setTextSelection(editor.state.selection.to)
|
||||||
|
.insertContent(marked.parse(output))
|
||||||
|
.run();
|
||||||
|
|
||||||
|
return setShowAiMenu(false);
|
||||||
|
}
|
||||||
|
if (item.id === "result-copy") {
|
||||||
|
navigator.clipboard.writeText(output);
|
||||||
|
|
||||||
|
return setShowAiMenu(false);
|
||||||
|
}
|
||||||
if (item.id === "result-discard") {
|
if (item.id === "result-discard") {
|
||||||
setOutput("");
|
setOutput("");
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { AiAction } from "@/ee/ai/types/ai.types";
|
import { AiAction } from "@/ee/ai/types/ai.types";
|
||||||
import {
|
import {
|
||||||
IconSparkles,
|
IconSparkles,
|
||||||
IconCheck,
|
|
||||||
IconArrowsMaximize,
|
IconArrowsMaximize,
|
||||||
IconArrowsMinimize,
|
IconArrowsMinimize,
|
||||||
IconWriting,
|
IconWriting,
|
||||||
@@ -12,6 +11,9 @@ import {
|
|||||||
IconTrash,
|
IconTrash,
|
||||||
IconRefresh,
|
IconRefresh,
|
||||||
IconChevronLeft,
|
IconChevronLeft,
|
||||||
|
IconCheck,
|
||||||
|
IconArrowDownLeft,
|
||||||
|
IconCopy,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
|
|
||||||
interface CommandItem {
|
interface CommandItem {
|
||||||
@@ -139,7 +141,9 @@ const translateItems: CommandItem[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
const resultItems: CommandItem[] = [
|
const resultItems: CommandItem[] = [
|
||||||
{ id: "result-insert", name: "Insert", icon: IconCheck },
|
{ id: "result-replace", name: "Replace", icon: IconCheck },
|
||||||
|
{ id: "result-insert-below", name: "Insert below", icon: IconArrowDownLeft },
|
||||||
|
{ id: "result-copy", name: "Copy", icon: IconCopy },
|
||||||
{ id: "result-discard", name: "Discard", icon: IconTrash },
|
{ id: "result-discard", name: "Discard", icon: IconTrash },
|
||||||
{
|
{
|
||||||
id: "result-try-again",
|
id: "result-try-again",
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: 6d3eb76d4e...3a4b47ec30
Reference in New Issue
Block a user