@collabchron/notiq 0.3.0 → 1.0.1
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 +21 -0
- package/README.md +230 -39
- package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +15 -0
- package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +161 -0
- package/dist/EquationComponent-CB6DFIHV.mjs +154 -0
- package/dist/ExcalidrawComponent-XW6646OH.mjs +528 -0
- package/dist/ExcalidrawPlugin-ZFHT62IF.mjs +14 -0
- package/dist/ExportPlugin-V2RLM63S.mjs +11 -0
- package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +12 -0
- package/dist/FloatingTextFormatToolbarPlugin-F2GY6LMI.mjs +30 -0
- package/dist/HintComponet-BRL6EAMS.mjs +217 -0
- package/dist/InlineImageComponent-UWIUWBHI.mjs +453 -0
- package/dist/MobileToolbar-BOOZAMQE.mjs +268 -0
- package/dist/SlashCommand-GMT5JI33.mjs +28 -0
- package/dist/StoryBuilderComponent-JGDBM5JU.mjs +562 -0
- package/{src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx → dist/TableCellActionMenuPlugin-PGK2K3VG.mjs} +667 -759
- package/{src/components/editor/plugins/TableHoverActionsPlugin/index.tsx → dist/TableHoverActionsPlugin-GJVE6VRW.mjs} +258 -314
- package/dist/TemplatePlugin-ZD3QEVTI.mjs +9 -0
- package/dist/ToolbarPlugin-YKYA4NB4.mjs +1547 -0
- package/dist/babel-JZ2EV6AX.mjs +7233 -0
- package/dist/background-color-XZTYLGO2.mjs +362 -0
- package/dist/block-format-YJCV2DIY.mjs +15 -0
- package/dist/chunk-2FNEAMSP.mjs +127 -0
- package/dist/chunk-3CPBODXA.mjs +84 -0
- package/dist/chunk-3G37YKTV.mjs +83 -0
- package/dist/chunk-3JVFG7ER.mjs +184 -0
- package/dist/chunk-456TN7IM.mjs +110 -0
- package/dist/chunk-4EXYCTGJ.mjs +27 -0
- package/{src/utils/getSelectedNode.ts → dist/chunk-4HBCVSE6.mjs} +26 -27
- package/dist/chunk-4MEDW3T6.mjs +125 -0
- package/dist/chunk-4VWFVWYP.mjs +36 -0
- package/dist/chunk-5BAKY5KN.mjs +84 -0
- package/dist/chunk-5QSNIVIG.mjs +333 -0
- package/dist/chunk-64Z3FI7T.mjs +37 -0
- package/{src/components/editor/nodes/Stepper/index.tsx → dist/chunk-6RNZQOH2.mjs} +214 -260
- package/dist/chunk-77KXU36M.mjs +64 -0
- package/dist/chunk-77UA6HYR.mjs +165 -0
- package/dist/chunk-7NZAPJ4G.mjs +102 -0
- package/dist/chunk-7VUMHWWL.mjs +152 -0
- package/dist/chunk-AMMKBSST.mjs +1256 -0
- package/dist/chunk-BIU7WTLX.mjs +95 -0
- package/dist/chunk-EGMI62PP.mjs +83 -0
- package/dist/chunk-EHNQD5KO.mjs +88 -0
- package/dist/chunk-FSM26655.mjs +37 -0
- package/{src/components/editor/nodes/Hint/index.tsx → dist/chunk-G53GLEAY.mjs} +158 -190
- package/dist/chunk-GK35L7UY.mjs +28 -0
- package/dist/chunk-GXYD4VZM.mjs +193 -0
- package/dist/chunk-GYIOYVCN.mjs +538 -0
- package/dist/chunk-GZPNVR7L.mjs +157 -0
- package/dist/chunk-JXDPPUJI.mjs +52 -0
- package/dist/chunk-K36V4SIW.mjs +141 -0
- package/dist/chunk-KJ6AJ44Q.mjs +128 -0
- package/dist/chunk-KJV3FAZ7.mjs +142 -0
- package/{src/components/editor/plugins/ImagesPlugin/index.tsx → dist/chunk-LGG4IUIA.mjs} +189 -222
- package/dist/chunk-LQN3CMKV.mjs +1906 -0
- package/dist/chunk-N3WN46VL.mjs +236 -0
- package/dist/chunk-PBD6LMLC.mjs +366 -0
- package/dist/chunk-POGRR73N.mjs +33 -0
- package/{src/components/editor/utils/editorFormatting.ts → dist/chunk-PZSUSXQG.mjs} +238 -282
- package/dist/chunk-QEIFVK5M.mjs +29 -0
- package/dist/chunk-QHIQKMVN.mjs +427 -0
- package/dist/chunk-TCYK7DM7.mjs +36 -0
- package/dist/chunk-TTHQCW5F.mjs +47 -0
- package/dist/chunk-U47ABU5Z.mjs +53 -0
- package/dist/chunk-WDG7J2DY.mjs +116 -0
- package/dist/chunk-WJRHXI2C.mjs +733 -0
- package/dist/chunk-XLER2DHM.mjs +357 -0
- package/dist/chunk-XWC4TK2N.mjs +315 -0
- package/dist/chunk-YHPNOWFH.mjs +15 -0
- package/dist/chunk-YKC3SO4Z.mjs +32 -0
- package/dist/chunk-YMBXLRW5.mjs +374 -0
- package/dist/chunk-YPHOEJ46.mjs +64 -0
- package/dist/chunk-YUDCJRJM.mjs +25 -0
- package/dist/chunk-Z4EWP7BI.mjs +65 -0
- package/dist/chunk-ZB5LZQKC.mjs +191 -0
- package/dist/chunk-ZJRKATOJ.mjs +65 -0
- package/dist/color-BPKOPQKN.mjs +12 -0
- package/dist/estree-XC56IUFX.mjs +4414 -0
- package/dist/font-FEZ3GKSF.mjs +13 -0
- package/dist/font-size-EK775WRH.mjs +15 -0
- package/dist/html-S3ACX7NI.mjs +2738 -0
- package/dist/image-2PJIAYAT.mjs +993 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +57855 -0
- package/dist/index.mjs +1790 -0
- package/dist/insert-gif-SAIDYURE.mjs +100 -0
- package/dist/insert-image-U3RJN3OW.mjs +259 -0
- package/dist/insert-node-5P2CRJ7S.mjs +201 -0
- package/dist/insert-poll-HCPM7MO6.mjs +33 -0
- package/dist/insert-table-24XYUS2W.mjs +66 -0
- package/dist/markdown-SNVBOSRA.mjs +3487 -0
- package/dist/poll-component-2R4MDLHS.mjs +303 -0
- package/dist/postcss-ONF3VDIM.mjs +5051 -0
- package/dist/standalone-EOIALU3M.mjs +2373 -0
- package/dist/stepper-FSARL6X6.mjs +304 -0
- package/dist/styles/notiq.css +1149 -0
- package/dist/text-align-VLECWO4H.mjs +118 -0
- package/dist/text-format-BG5WOOPZ.mjs +16 -0
- package/dist/typescript-AMPI6OVS.mjs +13135 -0
- package/package.json +67 -11
- package/src/styles/notiq.css +1149 -0
- package/src/styles/tailwind-plugin.ts +134 -0
- package/components.json +0 -21
- package/eslint.config.mjs +0 -16
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -5
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/images/icons/plus.svg +0 -10
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/actions.ts +0 -2
- package/src/app/api/ai/route.ts +0 -175
- package/src/app/api/edgestore/[...edgestore]/route.ts +0 -28
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -205
- package/src/app/layout.tsx +0 -38
- package/src/app/page.tsx +0 -12
- package/src/components/editor/Core.tsx +0 -220
- package/src/components/editor/hooks/instructions-messages.ts +0 -300
- package/src/components/editor/hooks/use-mobile.ts +0 -19
- package/src/components/editor/hooks/useReport.ts +0 -67
- package/src/components/editor/hooks/useResizeObservert.ts +0 -22
- package/src/components/editor/index.tsx +0 -39
- package/src/components/editor/lexical-on-change.tsx +0 -28
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +0 -92
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +0 -65
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +0 -105
- package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +0 -143
- package/src/components/editor/nodes/EquationNode/EquationNode.tsx +0 -170
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +0 -228
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +0 -137
- package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +0 -317
- package/src/components/editor/nodes/ExcalidrawNode/index.tsx +0 -204
- package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +0 -134
- package/src/components/editor/nodes/Hint/HintComponet.tsx +0 -221
- package/src/components/editor/nodes/ImageNode/index.tsx +0 -328
- package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +0 -383
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +0 -94
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +0 -309
- package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +0 -146
- package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +0 -79
- package/src/components/editor/nodes/PollNode/index.tsx +0 -204
- package/src/components/editor/nodes/TweetNode/index.tsx +0 -214
- package/src/components/editor/nodes/index.ts +0 -81
- package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +0 -350
- package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +0 -56
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +0 -70
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +0 -192
- package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +0 -217
- package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +0 -26
- package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +0 -21
- package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +0 -76
- package/src/components/editor/plugins/CollapsiblePlugin/index.ts +0 -228
- package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +0 -44
- package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +0 -52
- package/src/components/editor/plugins/EquationsPlugin/index.tsx +0 -85
- package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +0 -98
- package/src/components/editor/plugins/FigmaPlugin/index.tsx +0 -42
- package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +0 -445
- package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +0 -275
- package/src/components/editor/plugins/InlineImagePlugin/index.tsx +0 -351
- package/src/components/editor/plugins/LayoutPlugin/index.tsx +0 -238
- package/src/components/editor/plugins/LinkPlugin/index.tsx +0 -36
- package/src/components/editor/plugins/LinkWithMetaData/index.tsx +0 -271
- package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -11
- package/src/components/editor/plugins/MarkdownTransformers/index.tsx +0 -304
- package/src/components/editor/plugins/PollPlugin/index.tsx +0 -49
- package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +0 -180
- package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +0 -253
- package/src/components/editor/plugins/SlashCommand/index.tsx +0 -621
- package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +0 -127
- package/src/components/editor/plugins/TabFocusPlugin/index.ts +0 -58
- package/src/components/editor/plugins/TableCellResizer/index.tsx +0 -438
- package/src/components/editor/plugins/TablePlugin/index.tsx +0 -99
- package/src/components/editor/plugins/ToolbarPlugin/index.tsx +0 -522
- package/src/components/editor/plugins/TwitterPlugin/index.ts +0 -35
- package/src/components/editor/plugins/YouTubeNode/index.tsx +0 -179
- package/src/components/editor/plugins/YouTubePlugin/index.ts +0 -41
- package/src/components/editor/themes/editor-theme.ts +0 -113
- package/src/components/editor/themes/theme.css +0 -377
- package/src/components/editor/utils/ai.ts +0 -291
- package/src/components/editor/utils/canUseDOM.ts +0 -12
- package/src/components/editor/utils/environment.ts +0 -50
- package/src/components/editor/utils/extract-data.ts +0 -166
- package/src/components/editor/utils/getAllLexicalChildren.ts +0 -13
- package/src/components/editor/utils/getDOMRangeRect.ts +0 -27
- package/src/components/editor/utils/getSelectedNode.ts +0 -27
- package/src/components/editor/utils/gif.ts +0 -29
- package/src/components/editor/utils/invariant.ts +0 -15
- package/src/components/editor/utils/setFloatingElemPosition.ts +0 -51
- package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +0 -40
- package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +0 -51
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +0 -15
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +0 -114
- package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +0 -6
- package/src/components/editor/utils/url.ts +0 -109
- package/src/components/editor/utils/useLayoutEffect.ts +0 -13
- package/src/components/providers/QueryProvider.tsx +0 -15
- package/src/components/providers/SharedHistoryContext.tsx +0 -28
- package/src/components/providers/ToolbarContext.tsx +0 -123
- package/src/components/providers/theme-provider.tsx +0 -11
- package/src/components/theme/ModeToggle.tsx +0 -40
- package/src/components/ui/FileInput.tsx +0 -40
- package/src/components/ui/Input.css +0 -32
- package/src/components/ui/Select.css +0 -42
- package/src/components/ui/Select.tsx +0 -36
- package/src/components/ui/TextInput.tsx +0 -48
- package/src/components/ui/ai/ai-button.tsx +0 -574
- package/src/components/ui/ai/border.tsx +0 -99
- package/src/components/ui/ai/placeholder-input-vanish.tsx +0 -282
- package/src/components/ui/button.tsx +0 -89
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog/Dialog.css +0 -25
- package/src/components/ui/dialog/Dialog.tsx +0 -34
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/drop-downs/background-color.tsx +0 -183
- package/src/components/ui/drop-downs/block-format.tsx +0 -159
- package/src/components/ui/drop-downs/code.tsx +0 -42
- package/src/components/ui/drop-downs/color.tsx +0 -177
- package/src/components/ui/drop-downs/font-size.tsx +0 -138
- package/src/components/ui/drop-downs/font.tsx +0 -155
- package/src/components/ui/drop-downs/index.tsx +0 -122
- package/src/components/ui/drop-downs/insert-node.tsx +0 -213
- package/src/components/ui/drop-downs/text-align.tsx +0 -123
- package/src/components/ui/drop-downs/text-format.tsx +0 -104
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/equation/EquationEditor.css +0 -38
- package/src/components/ui/equation/EquationEditor.tsx +0 -56
- package/src/components/ui/equation/KatexEquationAlterer.css +0 -41
- package/src/components/ui/equation/KatexEquationAlterer.tsx +0 -83
- package/src/components/ui/equation/KatexRenderer.tsx +0 -66
- package/src/components/ui/excalidraw/ExcalidrawModal.css +0 -64
- package/src/components/ui/excalidraw/ExcalidrawModal.tsx +0 -234
- package/src/components/ui/excalidraw/Modal.css +0 -62
- package/src/components/ui/excalidraw/Modal.tsx +0 -110
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/image/error-image.tsx +0 -17
- package/src/components/ui/image/file-upload.tsx +0 -240
- package/src/components/ui/image/image-resizer.tsx +0 -297
- package/src/components/ui/image/image-toolbar.tsx +0 -264
- package/src/components/ui/image/index.tsx +0 -408
- package/src/components/ui/image/lazy-image.tsx +0 -68
- package/src/components/ui/image/lazy-video.tsx +0 -71
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/models/custom-dialog.tsx +0 -320
- package/src/components/ui/models/insert-gif.tsx +0 -90
- package/src/components/ui/models/insert-image.tsx +0 -52
- package/src/components/ui/models/insert-poll.tsx +0 -29
- package/src/components/ui/models/insert-table.tsx +0 -62
- package/src/components/ui/models/use-model.tsx +0 -91
- package/src/components/ui/poll/poll-component.tsx +0 -304
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/scroll-area.tsx +0 -48
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/stepper/step.tsx +0 -179
- package/src/components/ui/stepper/stepper.tsx +0 -89
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toggle.tsx +0 -71
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/components/ui/write/text-format-floting-toolbar.tsx +0 -346
- package/src/lib/edgestore.ts +0 -9
- package/src/lib/pinecone-client.ts +0 -0
- package/src/lib/utils.ts +0 -6
- package/src/utils/docSerialization.ts +0 -77
- package/src/utils/emoji-list.ts +0 -16615
- package/src/utils/getDOMRangeRect.ts +0 -27
- package/src/utils/getThemeSelector.ts +0 -25
- package/src/utils/isMobileWidth.ts +0 -7
- package/src/utils/joinClasses.ts +0 -13
- package/src/utils/setFloatingElemPosition.ts +0 -74
- package/src/utils/setFloatingElemPositionForLinkEditor.ts +0 -46
- package/src/utils/swipe.ts +0 -127
- package/src/utils/url.ts +0 -38
- package/tsconfig.json +0 -27
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { type DialogProps } from "@radix-ui/react-dialog"
|
|
5
|
-
import { Command as CommandPrimitive } from "cmdk"
|
|
6
|
-
import { Search } from "lucide-react"
|
|
7
|
-
|
|
8
|
-
import { cn } from "@/lib/utils"
|
|
9
|
-
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
|
10
|
-
|
|
11
|
-
const Command = React.forwardRef<
|
|
12
|
-
React.ElementRef<typeof CommandPrimitive>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
14
|
-
>(({ className, ...props }, ref) => (
|
|
15
|
-
<CommandPrimitive
|
|
16
|
-
ref={ref}
|
|
17
|
-
className={cn(
|
|
18
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
))
|
|
24
|
-
Command.displayName = CommandPrimitive.displayName
|
|
25
|
-
|
|
26
|
-
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
27
|
-
return (
|
|
28
|
-
<Dialog {...props}>
|
|
29
|
-
<DialogContent className="overflow-hidden p-0">
|
|
30
|
-
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
31
|
-
{children}
|
|
32
|
-
</Command>
|
|
33
|
-
</DialogContent>
|
|
34
|
-
</Dialog>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const CommandInput = React.forwardRef<
|
|
39
|
-
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
40
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
41
|
-
>(({ className, ...props }, ref) => (
|
|
42
|
-
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
43
|
-
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
44
|
-
<CommandPrimitive.Input
|
|
45
|
-
ref={ref}
|
|
46
|
-
className={cn(
|
|
47
|
-
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
48
|
-
className
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
))
|
|
54
|
-
|
|
55
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
56
|
-
|
|
57
|
-
const CommandList = React.forwardRef<
|
|
58
|
-
React.ElementRef<typeof CommandPrimitive.List>,
|
|
59
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
60
|
-
>(({ className, ...props }, ref) => (
|
|
61
|
-
<CommandPrimitive.List
|
|
62
|
-
ref={ref}
|
|
63
|
-
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
))
|
|
67
|
-
|
|
68
|
-
CommandList.displayName = CommandPrimitive.List.displayName
|
|
69
|
-
|
|
70
|
-
const CommandEmpty = React.forwardRef<
|
|
71
|
-
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
72
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
73
|
-
>((props, ref) => (
|
|
74
|
-
<CommandPrimitive.Empty
|
|
75
|
-
ref={ref}
|
|
76
|
-
className="py-6 text-center text-sm"
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
))
|
|
80
|
-
|
|
81
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
82
|
-
|
|
83
|
-
const CommandGroup = React.forwardRef<
|
|
84
|
-
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
85
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
86
|
-
>(({ className, ...props }, ref) => (
|
|
87
|
-
<CommandPrimitive.Group
|
|
88
|
-
ref={ref}
|
|
89
|
-
className={cn(
|
|
90
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
91
|
-
className
|
|
92
|
-
)}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
95
|
-
))
|
|
96
|
-
|
|
97
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
98
|
-
|
|
99
|
-
const CommandSeparator = React.forwardRef<
|
|
100
|
-
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
101
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
102
|
-
>(({ className, ...props }, ref) => (
|
|
103
|
-
<CommandPrimitive.Separator
|
|
104
|
-
ref={ref}
|
|
105
|
-
className={cn("-mx-1 h-px bg-border", className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
))
|
|
109
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
110
|
-
|
|
111
|
-
const CommandItem = React.forwardRef<
|
|
112
|
-
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
113
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
114
|
-
>(({ className, ...props }, ref) => (
|
|
115
|
-
<CommandPrimitive.Item
|
|
116
|
-
ref={ref}
|
|
117
|
-
className={cn(
|
|
118
|
-
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
119
|
-
className
|
|
120
|
-
)}
|
|
121
|
-
{...props}
|
|
122
|
-
/>
|
|
123
|
-
))
|
|
124
|
-
|
|
125
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
126
|
-
|
|
127
|
-
const CommandShortcut = ({
|
|
128
|
-
className,
|
|
129
|
-
...props
|
|
130
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
131
|
-
return (
|
|
132
|
-
<span
|
|
133
|
-
className={cn(
|
|
134
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
135
|
-
className
|
|
136
|
-
)}
|
|
137
|
-
{...props}
|
|
138
|
-
/>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
CommandShortcut.displayName = "CommandShortcut"
|
|
142
|
-
|
|
143
|
-
export {
|
|
144
|
-
Command,
|
|
145
|
-
CommandDialog,
|
|
146
|
-
CommandInput,
|
|
147
|
-
CommandList,
|
|
148
|
-
CommandEmpty,
|
|
149
|
-
CommandGroup,
|
|
150
|
-
CommandItem,
|
|
151
|
-
CommandShortcut,
|
|
152
|
-
CommandSeparator,
|
|
153
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
.DialogActions {
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
justify-content: right;
|
|
13
|
-
margin-top: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.DialogButtonsList {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
justify-content: right;
|
|
20
|
-
margin-top: 20px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.DialogButtonsList button {
|
|
24
|
-
margin-bottom: 20px;
|
|
25
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {JSX} from 'react';
|
|
10
|
-
|
|
11
|
-
import './Dialog.css';
|
|
12
|
-
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import {ReactNode} from 'react';
|
|
15
|
-
|
|
16
|
-
type Props = Readonly<{
|
|
17
|
-
'data-test-id'?: string;
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
export function DialogButtonsList({children}: Props): JSX.Element {
|
|
22
|
-
return <div className="DialogButtonsList">{children}</div>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function DialogActions({
|
|
26
|
-
'data-test-id': dataTestId,
|
|
27
|
-
children,
|
|
28
|
-
}: Props): JSX.Element {
|
|
29
|
-
return (
|
|
30
|
-
<div className="DialogActions" data-test-id={dataTestId}>
|
|
31
|
-
{children}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
-
import { X } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
|
|
9
|
-
const Dialog = DialogPrimitive.Root
|
|
10
|
-
|
|
11
|
-
const DialogTrigger = DialogPrimitive.Trigger
|
|
12
|
-
|
|
13
|
-
const DialogPortal = DialogPrimitive.Portal
|
|
14
|
-
|
|
15
|
-
const DialogClose = DialogPrimitive.Close
|
|
16
|
-
|
|
17
|
-
const DialogOverlay = React.forwardRef<
|
|
18
|
-
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
19
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
20
|
-
>(({ className, ...props }, ref) => (
|
|
21
|
-
<DialogPrimitive.Overlay
|
|
22
|
-
ref={ref}
|
|
23
|
-
className={cn(
|
|
24
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
25
|
-
className
|
|
26
|
-
)}
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
))
|
|
30
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
31
|
-
|
|
32
|
-
const DialogContent = React.forwardRef<
|
|
33
|
-
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
34
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
35
|
-
>(({ className, children, ...props }, ref) => (
|
|
36
|
-
<DialogPortal>
|
|
37
|
-
<DialogOverlay />
|
|
38
|
-
<DialogPrimitive.Content
|
|
39
|
-
ref={ref}
|
|
40
|
-
className={cn(
|
|
41
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
42
|
-
className
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
48
|
-
<X className="h-4 w-4" />
|
|
49
|
-
<span className="sr-only">Close</span>
|
|
50
|
-
</DialogPrimitive.Close>
|
|
51
|
-
</DialogPrimitive.Content>
|
|
52
|
-
</DialogPortal>
|
|
53
|
-
))
|
|
54
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
55
|
-
|
|
56
|
-
const DialogHeader = ({
|
|
57
|
-
className,
|
|
58
|
-
...props
|
|
59
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
-
<div
|
|
61
|
-
className={cn(
|
|
62
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
63
|
-
className
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
)
|
|
68
|
-
DialogHeader.displayName = "DialogHeader"
|
|
69
|
-
|
|
70
|
-
const DialogFooter = ({
|
|
71
|
-
className,
|
|
72
|
-
...props
|
|
73
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
-
<div
|
|
75
|
-
className={cn(
|
|
76
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
77
|
-
className
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
)
|
|
82
|
-
DialogFooter.displayName = "DialogFooter"
|
|
83
|
-
|
|
84
|
-
const DialogTitle = React.forwardRef<
|
|
85
|
-
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
86
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
87
|
-
>(({ className, ...props }, ref) => (
|
|
88
|
-
<DialogPrimitive.Title
|
|
89
|
-
ref={ref}
|
|
90
|
-
className={cn(
|
|
91
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
92
|
-
className
|
|
93
|
-
)}
|
|
94
|
-
{...props}
|
|
95
|
-
/>
|
|
96
|
-
))
|
|
97
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
98
|
-
|
|
99
|
-
const DialogDescription = React.forwardRef<
|
|
100
|
-
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
101
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
102
|
-
>(({ className, ...props }, ref) => (
|
|
103
|
-
<DialogPrimitive.Description
|
|
104
|
-
ref={ref}
|
|
105
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
))
|
|
109
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
110
|
-
|
|
111
|
-
export {
|
|
112
|
-
Dialog,
|
|
113
|
-
DialogPortal,
|
|
114
|
-
DialogOverlay,
|
|
115
|
-
DialogTrigger,
|
|
116
|
-
DialogClose,
|
|
117
|
-
DialogContent,
|
|
118
|
-
DialogHeader,
|
|
119
|
-
DialogFooter,
|
|
120
|
-
DialogTitle,
|
|
121
|
-
DialogDescription,
|
|
122
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { $getSelection, LexicalEditor } from "lexical";
|
|
2
|
-
import React, { useCallback } from "react";
|
|
3
|
-
import { $patchStyleText } from "@lexical/selection";
|
|
4
|
-
import { useTheme } from "next-themes";
|
|
5
|
-
import {
|
|
6
|
-
Popover,
|
|
7
|
-
PopoverContent,
|
|
8
|
-
PopoverTrigger,
|
|
9
|
-
} from "@/components/ui/popover";
|
|
10
|
-
import { Button } from "@/components/ui/button";
|
|
11
|
-
import { cn } from "@/lib/utils";
|
|
12
|
-
import { Separator } from "@/components/ui/separator";
|
|
13
|
-
import { BaselineIcon, PaintBucketIcon } from "lucide-react";
|
|
14
|
-
|
|
15
|
-
export default function BackgroundColor({
|
|
16
|
-
disabled,
|
|
17
|
-
color,
|
|
18
|
-
bgColor,
|
|
19
|
-
editor,
|
|
20
|
-
isTable = false,
|
|
21
|
-
side = "bottom",
|
|
22
|
-
sideOffset = 0,
|
|
23
|
-
style,
|
|
24
|
-
}: {
|
|
25
|
-
disabled: boolean;
|
|
26
|
-
color?: string;
|
|
27
|
-
bgColor?: string;
|
|
28
|
-
editor: LexicalEditor;
|
|
29
|
-
isTable?: boolean;
|
|
30
|
-
style?: React.CSSProperties;
|
|
31
|
-
side?: "bottom" | "left" | "right" | "top";
|
|
32
|
-
sideOffset?: number;
|
|
33
|
-
}) {
|
|
34
|
-
const { theme } = useTheme();
|
|
35
|
-
|
|
36
|
-
const applyStyleText = useCallback(
|
|
37
|
-
(styles: Record<string, string>, skipHistoryStack?: boolean) => {
|
|
38
|
-
editor.update(
|
|
39
|
-
() => {
|
|
40
|
-
const selection = $getSelection();
|
|
41
|
-
if (selection !== null) {
|
|
42
|
-
$patchStyleText(selection, styles);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
skipHistoryStack ? { tag: "historic" } : {}
|
|
46
|
-
);
|
|
47
|
-
},
|
|
48
|
-
[editor]
|
|
49
|
-
);
|
|
50
|
-
const onFontColorSelect = useCallback(
|
|
51
|
-
(value: string, skipHistoryStack: boolean) => {
|
|
52
|
-
applyStyleText({ color: value }, skipHistoryStack);
|
|
53
|
-
},
|
|
54
|
-
[applyStyleText]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const onBgColorSelect = useCallback(
|
|
58
|
-
(value: string, skipHistoryStack: boolean) => {
|
|
59
|
-
applyStyleText({ "background-color": value }, skipHistoryStack);
|
|
60
|
-
},
|
|
61
|
-
[applyStyleText]
|
|
62
|
-
);
|
|
63
|
-
const dark = React.useMemo(
|
|
64
|
-
() => ({
|
|
65
|
-
font: {
|
|
66
|
-
default: "white",
|
|
67
|
-
Gray: "var(--font-gray)",
|
|
68
|
-
Brown: "var(--font-brown)",
|
|
69
|
-
Orange: "var(--font-orange)",
|
|
70
|
-
Yellow: "var(--font-yellow)",
|
|
71
|
-
Green: "var(--font-green)",
|
|
72
|
-
Blue: "var(--font-blue)",
|
|
73
|
-
Purple: "var(--font-purple)",
|
|
74
|
-
Pink: "var(--font-pink)",
|
|
75
|
-
Red: "var(--font-red)",
|
|
76
|
-
},
|
|
77
|
-
background: {
|
|
78
|
-
default: "none",
|
|
79
|
-
Gray: "var(--background-gray)",
|
|
80
|
-
Brown: "var(--background-brown)",
|
|
81
|
-
Orange: "var(--background-orange)",
|
|
82
|
-
Yellow: "var(--background-yellow)",
|
|
83
|
-
Green: "var(--background-green)",
|
|
84
|
-
Blue: "var(--background-blue)",
|
|
85
|
-
Purple: "var(--background-purple)",
|
|
86
|
-
Pink: "var(--background-pink)",
|
|
87
|
-
Red: "var(--background-red)",
|
|
88
|
-
},
|
|
89
|
-
}),
|
|
90
|
-
[]
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const light = React.useMemo(
|
|
94
|
-
() => ({
|
|
95
|
-
font: {
|
|
96
|
-
Gray: "var(--font-gray)",
|
|
97
|
-
Brown: "var(--font-brown)",
|
|
98
|
-
Orange: "var(--font-orange)",
|
|
99
|
-
Yellow: "var(--font-yellow)",
|
|
100
|
-
Green: "var(--font-green)",
|
|
101
|
-
Blue: "var(--font-blue)",
|
|
102
|
-
Purple: "var(--font-purple)",
|
|
103
|
-
Pink: "var(--font-pink)",
|
|
104
|
-
Red: "var(--font-red)",
|
|
105
|
-
},
|
|
106
|
-
background: {
|
|
107
|
-
Gray: "var(--background-gray)",
|
|
108
|
-
Brown: "var(--background-brown)",
|
|
109
|
-
Orange: "var(--background-orange)",
|
|
110
|
-
Yellow: "var(--background-yellow)",
|
|
111
|
-
Green: "var(--background-green)",
|
|
112
|
-
Blue: "var(--background-blue)",
|
|
113
|
-
Purple: "var(--background-purple)",
|
|
114
|
-
Pink: "var(--background-pink)",
|
|
115
|
-
Red: "var(--background-red)",
|
|
116
|
-
},
|
|
117
|
-
}),
|
|
118
|
-
[]
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
const themeColor = React.useMemo(
|
|
122
|
-
() => (theme === "dark" ? dark : light),
|
|
123
|
-
[theme, dark, light]
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<Popover>
|
|
129
|
-
<PopoverTrigger asChild disabled={disabled}>
|
|
130
|
-
{!isTable ? (
|
|
131
|
-
<Button
|
|
132
|
-
style={{
|
|
133
|
-
...style, background: bgColor === "#fff" ? "transparent" : bgColor,
|
|
134
|
-
}}
|
|
135
|
-
variant={"transparent"}
|
|
136
|
-
className="px-2 border-none cursor-pointer hover:dark-bg-accent hover:text-foreground"
|
|
137
|
-
size="Toolbar"
|
|
138
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
139
|
-
>
|
|
140
|
-
<PaintBucketIcon className="h-7 w-7" />
|
|
141
|
-
</Button>
|
|
142
|
-
) : (
|
|
143
|
-
<div
|
|
144
|
-
style={{
|
|
145
|
-
...style, background: bgColor === "#fff" ? "transparent" : bgColor,
|
|
146
|
-
}}
|
|
147
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
148
|
-
className="cursor-pointer"
|
|
149
|
-
>
|
|
150
|
-
Background
|
|
151
|
-
</div>
|
|
152
|
-
)}
|
|
153
|
-
</PopoverTrigger>
|
|
154
|
-
<PopoverContent className="max-w-32 w-full p-2 z-[250]" side={side} sideOffset={sideOffset}>
|
|
155
|
-
<div className="flex flex-col">
|
|
156
|
-
<div className="flex flex-col gap-y-1">
|
|
157
|
-
<span className="text-[10px] md:text-[14px] cursor-default font-bold text-gray-500">
|
|
158
|
-
Background
|
|
159
|
-
</span>
|
|
160
|
-
<div className="w-full flex flex-wrap gap-1">
|
|
161
|
-
{Object.entries(themeColor.background).map(
|
|
162
|
-
([_, colorValue]) => (
|
|
163
|
-
<Button
|
|
164
|
-
key={colorValue}
|
|
165
|
-
onClick={() => onBgColorSelect(colorValue, false)}
|
|
166
|
-
|
|
167
|
-
type="button"
|
|
168
|
-
className={cn(
|
|
169
|
-
"w-[18px] p-0 h-[18px] rounded-[3px]",
|
|
170
|
-
colorValue === bgColor && "ring-2 ring-offset-2"
|
|
171
|
-
)}
|
|
172
|
-
style={{ background: colorValue }}
|
|
173
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
174
|
-
/>
|
|
175
|
-
)
|
|
176
|
-
)}
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
</div>
|
|
180
|
-
</PopoverContent>
|
|
181
|
-
</Popover>
|
|
182
|
-
);
|
|
183
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Pilcrow,
|
|
4
|
-
Heading1,
|
|
5
|
-
Heading2,
|
|
6
|
-
Heading3,
|
|
7
|
-
Heading4,
|
|
8
|
-
Heading5,
|
|
9
|
-
Heading6,
|
|
10
|
-
List,
|
|
11
|
-
ListTodo,
|
|
12
|
-
ListOrdered,
|
|
13
|
-
Braces,
|
|
14
|
-
Quote,
|
|
15
|
-
} from "lucide-react";
|
|
16
|
-
import {
|
|
17
|
-
formatBulletList,
|
|
18
|
-
formatCheckList,
|
|
19
|
-
formatCode,
|
|
20
|
-
formatHeading,
|
|
21
|
-
formatNumberedList,
|
|
22
|
-
formatParagraph,
|
|
23
|
-
formatQuote,
|
|
24
|
-
} from "@/components/editor/utils/editorFormatting";
|
|
25
|
-
import { LexicalEditor } from "lexical";
|
|
26
|
-
import { DropDown } from ".";
|
|
27
|
-
|
|
28
|
-
const blockTypeToBlockName = {
|
|
29
|
-
paragraph: "Paragraph",
|
|
30
|
-
h1: "Heading 1",
|
|
31
|
-
h2: "Heading 2",
|
|
32
|
-
h3: "Heading 3",
|
|
33
|
-
h4: "Heading 4",
|
|
34
|
-
h5: "Heading 5",
|
|
35
|
-
h6: "Heading 6",
|
|
36
|
-
bullet: "Bullet List",
|
|
37
|
-
check: "Checklist",
|
|
38
|
-
number: "Numbered List",
|
|
39
|
-
code: "Code Block",
|
|
40
|
-
quote: "Blockquote",
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default function BlockFormatDropDown({
|
|
44
|
-
editor,
|
|
45
|
-
blockType,
|
|
46
|
-
disabled = false,
|
|
47
|
-
style,
|
|
48
|
-
ShowChevronsUpDown=true,
|
|
49
|
-
side,
|
|
50
|
-
sideOffset
|
|
51
|
-
}: {
|
|
52
|
-
blockType: keyof typeof blockTypeToBlockName;
|
|
53
|
-
editor: LexicalEditor;
|
|
54
|
-
disabled?: boolean;
|
|
55
|
-
style?: React.CSSProperties;
|
|
56
|
-
ShowChevronsUpDown?:boolean
|
|
57
|
-
side?: "top" | "right" | "bottom" | "left" | undefined
|
|
58
|
-
sideOffset?:number
|
|
59
|
-
}) {
|
|
60
|
-
const Blocks = useMemo(
|
|
61
|
-
() => ({
|
|
62
|
-
paragraph: {
|
|
63
|
-
icon: <Pilcrow className="size-4" />,
|
|
64
|
-
label: "paragraph",
|
|
65
|
-
desc: "Just start writing plain text.",
|
|
66
|
-
func: () => formatParagraph(editor),
|
|
67
|
-
},
|
|
68
|
-
h1: {
|
|
69
|
-
icon: <Heading1 className="size-4" />,
|
|
70
|
-
desc: "Heading 1 for main titles.",
|
|
71
|
-
label: "Heading 1",
|
|
72
|
-
func: () => formatHeading(editor, blockType, "h1"),
|
|
73
|
-
},
|
|
74
|
-
h2: {
|
|
75
|
-
icon: <Heading2 className="size-4" />,
|
|
76
|
-
desc: "Heading 2 for major sections.",
|
|
77
|
-
label: "Heading 2",
|
|
78
|
-
func: () => formatHeading(editor, blockType, "h2"),
|
|
79
|
-
},
|
|
80
|
-
h3: {
|
|
81
|
-
icon: <Heading3 className="size-4" />,
|
|
82
|
-
desc: "Heading 3 for sub-sections.",
|
|
83
|
-
label: "Heading 3",
|
|
84
|
-
func: () => formatHeading(editor, blockType, "h3"),
|
|
85
|
-
},
|
|
86
|
-
h4: {
|
|
87
|
-
icon: <Heading4 className="size-4" />,
|
|
88
|
-
desc: "Heading 4 for minor sections.",
|
|
89
|
-
label: "Heading 4",
|
|
90
|
-
func: () => formatHeading(editor, blockType, "h4"),
|
|
91
|
-
},
|
|
92
|
-
h5: {
|
|
93
|
-
icon: <Heading5 className="size-4" />,
|
|
94
|
-
desc: "Heading 5 for small headings.",
|
|
95
|
-
label: "Heading 5",
|
|
96
|
-
func: () => formatHeading(editor, blockType, "h5"),
|
|
97
|
-
},
|
|
98
|
-
h6: {
|
|
99
|
-
icon: <Heading6 className="size-4" />,
|
|
100
|
-
desc: "Heading 6 for tiny headings.",
|
|
101
|
-
label: "Heading 6",
|
|
102
|
-
func: () => formatHeading(editor, blockType, "h6"),
|
|
103
|
-
},
|
|
104
|
-
bullet: {
|
|
105
|
-
icon: <List className="size-4" />,
|
|
106
|
-
desc: "Bullet list for unordered items.",
|
|
107
|
-
label: "Bullet List",
|
|
108
|
-
func: () => formatBulletList(editor, blockType),
|
|
109
|
-
},
|
|
110
|
-
check: {
|
|
111
|
-
icon: <ListTodo className="size-4" />,
|
|
112
|
-
desc: "Checklist for tasks or to-dos.",
|
|
113
|
-
label: "check box",
|
|
114
|
-
func: () => formatCheckList(editor, blockType),
|
|
115
|
-
},
|
|
116
|
-
number: {
|
|
117
|
-
icon: <ListOrdered className="size-4" />,
|
|
118
|
-
desc: "Numbered list for ordered items.",
|
|
119
|
-
label: "Numbered list",
|
|
120
|
-
func: () => formatNumberedList(editor, blockType),
|
|
121
|
-
},
|
|
122
|
-
code: {
|
|
123
|
-
icon: <Braces className="size-4" />,
|
|
124
|
-
desc: "Code block for snippets.",
|
|
125
|
-
label: "Code",
|
|
126
|
-
func: () => formatCode(editor, blockType),
|
|
127
|
-
},
|
|
128
|
-
quote: {
|
|
129
|
-
icon: <Quote className="size-4" />,
|
|
130
|
-
desc: "Blockquote for quotations.",
|
|
131
|
-
label: "Blockquote",
|
|
132
|
-
func: () => formatQuote(editor, blockType),
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
}),
|
|
136
|
-
[editor]
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const currentBlock = Blocks[blockType] || Blocks.paragraph;
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<DropDown
|
|
144
|
-
TriggerClassName={{...style,width:"100%"}}
|
|
145
|
-
disabled={disabled}
|
|
146
|
-
side={side}
|
|
147
|
-
sideOffset={sideOffset}
|
|
148
|
-
className="h-7 min-w-[29px] w-[29px] px-2 border-none cursor-pointer dark:bg-zinc-850 hover:bg-zinc-100 hover:text-zinc-900 dark:border-zinc-800"
|
|
149
|
-
TriggerLabel={
|
|
150
|
-
<>
|
|
151
|
-
{currentBlock.icon}
|
|
152
|
-
<span className="max-sm:hidden">{currentBlock.label}</span>
|
|
153
|
-
</>
|
|
154
|
-
}
|
|
155
|
-
ShowChevronsUpDown={ShowChevronsUpDown}
|
|
156
|
-
values={Object.values(Blocks)}
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
}
|