doclific 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -0
- package/dist/bin/doclific.js +36 -8
- package/package.json +11 -4
- package/readme.md +77 -0
- package/.gitattributes +0 -2
- package/.prettierignore +0 -5
- package/.prettierrc +0 -9
- package/.vscode/settings.json +0 -13
- package/frontend/components.json +0 -24
- package/frontend/eslint.config.js +0 -23
- package/frontend/index.html +0 -25
- package/frontend/package-lock.json +0 -15754
- package/frontend/public/logo.svg +0 -1
- package/frontend/src/App.tsx +0 -21
- package/frontend/src/components/app-sidebar.tsx +0 -393
- package/frontend/src/components/editor/editor-base-kit.tsx +0 -43
- package/frontend/src/components/editor/editor-kit.tsx +0 -93
- package/frontend/src/components/editor/plugins/align-base-kit.tsx +0 -16
- package/frontend/src/components/editor/plugins/align-kit.tsx +0 -18
- package/frontend/src/components/editor/plugins/autoformat-kit.tsx +0 -236
- package/frontend/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -35
- package/frontend/src/components/editor/plugins/basic-blocks-kit.tsx +0 -88
- package/frontend/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -27
- package/frontend/src/components/editor/plugins/basic-marks-kit.tsx +0 -41
- package/frontend/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/frontend/src/components/editor/plugins/block-menu-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/frontend/src/components/editor/plugins/block-selection-kit.tsx +0 -32
- package/frontend/src/components/editor/plugins/callout-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/callout-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/code-block-base-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/code-block-kit.tsx +0 -26
- package/frontend/src/components/editor/plugins/codebase-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/column-base-kit.tsx +0 -11
- package/frontend/src/components/editor/plugins/column-kit.tsx +0 -10
- package/frontend/src/components/editor/plugins/comment-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/comment-kit.tsx +0 -97
- package/frontend/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/date-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/date-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/discussion-kit.tsx +0 -148
- package/frontend/src/components/editor/plugins/dnd-kit.tsx +0 -28
- package/frontend/src/components/editor/plugins/docx-kit.tsx +0 -6
- package/frontend/src/components/editor/plugins/emoji-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/excalidraw-kit.tsx +0 -9
- package/frontend/src/components/editor/plugins/exit-break-kit.tsx +0 -12
- package/frontend/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/frontend/src/components/editor/plugins/font-base-kit.tsx +0 -20
- package/frontend/src/components/editor/plugins/font-kit.tsx +0 -29
- package/frontend/src/components/editor/plugins/indent-base-kit.tsx +0 -19
- package/frontend/src/components/editor/plugins/indent-kit.tsx +0 -22
- package/frontend/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/line-height-kit.tsx +0 -16
- package/frontend/src/components/editor/plugins/link-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/link-kit.tsx +0 -15
- package/frontend/src/components/editor/plugins/list-base-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/list-kit.tsx +0 -26
- package/frontend/src/components/editor/plugins/markdown-kit.tsx +0 -46
- package/frontend/src/components/editor/plugins/math-base-kit.tsx +0 -11
- package/frontend/src/components/editor/plugins/math-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/media-base-kit.tsx +0 -31
- package/frontend/src/components/editor/plugins/media-kit.tsx +0 -43
- package/frontend/src/components/editor/plugins/mention-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/mention-kit.tsx +0 -15
- package/frontend/src/components/editor/plugins/slash-kit.tsx +0 -18
- package/frontend/src/components/editor/plugins/suggestion-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/suggestion-kit.tsx +0 -90
- package/frontend/src/components/editor/plugins/table-base-kit.tsx +0 -20
- package/frontend/src/components/editor/plugins/table-kit.tsx +0 -22
- package/frontend/src/components/editor/plugins/toc-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/toc-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/toggle-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/toggle-kit.tsx +0 -11
- package/frontend/src/components/editor/transforms.ts +0 -194
- package/frontend/src/components/markdown-to-slate-demo.tsx +0 -50
- package/frontend/src/components/mode-toggle.tsx +0 -15
- package/frontend/src/components/theme-provider.tsx +0 -73
- package/frontend/src/components/ui/alert-dialog.tsx +0 -155
- package/frontend/src/components/ui/align-toolbar-button.tsx +0 -84
- package/frontend/src/components/ui/avatar.tsx +0 -51
- package/frontend/src/components/ui/block-context-menu.tsx +0 -199
- package/frontend/src/components/ui/block-discussion.tsx +0 -365
- package/frontend/src/components/ui/block-draggable.tsx +0 -512
- package/frontend/src/components/ui/block-list-static.tsx +0 -80
- package/frontend/src/components/ui/block-list.tsx +0 -87
- package/frontend/src/components/ui/block-selection.tsx +0 -42
- package/frontend/src/components/ui/block-suggestion.tsx +0 -473
- package/frontend/src/components/ui/blockquote-node-static.tsx +0 -11
- package/frontend/src/components/ui/blockquote-node.tsx +0 -13
- package/frontend/src/components/ui/button.tsx +0 -62
- package/frontend/src/components/ui/calendar.tsx +0 -218
- package/frontend/src/components/ui/callout-node-static.tsx +0 -36
- package/frontend/src/components/ui/callout-node.tsx +0 -63
- package/frontend/src/components/ui/caption.tsx +0 -63
- package/frontend/src/components/ui/checkbox.tsx +0 -30
- package/frontend/src/components/ui/code-block-node-static.tsx +0 -35
- package/frontend/src/components/ui/code-block-node.tsx +0 -287
- package/frontend/src/components/ui/code-node-static.tsx +0 -15
- package/frontend/src/components/ui/code-node.tsx +0 -17
- package/frontend/src/components/ui/codebase-snippet-node.tsx +0 -237
- package/frontend/src/components/ui/column-node-static.tsx +0 -29
- package/frontend/src/components/ui/column-node.tsx +0 -317
- package/frontend/src/components/ui/command.tsx +0 -182
- package/frontend/src/components/ui/comment-node-static.tsx +0 -15
- package/frontend/src/components/ui/comment-node.tsx +0 -45
- package/frontend/src/components/ui/comment-toolbar-button.tsx +0 -24
- package/frontend/src/components/ui/comment.tsx +0 -618
- package/frontend/src/components/ui/context-menu.tsx +0 -250
- package/frontend/src/components/ui/cursor-overlay.tsx +0 -66
- package/frontend/src/components/ui/date-node-static.tsx +0 -45
- package/frontend/src/components/ui/date-node.tsx +0 -93
- package/frontend/src/components/ui/dialog.tsx +0 -143
- package/frontend/src/components/ui/dropdown-menu.tsx +0 -255
- package/frontend/src/components/ui/dynamic-icon.tsx +0 -12
- package/frontend/src/components/ui/editor-static.tsx +0 -53
- package/frontend/src/components/ui/editor.tsx +0 -130
- package/frontend/src/components/ui/emoji-node.tsx +0 -69
- package/frontend/src/components/ui/emoji-toolbar-button.tsx +0 -628
- package/frontend/src/components/ui/equation-node-static.tsx +0 -98
- package/frontend/src/components/ui/equation-node.tsx +0 -235
- package/frontend/src/components/ui/equation-toolbar-button.tsx +0 -25
- package/frontend/src/components/ui/excalidraw-node.tsx +0 -36
- package/frontend/src/components/ui/export-toolbar-button.tsx +0 -174
- package/frontend/src/components/ui/file-selector.tsx +0 -339
- package/frontend/src/components/ui/floating-toolbar-buttons.tsx +0 -73
- package/frontend/src/components/ui/floating-toolbar.tsx +0 -85
- package/frontend/src/components/ui/font-color-toolbar-button.tsx +0 -831
- package/frontend/src/components/ui/font-size-toolbar-button.tsx +0 -152
- package/frontend/src/components/ui/heading-node-static.tsx +0 -68
- package/frontend/src/components/ui/heading-node.tsx +0 -58
- package/frontend/src/components/ui/highlight-node-static.tsx +0 -11
- package/frontend/src/components/ui/highlight-node.tsx +0 -13
- package/frontend/src/components/ui/history-toolbar-button.tsx +0 -50
- package/frontend/src/components/ui/hr-node-static.tsx +0 -20
- package/frontend/src/components/ui/hr-node.tsx +0 -33
- package/frontend/src/components/ui/import-toolbar-button.tsx +0 -97
- package/frontend/src/components/ui/indent-toolbar-button.tsx +0 -30
- package/frontend/src/components/ui/inline-combobox.tsx +0 -414
- package/frontend/src/components/ui/input.tsx +0 -21
- package/frontend/src/components/ui/insert-toolbar-button.tsx +0 -254
- package/frontend/src/components/ui/kbd-node-static.tsx +0 -15
- package/frontend/src/components/ui/kbd-node.tsx +0 -17
- package/frontend/src/components/ui/layout-header.tsx +0 -35
- package/frontend/src/components/ui/line-height-toolbar-button.tsx +0 -68
- package/frontend/src/components/ui/link-node-static.tsx +0 -21
- package/frontend/src/components/ui/link-node.tsx +0 -39
- package/frontend/src/components/ui/link-toolbar-button.tsx +0 -22
- package/frontend/src/components/ui/link-toolbar.tsx +0 -206
- package/frontend/src/components/ui/list-toolbar-button.tsx +0 -204
- package/frontend/src/components/ui/mark-toolbar-button.tsx +0 -19
- package/frontend/src/components/ui/media-audio-node-static.tsx +0 -17
- package/frontend/src/components/ui/media-audio-node.tsx +0 -39
- package/frontend/src/components/ui/media-embed-node.tsx +0 -136
- package/frontend/src/components/ui/media-file-node-static.tsx +0 -29
- package/frontend/src/components/ui/media-file-node.tsx +0 -47
- package/frontend/src/components/ui/media-image-node-static.tsx +0 -39
- package/frontend/src/components/ui/media-image-node.tsx +0 -80
- package/frontend/src/components/ui/media-placeholder-node.tsx +0 -249
- package/frontend/src/components/ui/media-preview-dialog.tsx +0 -152
- package/frontend/src/components/ui/media-toolbar-button.tsx +0 -225
- package/frontend/src/components/ui/media-toolbar.tsx +0 -115
- package/frontend/src/components/ui/media-upload-toast.tsx +0 -66
- package/frontend/src/components/ui/media-video-node-static.tsx +0 -30
- package/frontend/src/components/ui/media-video-node.tsx +0 -121
- package/frontend/src/components/ui/mention-node-static.tsx +0 -36
- package/frontend/src/components/ui/mention-node.tsx +0 -194
- package/frontend/src/components/ui/mode-toolbar-button.tsx +0 -123
- package/frontend/src/components/ui/more-toolbar-button.tsx +0 -80
- package/frontend/src/components/ui/paragraph-node-static.tsx +0 -13
- package/frontend/src/components/ui/paragraph-node.tsx +0 -15
- package/frontend/src/components/ui/popover.tsx +0 -46
- package/frontend/src/components/ui/resize-handle.tsx +0 -87
- package/frontend/src/components/ui/separator.tsx +0 -28
- package/frontend/src/components/ui/sheet.tsx +0 -139
- package/frontend/src/components/ui/sidebar.tsx +0 -726
- package/frontend/src/components/ui/skeleton.tsx +0 -13
- package/frontend/src/components/ui/slash-node.tsx +0 -233
- package/frontend/src/components/ui/sonner.tsx +0 -38
- package/frontend/src/components/ui/suggestion-node-static.tsx +0 -35
- package/frontend/src/components/ui/suggestion-node.tsx +0 -162
- package/frontend/src/components/ui/suggestion-toolbar-button.tsx +0 -25
- package/frontend/src/components/ui/table-icons.tsx +0 -862
- package/frontend/src/components/ui/table-node-static.tsx +0 -98
- package/frontend/src/components/ui/table-node.tsx +0 -656
- package/frontend/src/components/ui/table-toolbar-button.tsx +0 -264
- package/frontend/src/components/ui/toc-node-static.tsx +0 -92
- package/frontend/src/components/ui/toc-node.tsx +0 -55
- package/frontend/src/components/ui/toggle-node-static.tsx +0 -18
- package/frontend/src/components/ui/toggle-node.tsx +0 -36
- package/frontend/src/components/ui/toggle-toolbar-button.tsx +0 -22
- package/frontend/src/components/ui/toolbar.tsx +0 -387
- package/frontend/src/components/ui/tooltip.tsx +0 -59
- package/frontend/src/components/ui/turn-into-toolbar-button.tsx +0 -188
- package/frontend/src/hooks/use-debounce.ts +0 -18
- package/frontend/src/hooks/use-is-touch-device.ts +0 -24
- package/frontend/src/hooks/use-mobile.ts +0 -19
- package/frontend/src/hooks/use-mounted.ts +0 -11
- package/frontend/src/hooks/use-upload-file.ts +0 -128
- package/frontend/src/index.css +0 -128
- package/frontend/src/layout.tsx +0 -42
- package/frontend/src/lib/markdown-joiner-transform.ts +0 -239
- package/frontend/src/lib/orpc.ts +0 -13
- package/frontend/src/lib/uploadthing.ts +0 -19
- package/frontend/src/lib/utils.ts +0 -6
- package/frontend/src/main.tsx +0 -13
- package/frontend/src/pages/editor.tsx +0 -44
- package/frontend/src/types/docs.d.ts +0 -6
- package/frontend/src/types/global.d.ts +0 -9
- package/frontend/src/types/router.d.ts +0 -4
- package/frontend/tsconfig.app.json +0 -33
- package/frontend/tsconfig.json +0 -10
- package/frontend/tsconfig.node.json +0 -26
- package/frontend/vite.config.ts +0 -14
- package/src/bin/doclific.ts +0 -47
- package/src/core/codebase.ts +0 -39
- package/src/core/docs.ts +0 -90
- package/src/core/git.ts +0 -48
- package/src/server/index.ts +0 -55
- package/src/server/router.ts +0 -65
- package/tsconfig.json +0 -15
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type Value, TrailingBlockPlugin } from 'platejs';
|
|
4
|
-
import { type TPlateEditor, useEditorRef } from 'platejs/react';
|
|
5
|
-
|
|
6
|
-
import { AlignKit } from './plugins/align-kit';
|
|
7
|
-
import { AutoformatKit } from './plugins/autoformat-kit';
|
|
8
|
-
import { BasicBlocksKit } from './plugins/basic-blocks-kit';
|
|
9
|
-
import { BasicMarksKit } from './plugins/basic-marks-kit';
|
|
10
|
-
import { BlockMenuKit } from './plugins/block-menu-kit';
|
|
11
|
-
import { BlockPlaceholderKit } from './plugins/block-placeholder-kit';
|
|
12
|
-
import { CalloutKit } from './plugins/callout-kit';
|
|
13
|
-
import { CodeBlockKit } from './plugins/code-block-kit';
|
|
14
|
-
import { ColumnKit } from './plugins/column-kit';
|
|
15
|
-
import { CommentKit } from './plugins/comment-kit';
|
|
16
|
-
import { CursorOverlayKit } from './plugins/cursor-overlay-kit';
|
|
17
|
-
import { DateKit } from './plugins/date-kit';
|
|
18
|
-
import { DiscussionKit } from './plugins/discussion-kit';
|
|
19
|
-
import { DndKit } from './plugins/dnd-kit';
|
|
20
|
-
import { DocxKit } from './plugins/docx-kit';
|
|
21
|
-
import { EmojiKit } from './plugins/emoji-kit';
|
|
22
|
-
import { ExitBreakKit } from './plugins/exit-break-kit';
|
|
23
|
-
import { FloatingToolbarKit } from './plugins/floating-toolbar-kit';
|
|
24
|
-
import { FontKit } from './plugins/font-kit';
|
|
25
|
-
import { LineHeightKit } from './plugins/line-height-kit';
|
|
26
|
-
import { LinkKit } from './plugins/link-kit';
|
|
27
|
-
import { ListKit } from './plugins/list-kit';
|
|
28
|
-
import { MarkdownKit } from './plugins/markdown-kit';
|
|
29
|
-
import { MathKit } from './plugins/math-kit';
|
|
30
|
-
import { MediaKit } from './plugins/media-kit';
|
|
31
|
-
import { MentionKit } from './plugins/mention-kit';
|
|
32
|
-
import { SlashKit } from './plugins/slash-kit';
|
|
33
|
-
import { SuggestionKit } from './plugins/suggestion-kit';
|
|
34
|
-
import { TableKit } from './plugins/table-kit';
|
|
35
|
-
import { TocKit } from './plugins/toc-kit';
|
|
36
|
-
import { ToggleKit } from './plugins/toggle-kit';
|
|
37
|
-
import { CodebaseSnippetPlugin } from './plugins/codebase-kit';
|
|
38
|
-
|
|
39
|
-
export const EditorKit = [
|
|
40
|
-
...BlockMenuKit,
|
|
41
|
-
|
|
42
|
-
// Elements
|
|
43
|
-
...BasicBlocksKit,
|
|
44
|
-
...CodeBlockKit,
|
|
45
|
-
...TableKit,
|
|
46
|
-
...ToggleKit,
|
|
47
|
-
...TocKit,
|
|
48
|
-
...MediaKit,
|
|
49
|
-
...CalloutKit,
|
|
50
|
-
...ColumnKit,
|
|
51
|
-
...MathKit,
|
|
52
|
-
...DateKit,
|
|
53
|
-
...LinkKit,
|
|
54
|
-
...MentionKit,
|
|
55
|
-
|
|
56
|
-
// Marks
|
|
57
|
-
...BasicMarksKit,
|
|
58
|
-
...FontKit,
|
|
59
|
-
|
|
60
|
-
// Block Style
|
|
61
|
-
...ListKit,
|
|
62
|
-
...AlignKit,
|
|
63
|
-
...LineHeightKit,
|
|
64
|
-
|
|
65
|
-
// Collaboration
|
|
66
|
-
...DiscussionKit,
|
|
67
|
-
...CommentKit,
|
|
68
|
-
...SuggestionKit,
|
|
69
|
-
|
|
70
|
-
// Editing
|
|
71
|
-
...SlashKit,
|
|
72
|
-
...AutoformatKit,
|
|
73
|
-
...CursorOverlayKit,
|
|
74
|
-
...DndKit,
|
|
75
|
-
...EmojiKit,
|
|
76
|
-
...ExitBreakKit,
|
|
77
|
-
TrailingBlockPlugin,
|
|
78
|
-
|
|
79
|
-
// Parsers
|
|
80
|
-
...DocxKit,
|
|
81
|
-
...MarkdownKit,
|
|
82
|
-
|
|
83
|
-
// UI
|
|
84
|
-
...BlockPlaceholderKit,
|
|
85
|
-
...FloatingToolbarKit,
|
|
86
|
-
|
|
87
|
-
// Custom
|
|
88
|
-
CodebaseSnippetPlugin,
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
export type MyEditor = TPlateEditor<Value, (typeof EditorKit)[number]>;
|
|
92
|
-
|
|
93
|
-
export const useEditor = () => useEditorRef<MyEditor>();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseTextAlignPlugin } from '@platejs/basic-styles';
|
|
2
|
-
import { KEYS } from 'platejs';
|
|
3
|
-
|
|
4
|
-
export const BaseAlignKit = [
|
|
5
|
-
BaseTextAlignPlugin.configure({
|
|
6
|
-
inject: {
|
|
7
|
-
nodeProps: {
|
|
8
|
-
defaultNodeValue: 'start',
|
|
9
|
-
nodeKey: 'align',
|
|
10
|
-
styleKey: 'textAlign',
|
|
11
|
-
validNodeValues: ['start', 'left', 'center', 'right', 'end', 'justify'],
|
|
12
|
-
},
|
|
13
|
-
targetPlugins: [...KEYS.heading, KEYS.p, KEYS.img, KEYS.mediaEmbed],
|
|
14
|
-
},
|
|
15
|
-
}),
|
|
16
|
-
];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { TextAlignPlugin } from '@platejs/basic-styles/react';
|
|
4
|
-
import { KEYS } from 'platejs';
|
|
5
|
-
|
|
6
|
-
export const AlignKit = [
|
|
7
|
-
TextAlignPlugin.configure({
|
|
8
|
-
inject: {
|
|
9
|
-
nodeProps: {
|
|
10
|
-
defaultNodeValue: 'start',
|
|
11
|
-
nodeKey: 'align',
|
|
12
|
-
styleKey: 'textAlign',
|
|
13
|
-
validNodeValues: ['start', 'left', 'center', 'right', 'end', 'justify'],
|
|
14
|
-
},
|
|
15
|
-
targetPlugins: [...KEYS.heading, KEYS.p, KEYS.img, KEYS.mediaEmbed],
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
];
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import type { AutoformatRule } from '@platejs/autoformat';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
autoformatArrow,
|
|
7
|
-
autoformatLegal,
|
|
8
|
-
autoformatLegalHtml,
|
|
9
|
-
autoformatMath,
|
|
10
|
-
AutoformatPlugin,
|
|
11
|
-
autoformatPunctuation,
|
|
12
|
-
autoformatSmartQuotes,
|
|
13
|
-
} from '@platejs/autoformat';
|
|
14
|
-
import { insertEmptyCodeBlock } from '@platejs/code-block';
|
|
15
|
-
import { toggleList } from '@platejs/list';
|
|
16
|
-
import { KEYS } from 'platejs';
|
|
17
|
-
|
|
18
|
-
const autoformatMarks: AutoformatRule[] = [
|
|
19
|
-
{
|
|
20
|
-
match: '***',
|
|
21
|
-
mode: 'mark',
|
|
22
|
-
type: [KEYS.bold, KEYS.italic],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
match: '__*',
|
|
26
|
-
mode: 'mark',
|
|
27
|
-
type: [KEYS.underline, KEYS.italic],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
match: '__**',
|
|
31
|
-
mode: 'mark',
|
|
32
|
-
type: [KEYS.underline, KEYS.bold],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
match: '___***',
|
|
36
|
-
mode: 'mark',
|
|
37
|
-
type: [KEYS.underline, KEYS.bold, KEYS.italic],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
match: '**',
|
|
41
|
-
mode: 'mark',
|
|
42
|
-
type: KEYS.bold,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
match: '__',
|
|
46
|
-
mode: 'mark',
|
|
47
|
-
type: KEYS.underline,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
match: '*',
|
|
51
|
-
mode: 'mark',
|
|
52
|
-
type: KEYS.italic,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
match: '_',
|
|
56
|
-
mode: 'mark',
|
|
57
|
-
type: KEYS.italic,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
match: '~~',
|
|
61
|
-
mode: 'mark',
|
|
62
|
-
type: KEYS.strikethrough,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
match: '^',
|
|
66
|
-
mode: 'mark',
|
|
67
|
-
type: KEYS.sup,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
match: '~',
|
|
71
|
-
mode: 'mark',
|
|
72
|
-
type: KEYS.sub,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
match: '==',
|
|
76
|
-
mode: 'mark',
|
|
77
|
-
type: KEYS.highlight,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
match: '≡',
|
|
81
|
-
mode: 'mark',
|
|
82
|
-
type: KEYS.highlight,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
match: '`',
|
|
86
|
-
mode: 'mark',
|
|
87
|
-
type: KEYS.code,
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
const autoformatBlocks: AutoformatRule[] = [
|
|
92
|
-
{
|
|
93
|
-
match: '# ',
|
|
94
|
-
mode: 'block',
|
|
95
|
-
type: KEYS.h1,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
match: '## ',
|
|
99
|
-
mode: 'block',
|
|
100
|
-
type: KEYS.h2,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
match: '### ',
|
|
104
|
-
mode: 'block',
|
|
105
|
-
type: KEYS.h3,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
match: '#### ',
|
|
109
|
-
mode: 'block',
|
|
110
|
-
type: KEYS.h4,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
match: '##### ',
|
|
114
|
-
mode: 'block',
|
|
115
|
-
type: KEYS.h5,
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
match: '###### ',
|
|
119
|
-
mode: 'block',
|
|
120
|
-
type: KEYS.h6,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
match: '> ',
|
|
124
|
-
mode: 'block',
|
|
125
|
-
type: KEYS.blockquote,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
match: '```',
|
|
129
|
-
mode: 'block',
|
|
130
|
-
type: KEYS.codeBlock,
|
|
131
|
-
format: (editor) => {
|
|
132
|
-
insertEmptyCodeBlock(editor, {
|
|
133
|
-
defaultType: KEYS.p,
|
|
134
|
-
insertNodesOptions: { select: true },
|
|
135
|
-
});
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
// {
|
|
139
|
-
// match: '+ ',
|
|
140
|
-
// mode: 'block',
|
|
141
|
-
// preFormat: openNextToggles,
|
|
142
|
-
// type: KEYS.toggle,
|
|
143
|
-
// },
|
|
144
|
-
{
|
|
145
|
-
match: ['---', '—-', '___ '],
|
|
146
|
-
mode: 'block',
|
|
147
|
-
type: KEYS.hr,
|
|
148
|
-
format: (editor) => {
|
|
149
|
-
editor.tf.setNodes({ type: KEYS.hr });
|
|
150
|
-
editor.tf.insertNodes({
|
|
151
|
-
children: [{ text: '' }],
|
|
152
|
-
type: KEYS.p,
|
|
153
|
-
});
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
const autoformatLists: AutoformatRule[] = [
|
|
159
|
-
{
|
|
160
|
-
match: ['* ', '- '],
|
|
161
|
-
mode: 'block',
|
|
162
|
-
type: 'list',
|
|
163
|
-
format: (editor) => {
|
|
164
|
-
toggleList(editor, {
|
|
165
|
-
listStyleType: KEYS.ul,
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
match: [String.raw`^\d+\.$ `, String.raw`^\d+\)$ `],
|
|
171
|
-
matchByRegex: true,
|
|
172
|
-
mode: 'block',
|
|
173
|
-
type: 'list',
|
|
174
|
-
format: (editor, { matchString }) => {
|
|
175
|
-
toggleList(editor, {
|
|
176
|
-
listRestartPolite: Number(matchString) || 1,
|
|
177
|
-
listStyleType: KEYS.ol,
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
match: ['[] '],
|
|
183
|
-
mode: 'block',
|
|
184
|
-
type: 'list',
|
|
185
|
-
format: (editor) => {
|
|
186
|
-
toggleList(editor, {
|
|
187
|
-
listStyleType: KEYS.listTodo,
|
|
188
|
-
});
|
|
189
|
-
editor.tf.setNodes({
|
|
190
|
-
checked: false,
|
|
191
|
-
listStyleType: KEYS.listTodo,
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
match: ['[x] '],
|
|
197
|
-
mode: 'block',
|
|
198
|
-
type: 'list',
|
|
199
|
-
format: (editor) => {
|
|
200
|
-
toggleList(editor, {
|
|
201
|
-
listStyleType: KEYS.listTodo,
|
|
202
|
-
});
|
|
203
|
-
editor.tf.setNodes({
|
|
204
|
-
checked: true,
|
|
205
|
-
listStyleType: KEYS.listTodo,
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
];
|
|
210
|
-
|
|
211
|
-
export const AutoformatKit = [
|
|
212
|
-
AutoformatPlugin.configure({
|
|
213
|
-
options: {
|
|
214
|
-
enableUndoOnDelete: true,
|
|
215
|
-
rules: [
|
|
216
|
-
...autoformatBlocks,
|
|
217
|
-
...autoformatMarks,
|
|
218
|
-
...autoformatSmartQuotes,
|
|
219
|
-
...autoformatPunctuation,
|
|
220
|
-
...autoformatLegal,
|
|
221
|
-
...autoformatLegalHtml,
|
|
222
|
-
...autoformatArrow,
|
|
223
|
-
...autoformatMath,
|
|
224
|
-
...autoformatLists,
|
|
225
|
-
].map(
|
|
226
|
-
(rule): AutoformatRule => ({
|
|
227
|
-
...rule,
|
|
228
|
-
query: (editor) =>
|
|
229
|
-
!editor.api.some({
|
|
230
|
-
match: { type: editor.getType(KEYS.codeBlock) },
|
|
231
|
-
}),
|
|
232
|
-
})
|
|
233
|
-
),
|
|
234
|
-
},
|
|
235
|
-
}),
|
|
236
|
-
];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseBlockquotePlugin,
|
|
3
|
-
BaseH1Plugin,
|
|
4
|
-
BaseH2Plugin,
|
|
5
|
-
BaseH3Plugin,
|
|
6
|
-
BaseH4Plugin,
|
|
7
|
-
BaseH5Plugin,
|
|
8
|
-
BaseH6Plugin,
|
|
9
|
-
BaseHorizontalRulePlugin,
|
|
10
|
-
} from '@platejs/basic-nodes';
|
|
11
|
-
import { BaseParagraphPlugin } from 'platejs';
|
|
12
|
-
|
|
13
|
-
import { BlockquoteElementStatic } from '@/components/ui/blockquote-node-static';
|
|
14
|
-
import {
|
|
15
|
-
H1ElementStatic,
|
|
16
|
-
H2ElementStatic,
|
|
17
|
-
H3ElementStatic,
|
|
18
|
-
H4ElementStatic,
|
|
19
|
-
H5ElementStatic,
|
|
20
|
-
H6ElementStatic,
|
|
21
|
-
} from '@/components/ui/heading-node-static';
|
|
22
|
-
import { HrElementStatic } from '@/components/ui/hr-node-static';
|
|
23
|
-
import { ParagraphElementStatic } from '@/components/ui/paragraph-node-static';
|
|
24
|
-
|
|
25
|
-
export const BaseBasicBlocksKit = [
|
|
26
|
-
BaseParagraphPlugin.withComponent(ParagraphElementStatic),
|
|
27
|
-
BaseH1Plugin.withComponent(H1ElementStatic),
|
|
28
|
-
BaseH2Plugin.withComponent(H2ElementStatic),
|
|
29
|
-
BaseH3Plugin.withComponent(H3ElementStatic),
|
|
30
|
-
BaseH4Plugin.withComponent(H4ElementStatic),
|
|
31
|
-
BaseH5Plugin.withComponent(H5ElementStatic),
|
|
32
|
-
BaseH6Plugin.withComponent(H6ElementStatic),
|
|
33
|
-
BaseBlockquotePlugin.withComponent(BlockquoteElementStatic),
|
|
34
|
-
BaseHorizontalRulePlugin.withComponent(HrElementStatic),
|
|
35
|
-
];
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BlockquotePlugin,
|
|
5
|
-
H1Plugin,
|
|
6
|
-
H2Plugin,
|
|
7
|
-
H3Plugin,
|
|
8
|
-
H4Plugin,
|
|
9
|
-
H5Plugin,
|
|
10
|
-
H6Plugin,
|
|
11
|
-
HorizontalRulePlugin,
|
|
12
|
-
} from '@platejs/basic-nodes/react';
|
|
13
|
-
import { ParagraphPlugin } from 'platejs/react';
|
|
14
|
-
|
|
15
|
-
import { BlockquoteElement } from '@/components/ui/blockquote-node';
|
|
16
|
-
import {
|
|
17
|
-
H1Element,
|
|
18
|
-
H2Element,
|
|
19
|
-
H3Element,
|
|
20
|
-
H4Element,
|
|
21
|
-
H5Element,
|
|
22
|
-
H6Element,
|
|
23
|
-
} from '@/components/ui/heading-node';
|
|
24
|
-
import { HrElement } from '@/components/ui/hr-node';
|
|
25
|
-
import { ParagraphElement } from '@/components/ui/paragraph-node';
|
|
26
|
-
|
|
27
|
-
export const BasicBlocksKit = [
|
|
28
|
-
ParagraphPlugin.withComponent(ParagraphElement),
|
|
29
|
-
H1Plugin.configure({
|
|
30
|
-
node: {
|
|
31
|
-
component: H1Element,
|
|
32
|
-
},
|
|
33
|
-
rules: {
|
|
34
|
-
break: { empty: 'reset' },
|
|
35
|
-
},
|
|
36
|
-
shortcuts: { toggle: { keys: 'mod+alt+1' } },
|
|
37
|
-
}),
|
|
38
|
-
H2Plugin.configure({
|
|
39
|
-
node: {
|
|
40
|
-
component: H2Element,
|
|
41
|
-
},
|
|
42
|
-
rules: {
|
|
43
|
-
break: { empty: 'reset' },
|
|
44
|
-
},
|
|
45
|
-
shortcuts: { toggle: { keys: 'mod+alt+2' } },
|
|
46
|
-
}),
|
|
47
|
-
H3Plugin.configure({
|
|
48
|
-
node: {
|
|
49
|
-
component: H3Element,
|
|
50
|
-
},
|
|
51
|
-
rules: {
|
|
52
|
-
break: { empty: 'reset' },
|
|
53
|
-
},
|
|
54
|
-
shortcuts: { toggle: { keys: 'mod+alt+3' } },
|
|
55
|
-
}),
|
|
56
|
-
H4Plugin.configure({
|
|
57
|
-
node: {
|
|
58
|
-
component: H4Element,
|
|
59
|
-
},
|
|
60
|
-
rules: {
|
|
61
|
-
break: { empty: 'reset' },
|
|
62
|
-
},
|
|
63
|
-
shortcuts: { toggle: { keys: 'mod+alt+4' } },
|
|
64
|
-
}),
|
|
65
|
-
H5Plugin.configure({
|
|
66
|
-
node: {
|
|
67
|
-
component: H5Element,
|
|
68
|
-
},
|
|
69
|
-
rules: {
|
|
70
|
-
break: { empty: 'reset' },
|
|
71
|
-
},
|
|
72
|
-
shortcuts: { toggle: { keys: 'mod+alt+5' } },
|
|
73
|
-
}),
|
|
74
|
-
H6Plugin.configure({
|
|
75
|
-
node: {
|
|
76
|
-
component: H6Element,
|
|
77
|
-
},
|
|
78
|
-
rules: {
|
|
79
|
-
break: { empty: 'reset' },
|
|
80
|
-
},
|
|
81
|
-
shortcuts: { toggle: { keys: 'mod+alt+6' } },
|
|
82
|
-
}),
|
|
83
|
-
BlockquotePlugin.configure({
|
|
84
|
-
node: { component: BlockquoteElement },
|
|
85
|
-
shortcuts: { toggle: { keys: 'mod+shift+period' } },
|
|
86
|
-
}),
|
|
87
|
-
HorizontalRulePlugin.withComponent(HrElement),
|
|
88
|
-
];
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseBoldPlugin,
|
|
3
|
-
BaseCodePlugin,
|
|
4
|
-
BaseHighlightPlugin,
|
|
5
|
-
BaseItalicPlugin,
|
|
6
|
-
BaseKbdPlugin,
|
|
7
|
-
BaseStrikethroughPlugin,
|
|
8
|
-
BaseSubscriptPlugin,
|
|
9
|
-
BaseSuperscriptPlugin,
|
|
10
|
-
BaseUnderlinePlugin,
|
|
11
|
-
} from '@platejs/basic-nodes';
|
|
12
|
-
|
|
13
|
-
import { CodeLeafStatic } from '@/components/ui/code-node-static';
|
|
14
|
-
import { HighlightLeafStatic } from '@/components/ui/highlight-node-static';
|
|
15
|
-
import { KbdLeafStatic } from '@/components/ui/kbd-node-static';
|
|
16
|
-
|
|
17
|
-
export const BaseBasicMarksKit = [
|
|
18
|
-
BaseBoldPlugin,
|
|
19
|
-
BaseItalicPlugin,
|
|
20
|
-
BaseUnderlinePlugin,
|
|
21
|
-
BaseCodePlugin.withComponent(CodeLeafStatic),
|
|
22
|
-
BaseStrikethroughPlugin,
|
|
23
|
-
BaseSubscriptPlugin,
|
|
24
|
-
BaseSuperscriptPlugin,
|
|
25
|
-
BaseHighlightPlugin.withComponent(HighlightLeafStatic),
|
|
26
|
-
BaseKbdPlugin.withComponent(KbdLeafStatic),
|
|
27
|
-
];
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BoldPlugin,
|
|
5
|
-
CodePlugin,
|
|
6
|
-
HighlightPlugin,
|
|
7
|
-
ItalicPlugin,
|
|
8
|
-
KbdPlugin,
|
|
9
|
-
StrikethroughPlugin,
|
|
10
|
-
SubscriptPlugin,
|
|
11
|
-
SuperscriptPlugin,
|
|
12
|
-
UnderlinePlugin,
|
|
13
|
-
} from '@platejs/basic-nodes/react';
|
|
14
|
-
|
|
15
|
-
import { CodeLeaf } from '@/components/ui/code-node';
|
|
16
|
-
import { HighlightLeaf } from '@/components/ui/highlight-node';
|
|
17
|
-
import { KbdLeaf } from '@/components/ui/kbd-node';
|
|
18
|
-
|
|
19
|
-
export const BasicMarksKit = [
|
|
20
|
-
BoldPlugin,
|
|
21
|
-
ItalicPlugin,
|
|
22
|
-
UnderlinePlugin,
|
|
23
|
-
CodePlugin.configure({
|
|
24
|
-
node: { component: CodeLeaf },
|
|
25
|
-
shortcuts: { toggle: { keys: 'mod+e' } },
|
|
26
|
-
}),
|
|
27
|
-
StrikethroughPlugin.configure({
|
|
28
|
-
shortcuts: { toggle: { keys: 'mod+shift+x' } },
|
|
29
|
-
}),
|
|
30
|
-
SubscriptPlugin.configure({
|
|
31
|
-
shortcuts: { toggle: { keys: 'mod+comma' } },
|
|
32
|
-
}),
|
|
33
|
-
SuperscriptPlugin.configure({
|
|
34
|
-
shortcuts: { toggle: { keys: 'mod+period' } },
|
|
35
|
-
}),
|
|
36
|
-
HighlightPlugin.configure({
|
|
37
|
-
node: { component: HighlightLeaf },
|
|
38
|
-
shortcuts: { toggle: { keys: 'mod+shift+h' } },
|
|
39
|
-
}),
|
|
40
|
-
KbdPlugin.withComponent(KbdLeaf),
|
|
41
|
-
];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { BlockMenuPlugin } from '@platejs/selection/react';
|
|
4
|
-
|
|
5
|
-
import { BlockContextMenu } from '@/components/ui/block-context-menu';
|
|
6
|
-
|
|
7
|
-
import { BlockSelectionKit } from './block-selection-kit';
|
|
8
|
-
|
|
9
|
-
export const BlockMenuKit = [
|
|
10
|
-
...BlockSelectionKit,
|
|
11
|
-
BlockMenuPlugin.configure({
|
|
12
|
-
render: { aboveEditable: BlockContextMenu },
|
|
13
|
-
}),
|
|
14
|
-
];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { KEYS } from 'platejs';
|
|
4
|
-
import { BlockPlaceholderPlugin } from 'platejs/react';
|
|
5
|
-
|
|
6
|
-
export const BlockPlaceholderKit = [
|
|
7
|
-
BlockPlaceholderPlugin.configure({
|
|
8
|
-
options: {
|
|
9
|
-
className:
|
|
10
|
-
'before:absolute before:cursor-text before:text-muted-foreground/80 before:content-[attr(placeholder)]',
|
|
11
|
-
placeholders: {
|
|
12
|
-
[KEYS.p]: 'Type something...',
|
|
13
|
-
},
|
|
14
|
-
query: ({ path }) => path.length === 1,
|
|
15
|
-
},
|
|
16
|
-
}),
|
|
17
|
-
];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { AIChatPlugin } from '@platejs/ai/react';
|
|
4
|
-
import { BlockSelectionPlugin } from '@platejs/selection/react';
|
|
5
|
-
import { getPluginTypes, isHotkey, KEYS } from 'platejs';
|
|
6
|
-
|
|
7
|
-
import { BlockSelection } from '@/components/ui/block-selection';
|
|
8
|
-
|
|
9
|
-
export const BlockSelectionKit = [
|
|
10
|
-
BlockSelectionPlugin.configure(({ editor }) => ({
|
|
11
|
-
options: {
|
|
12
|
-
enableContextMenu: true,
|
|
13
|
-
isSelectable: (element) =>
|
|
14
|
-
!getPluginTypes(editor, [KEYS.column, KEYS.codeLine, KEYS.td]).includes(
|
|
15
|
-
element.type
|
|
16
|
-
),
|
|
17
|
-
onKeyDownSelecting: (editor, e) => {
|
|
18
|
-
if (isHotkey('mod+j')(e)) {
|
|
19
|
-
editor.getApi(AIChatPlugin).aiChat.show();
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
render: {
|
|
24
|
-
belowRootNodes: (props) => {
|
|
25
|
-
if (!props.attributes.className?.includes('slate-selectable'))
|
|
26
|
-
return null;
|
|
27
|
-
|
|
28
|
-
return <BlockSelection {...(props as any)} />;
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
})),
|
|
32
|
-
];
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseCodeBlockPlugin,
|
|
3
|
-
BaseCodeLinePlugin,
|
|
4
|
-
BaseCodeSyntaxPlugin,
|
|
5
|
-
} from '@platejs/code-block';
|
|
6
|
-
import { all, createLowlight } from 'lowlight';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
CodeBlockElementStatic,
|
|
10
|
-
CodeLineElementStatic,
|
|
11
|
-
CodeSyntaxLeafStatic,
|
|
12
|
-
} from '@/components/ui/code-block-node-static';
|
|
13
|
-
|
|
14
|
-
const lowlight = createLowlight(all);
|
|
15
|
-
|
|
16
|
-
export const BaseCodeBlockKit = [
|
|
17
|
-
BaseCodeBlockPlugin.configure({
|
|
18
|
-
node: { component: CodeBlockElementStatic },
|
|
19
|
-
options: { lowlight },
|
|
20
|
-
}),
|
|
21
|
-
BaseCodeLinePlugin.withComponent(CodeLineElementStatic),
|
|
22
|
-
BaseCodeSyntaxPlugin.withComponent(CodeSyntaxLeafStatic),
|
|
23
|
-
];
|