SurfSense/surfsense_web/components/editor/plugins/slash-command-kit.tsx

21 lines
498 B
TypeScript
Raw Normal View History

2026-02-17 12:47:39 +05:30
"use client";
2026-02-17 12:47:39 +05:30
import { SlashInputPlugin, SlashPlugin } from "@platejs/slash-command/react";
import { KEYS } from "platejs";
2026-02-17 12:47:39 +05:30
import { SlashInputElement } from "@/components/ui/slash-node";
export const SlashCommandKit = [
2026-02-17 12:47:39 +05:30
SlashPlugin.configure({
options: {
trigger: "/",
triggerPreviousCharPattern: /^\s?$/,
triggerQuery: (editor) =>
!editor.api.some({
match: { type: editor.getType(KEYS.codeBlock) },
}),
},
}),
SlashInputPlugin.withComponent(SlashInputElement),
];