mirror of
https://github.com/docmost/docmost.git
synced 2026-05-17 06:44:05 +08:00
feat: favorites (#2103)
* feat: favorites and templates(ee) * rename migrations * fix sidebar * cleanup tabs * fix * turn off templates * cleanup * uuid validation
This commit is contained in:
@@ -11,7 +11,9 @@ import { TextStyle } from "@tiptap/extension-text-style";
|
||||
import { Color } from "@tiptap/extension-color";
|
||||
import GlobalDragHandle from "tiptap-extension-global-drag-handle";
|
||||
import { Youtube } from "@tiptap/extension-youtube";
|
||||
import SlashCommand from "@/features/editor/extensions/slash-command";
|
||||
import SlashCommand, { SlashCommandExtension as Command } from "@/features/editor/extensions/slash-command";
|
||||
import renderItems from "@/features/editor/components/slash-menu/render-items";
|
||||
import getSuggestionItems from "@/features/editor/components/slash-menu/menu-items";
|
||||
import { Collaboration, isChangeOrigin } from "@tiptap/extension-collaboration";
|
||||
import { CollaborationCaret } from "@tiptap/extension-collaboration-caret";
|
||||
import { HocuspocusProvider } from "@hocuspocus/provider";
|
||||
@@ -380,6 +382,27 @@ export const mainExtensions = [
|
||||
|
||||
type CollabExtensions = (provider: HocuspocusProvider, user: IUser) => any[];
|
||||
|
||||
const TEMPLATE_EXCLUDED_SLASH_ITEMS = new Set([
|
||||
"Image",
|
||||
"Video",
|
||||
"File attachment",
|
||||
"Draw.io (diagrams.net)",
|
||||
"Excalidraw diagram",
|
||||
]);
|
||||
|
||||
const TemplateSlashCommand = Command.configure({
|
||||
suggestion: {
|
||||
items: ({ query }: { query: string }) =>
|
||||
getSuggestionItems({ query, excludeItems: TEMPLATE_EXCLUDED_SLASH_ITEMS }),
|
||||
render: renderItems,
|
||||
},
|
||||
});
|
||||
|
||||
export const templateExtensions = [
|
||||
...mainExtensions.filter((ext: any) => ext !== SlashCommand),
|
||||
TemplateSlashCommand,
|
||||
] as any;
|
||||
|
||||
export const collabExtensions: CollabExtensions = (provider, user) => [
|
||||
Collaboration.configure({
|
||||
document: provider.document,
|
||||
|
||||
@@ -47,4 +47,5 @@ const SlashCommand = Command.configure({
|
||||
},
|
||||
});
|
||||
|
||||
export { Command as SlashCommandExtension };
|
||||
export default SlashCommand;
|
||||
|
||||
Reference in New Issue
Block a user