fix: issue embed option in slash command (#4938)
This commit is contained in:
parent
aa6ad4d712
commit
dbd7756163
1 changed files with 1 additions and 24 deletions
|
|
@ -1,11 +1,8 @@
|
||||||
import { LayersIcon } from "lucide-react";
|
|
||||||
import { SlashCommand } from "@/extensions";
|
import { SlashCommand } from "@/extensions";
|
||||||
// hooks
|
// hooks
|
||||||
import { TFileHandler } from "@/hooks/use-editor";
|
import { TFileHandler } from "@/hooks/use-editor";
|
||||||
// plane editor types
|
// plane editor types
|
||||||
import { TIssueEmbedConfig } from "@/plane-editor/types";
|
import { TIssueEmbedConfig } from "@/plane-editor/types";
|
||||||
// types
|
|
||||||
import { ISlashCommandItem } from "@/types";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
fileHandler: TFileHandler;
|
fileHandler: TFileHandler;
|
||||||
|
|
@ -15,27 +12,7 @@ type Props = {
|
||||||
export const DocumentEditorAdditionalExtensions = (props: Props) => {
|
export const DocumentEditorAdditionalExtensions = (props: Props) => {
|
||||||
const { fileHandler } = props;
|
const { fileHandler } = props;
|
||||||
|
|
||||||
const slashCommandAdditionalOptions: ISlashCommandItem[] = [
|
const extensions = [SlashCommand(fileHandler.upload)];
|
||||||
{
|
|
||||||
key: "issue_embed",
|
|
||||||
title: "Issue embed",
|
|
||||||
description: "Embed an issue from the project.",
|
|
||||||
searchTerms: ["issue", "link", "embed"],
|
|
||||||
icon: <LayersIcon className="h-3.5 w-3.5" />,
|
|
||||||
command: ({ editor, range }) => {
|
|
||||||
editor
|
|
||||||
.chain()
|
|
||||||
.focus()
|
|
||||||
.insertContentAt(
|
|
||||||
range,
|
|
||||||
"<p class='text-sm bg-gray-300 w-fit pl-3 pr-3 pt-1 pb-1 rounded shadow-sm'>#issue_</p>"
|
|
||||||
)
|
|
||||||
.run();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const extensions = [SlashCommand(fileHandler.upload, slashCommandAdditionalOptions)];
|
|
||||||
|
|
||||||
return extensions;
|
return extensions;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue