mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 05:49:40 +02:00
Merge pull request #1859 from makeplane/fix/slash-commands
fix: slash commands additional options
This commit is contained in:
@@ -3,13 +3,13 @@ import { Extensions } from "@tiptap/core";
|
||||
// ui
|
||||
import { LayersIcon } from "@plane/ui";
|
||||
// extensions
|
||||
import { SlashCommands } from "@/extensions";
|
||||
import { SlashCommands, TSlashCommandAdditionalOption } from "@/extensions";
|
||||
// plane editor extensions
|
||||
import { IssueEmbedSuggestions, IssueListRenderer } from "@/plane-editor/extensions";
|
||||
// plane editor types
|
||||
import { TIssueEmbedConfig } from "@/plane-editor/types";
|
||||
// types
|
||||
import { ISlashCommandItem, TExtensions, TUserDetails } from "@/types";
|
||||
import { TExtensions, TUserDetails } from "@/types";
|
||||
// local extensions
|
||||
import { CustomCollaborationCursor } from "./collaboration-cursor";
|
||||
|
||||
@@ -27,25 +27,30 @@ export const DocumentEditorAdditionalExtensions = (props: Props) => {
|
||||
const isCollaborationCursorDisabled = !!disabledExtensions?.includes("collaboration-cursor");
|
||||
|
||||
const extensions: Extensions = [];
|
||||
const additionalSlashCommandOptions: TSlashCommandAdditionalOption[] = [];
|
||||
|
||||
if (!isIssueEmbedDisabled) {
|
||||
const slashCommandAdditionalOptions: ISlashCommandItem[] = [
|
||||
{
|
||||
commandKey: "issue-embed",
|
||||
key: "issue-embed",
|
||||
title: "Issue embed",
|
||||
description: "Embed an issue from the project.",
|
||||
searchTerms: ["issue", "link", "embed"],
|
||||
icon: <LayersIcon className="size-3.5" />,
|
||||
command: ({ editor, range }) => {
|
||||
editor.chain().focus().insertContentAt(range, "<p>#issue_</p>").run();
|
||||
},
|
||||
const issueEmbedOption: TSlashCommandAdditionalOption = {
|
||||
commandKey: "issue-embed",
|
||||
key: "issue-embed",
|
||||
title: "Issue embed",
|
||||
description: "Embed an issue from the project.",
|
||||
searchTerms: ["issue", "link", "embed"],
|
||||
icon: <LayersIcon className="size-3.5" />,
|
||||
command: ({ editor, range }) => {
|
||||
editor.chain().focus().insertContentAt(range, "<p>#issue_</p>").run();
|
||||
},
|
||||
];
|
||||
extensions.push(SlashCommands(slashCommandAdditionalOptions));
|
||||
} else {
|
||||
extensions.push(SlashCommands());
|
||||
section: "general",
|
||||
pushAfter: "callout",
|
||||
};
|
||||
additionalSlashCommandOptions.push(issueEmbedOption);
|
||||
}
|
||||
extensions.push(
|
||||
SlashCommands({
|
||||
additionalOptions: additionalSlashCommandOptions,
|
||||
disabledExtensions,
|
||||
})
|
||||
);
|
||||
|
||||
if (issueEmbedConfig && !isIssueEmbedDisabled) {
|
||||
extensions.push(
|
||||
|
||||
Reference in New Issue
Block a user