| 1 | "use client"; |
| 2 | |
| 3 | import { TrailingBlockPlugin, type Value } from "platejs"; |
| 4 | import { type TPlateEditor } from "platejs/react"; |
| 5 | |
| 6 | import { AntvInfographicPluginNotes } from "@/components/notebook/notes/editor/plugins/antv-infographic-plugin-notes"; |
| 7 | import { AIKit } from "@/components/plate/plugins/ai-kit"; |
| 8 | import { AlignKit } from "@/components/plate/plugins/align-kit"; |
| 9 | import { AutoformatKit } from "@/components/plate/plugins/autoformat-kit"; |
| 10 | import { BasicBlocksKit } from "@/components/plate/plugins/basic-blocks-kit"; |
| 11 | import { BasicMarksKit } from "@/components/plate/plugins/basic-marks-kit"; |
| 12 | import { BlockMenuKit } from "@/components/plate/plugins/block-menu-kit"; |
| 13 | import { BlockPlaceholderKit } from "@/components/plate/plugins/block-placeholder-kit"; |
| 14 | import { CalloutKit } from "@/components/plate/plugins/callout-kit"; |
| 15 | import { CodeBlockKit } from "@/components/plate/plugins/code-block-kit"; |
| 16 | import { ColumnKit } from "@/components/plate/plugins/column-kit"; |
| 17 | import { CommentKit } from "@/components/plate/plugins/comment-kit"; |
| 18 | // import { CopilotKit } from "@/components/plate/plugins/copilot-kit"; |
| 19 | import { CursorOverlayKit } from "@/components/plate/plugins/cursor-overlay-kit"; |
| 20 | import { DateKit } from "@/components/plate/plugins/date-kit"; |
| 21 | import { DiscussionKit } from "@/components/plate/plugins/discussion-kit"; |
| 22 | import { DndKit } from "@/components/plate/plugins/dnd-kit"; |
| 23 | import { DocFixedToolbarKit } from "@/components/plate/plugins/doc-fixed-toolbar-kit"; |
| 24 | import { DocxKit } from "@/components/plate/plugins/docx-kit"; |
| 25 | import { EmojiKit } from "@/components/plate/plugins/emoji-kit"; |
| 26 | import { ExitBreakKit } from "@/components/plate/plugins/exit-break-kit"; |
| 27 | import { FixedToolbarKit } from "@/components/plate/plugins/fixed-toolbar-kit"; |
| 28 | import { FloatingToolbarKit } from "@/components/plate/plugins/floating-toolbar-kit"; |
| 29 | import { FontKit } from "@/components/plate/plugins/font-kit"; |
| 30 | import { LineHeightKit } from "@/components/plate/plugins/line-height-kit"; |
| 31 | import { LinkKit } from "@/components/plate/plugins/link-kit"; |
| 32 | import { ListKit } from "@/components/plate/plugins/list-kit"; |
| 33 | import { MarkdownKit } from "@/components/plate/plugins/markdown-kit"; |
| 34 | import { MathKit } from "@/components/plate/plugins/math-kit"; |
| 35 | import { MediaKit } from "@/components/plate/plugins/media-kit"; |
| 36 | import { MentionKit } from "@/components/plate/plugins/mention-kit"; |
| 37 | import { NoteBasicBlocksKit } from "@/components/plate/plugins/note-basic-blocks-kit"; |
| 38 | import { NoteBlockPlaceholderKit } from "@/components/plate/plugins/note-block-placeholder-kit"; |
| 39 | import { SlashKit } from "@/components/plate/plugins/slash-kit"; |
| 40 | import { SuggestionKit } from "@/components/plate/plugins/suggestion-kit"; |
| 41 | import { TableKit } from "@/components/plate/plugins/table-kit"; |
| 42 | import { TocKit } from "@/components/plate/plugins/toc-kit"; |
| 43 | import { ToggleKit } from "@/components/plate/plugins/toggle-kit"; |
| 44 | |
| 45 | export const EditorKit = [ |
| 46 | // ...CopilotKit, |
| 47 | ...AIKit, |
| 48 | |
| 49 | // Elements |
| 50 | ...BasicBlocksKit, |
| 51 | ...CodeBlockKit, |
| 52 | ...TableKit, |
| 53 | ...ToggleKit, |
| 54 | ...TocKit, |
| 55 | ...MediaKit, |
| 56 | ...CalloutKit, |
| 57 | ...ColumnKit, |
| 58 | ...MathKit, |
| 59 | ...DateKit, |
| 60 | ...LinkKit, |
| 61 | ...MentionKit, |
| 62 | |
| 63 | // Marks |
| 64 | ...BasicMarksKit, |
| 65 | ...FontKit, |
| 66 | |
| 67 | // Block Style |
| 68 | ...ListKit, |
| 69 | ...AlignKit, |
| 70 | ...LineHeightKit, |
| 71 | |
| 72 | // Collaboration |
| 73 | ...DiscussionKit, |
| 74 | ...CommentKit, |
| 75 | ...SuggestionKit, |
| 76 | |
| 77 | // Editing |
| 78 | ...SlashKit, |
| 79 | ...AutoformatKit, |
| 80 | ...CursorOverlayKit, |
| 81 | ...BlockMenuKit, |
| 82 | ...DndKit, |
| 83 | ...EmojiKit, |
| 84 | ...ExitBreakKit, |
| 85 | TrailingBlockPlugin, |
| 86 | |
| 87 | // Parsers |
| 88 | ...DocxKit, |
| 89 | ...MarkdownKit, |
| 90 | |
| 91 | // UI |
| 92 | ...BlockPlaceholderKit, |
| 93 | ...FixedToolbarKit, |
| 94 | ...FloatingToolbarKit, |
| 95 | |
| 96 | // AntV Infographic |
| 97 | ...AntvInfographicPluginNotes, |
| 98 | ]; |
| 99 | |
| 100 | /** |
| 101 | * NoteEditorKit: Notion-style notes editor. |
| 102 | * No fixed toolbar — editing via floating toolbar only. |
| 103 | */ |
| 104 | export const NoteEditorKit = [ |
| 105 | // ...CopilotKit, |
| 106 | ...AIKit, |
| 107 | |
| 108 | // Elements |
| 109 | ...NoteBasicBlocksKit, |
| 110 | ...CodeBlockKit, |
| 111 | ...TableKit, |
| 112 | ...ToggleKit, |
| 113 | ...TocKit, |
| 114 | ...MediaKit, |
| 115 | ...CalloutKit, |
| 116 | ...ColumnKit, |
| 117 | ...MathKit, |
| 118 | ...DateKit, |
| 119 | ...LinkKit, |
| 120 | ...MentionKit, |
| 121 | |
| 122 | // Marks |
| 123 | ...BasicMarksKit, |
| 124 | ...FontKit, |
| 125 | |
| 126 | // Block Style |
| 127 | ...ListKit, |
| 128 | ...AlignKit, |
| 129 | ...LineHeightKit, |
| 130 | |
| 131 | // Collaboration |
| 132 | ...DiscussionKit, |
| 133 | ...CommentKit, |
| 134 | ...SuggestionKit, |
| 135 | |
| 136 | // Editing |
| 137 | ...SlashKit, |
| 138 | ...AutoformatKit, |
| 139 | ...CursorOverlayKit, |
| 140 | ...BlockMenuKit, |
| 141 | ...DndKit, |
| 142 | ...EmojiKit, |
| 143 | ...ExitBreakKit, |
| 144 | TrailingBlockPlugin, |
| 145 | |
| 146 | // Parsers |
| 147 | ...DocxKit, |
| 148 | ...MarkdownKit, |
| 149 | |
| 150 | // UI — floating toolbar only, no fixed toolbar |
| 151 | ...NoteBlockPlaceholderKit, |
| 152 | ...FloatingToolbarKit, |
| 153 | |
| 154 | // AntV Infographic |
| 155 | ...AntvInfographicPluginNotes, |
| 156 | ]; |
| 157 | |
| 158 | /** |
| 159 | * DocEditorKit: Google Docs-style doc editor. |
| 160 | * Uses the grouped DocFixedToolbar and also keeps floating toolbar |
| 161 | * for inline selection-based formatting. |
| 162 | */ |
| 163 | export const DocEditorKit = [ |
| 164 | // ...CopilotKit, |
| 165 | ...AIKit, |
| 166 | |
| 167 | // Elements |
| 168 | ...BasicBlocksKit, |
| 169 | ...CodeBlockKit, |
| 170 | ...TableKit, |
| 171 | ...ToggleKit, |
| 172 | ...TocKit, |
| 173 | ...MediaKit, |
| 174 | ...CalloutKit, |
| 175 | ...ColumnKit, |
| 176 | ...MathKit, |
| 177 | ...DateKit, |
| 178 | ...LinkKit, |
| 179 | ...MentionKit, |
| 180 | |
| 181 | // Marks |
| 182 | ...BasicMarksKit, |
| 183 | ...FontKit, |
| 184 | |
| 185 | // Block Style |
| 186 | ...ListKit, |
| 187 | ...AlignKit, |
| 188 | ...LineHeightKit, |
| 189 | |
| 190 | // Collaboration |
| 191 | ...DiscussionKit, |
| 192 | ...CommentKit, |
| 193 | ...SuggestionKit, |
| 194 | |
| 195 | // Editing |
| 196 | ...SlashKit, |
| 197 | ...AutoformatKit, |
| 198 | ...CursorOverlayKit, |
| 199 | ...BlockMenuKit, |
| 200 | ...DndKit, |
| 201 | ...EmojiKit, |
| 202 | ...ExitBreakKit, |
| 203 | TrailingBlockPlugin, |
| 204 | |
| 205 | // Parsers |
| 206 | ...DocxKit, |
| 207 | ...MarkdownKit, |
| 208 | |
| 209 | // UI — doc-style grouped fixed toolbar + floating toolbar |
| 210 | ...BlockPlaceholderKit, |
| 211 | ...DocFixedToolbarKit, |
| 212 | ...FloatingToolbarKit, |
| 213 | |
| 214 | // AntV Infographic |
| 215 | ...AntvInfographicPluginNotes, |
| 216 | ]; |
| 217 | |
| 218 | export const DocSidebarEditorKit = [ |
| 219 | // ...CopilotKit, |
| 220 | ...AIKit, |
| 221 | |
| 222 | // Elements |
| 223 | ...BasicBlocksKit, |
| 224 | ...CodeBlockKit, |
| 225 | ...TableKit, |
| 226 | ...ToggleKit, |
| 227 | ...TocKit, |
| 228 | ...MediaKit, |
| 229 | ...CalloutKit, |
| 230 | ...ColumnKit, |
| 231 | ...MathKit, |
| 232 | ...DateKit, |
| 233 | ...LinkKit, |
| 234 | ...MentionKit, |
| 235 | |
| 236 | // Marks |
| 237 | ...BasicMarksKit, |
| 238 | ...FontKit, |
| 239 | |
| 240 | // Block Style |
| 241 | ...ListKit, |
| 242 | ...AlignKit, |
| 243 | ...LineHeightKit, |
| 244 | |
| 245 | // Collaboration |
| 246 | ...DiscussionKit, |
| 247 | ...CommentKit, |
| 248 | ...SuggestionKit, |
| 249 | |
| 250 | // Editing |
| 251 | ...SlashKit, |
| 252 | ...AutoformatKit, |
| 253 | ...CursorOverlayKit, |
| 254 | ...BlockMenuKit, |
| 255 | ...DndKit, |
| 256 | ...EmojiKit, |
| 257 | ...ExitBreakKit, |
| 258 | TrailingBlockPlugin, |
| 259 | |
| 260 | // Parsers |
| 261 | ...DocxKit, |
| 262 | ...MarkdownKit, |
| 263 | |
| 264 | // UI - doc surface without the fixed toolbar, for embedded editing. |
| 265 | ...BlockPlaceholderKit, |
| 266 | ...FloatingToolbarKit, |
| 267 | |
| 268 | // AntV Infographic |
| 269 | ...AntvInfographicPluginNotes, |
| 270 | ]; |
| 271 | |
| 272 | export type MyEditor = TPlateEditor<Value, (typeof EditorKit)[number]>; |
| 273 |