@collabchron/notiq 0.2.0 → 1.0.0
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-7TOZRD2R.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 +94 -10
- 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
package/src/app/page.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Editor from "@/components/editor"
|
|
2
|
-
|
|
3
|
-
export default function Home() {
|
|
4
|
-
return (
|
|
5
|
-
/* Enhanced page layout with better spacing and visual hierarchy */
|
|
6
|
-
<div className="min-h-screen bg-background">
|
|
7
|
-
<div className="container max-w-6xl mx-auto px-4 md:px-8">
|
|
8
|
-
<Editor isEditable={true} />
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useState } from "react"
|
|
4
|
-
import { useSharedHistoryContext } from "../providers/SharedHistoryContext"
|
|
5
|
-
import { useLexicalEditable } from "@lexical/react/useLexicalEditable"
|
|
6
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
|
|
7
|
-
import dynamic from "next/dynamic"
|
|
8
|
-
import { Skeleton } from "../ui/skeleton"
|
|
9
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"
|
|
10
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable"
|
|
11
|
-
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary"
|
|
12
|
-
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin"
|
|
13
|
-
import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin"
|
|
14
|
-
import ImagesPlugin from "./plugins/ImagesPlugin"
|
|
15
|
-
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"
|
|
16
|
-
import { TablePlugin } from "@lexical/react/LexicalTablePlugin"
|
|
17
|
-
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin"
|
|
18
|
-
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin"
|
|
19
|
-
import ShortcutsPlugin from "./plugins/ShortcutsPlugin"
|
|
20
|
-
import TabFocusPlugin from "./plugins/TabFocusPlugin"
|
|
21
|
-
import TableCellResizerPlugin from "./plugins/TableCellResizer"
|
|
22
|
-
import PollPlugin from "./plugins/PollPlugin"
|
|
23
|
-
import { LayoutPlugin } from "./plugins/LayoutPlugin"
|
|
24
|
-
import CollapsiblePlugin from "./plugins/CollapsiblePlugin"
|
|
25
|
-
import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin"
|
|
26
|
-
import LexicalAutoLinkPlugin from "./plugins/AutoLinkPlugin"
|
|
27
|
-
import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin"
|
|
28
|
-
import { ListPlugin } from "@lexical/react/LexicalListPlugin"
|
|
29
|
-
import { LinkWithMetaDataPlugin } from "./plugins/LinkWithMetaData"
|
|
30
|
-
import CodeHighlightPlugin from "./plugins/CodeHighlightPlugin"
|
|
31
|
-
import DragDropPaste from "./plugins/DragDropPastePlugin"
|
|
32
|
-
import DraggableBlockPlugin from "./plugins/DraggableBlockPlugin"
|
|
33
|
-
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin"
|
|
34
|
-
import { ClickableLinkPlugin } from "@lexical/react/LexicalClickableLinkPlugin"
|
|
35
|
-
import TwitterPlugin from "./plugins/TwitterPlugin"
|
|
36
|
-
import AutoEmbedPlugin from "./plugins/AutoEmbedPlugin"
|
|
37
|
-
import YouTubePlugin from "./plugins/YouTubePlugin"
|
|
38
|
-
import HintPlugin from "./nodes/Hint"
|
|
39
|
-
import { LexicalOnChangePlugin } from "./lexical-on-change"
|
|
40
|
-
import StepperPlugin from "./nodes/Stepper"
|
|
41
|
-
import InlineImagePlugin from "./plugins/InlineImagePlugin"
|
|
42
|
-
import FigmaPlugin from "./plugins/FigmaPlugin"
|
|
43
|
-
import EquationsPlugin from "./plugins/EquationsPlugin"
|
|
44
|
-
import SpeechToTextPlugin from "./plugins/SpeechToTextPlugin"
|
|
45
|
-
import { cn } from "@/lib/utils"
|
|
46
|
-
|
|
47
|
-
const SlashCommand = dynamic(() => import("@/components/editor/plugins/SlashCommand"), { ssr: false })
|
|
48
|
-
const ToolbarPlugin = dynamic(() => import("@/components/editor/plugins/ToolbarPlugin"), {
|
|
49
|
-
ssr: false,
|
|
50
|
-
loading: () => <Skeleton className=" h-9 w-full mt-8" />,
|
|
51
|
-
})
|
|
52
|
-
const ExcalidrawPlugin = dynamic(() => import("./plugins/ExcalidrawPlugin"), {
|
|
53
|
-
ssr: false
|
|
54
|
-
});
|
|
55
|
-
const FloatingLinkEditorPlugin = dynamic(() => import("@/components/editor/plugins/FloatingLinkEditorPlugin"), {
|
|
56
|
-
ssr: false,
|
|
57
|
-
})
|
|
58
|
-
const TableCellActionMenuPlugin = dynamic(() => import("@/components/editor/plugins/TableCellActionMenuPlugin"), {
|
|
59
|
-
ssr: false,
|
|
60
|
-
})
|
|
61
|
-
const TableHoverActionsPlugin = dynamic(() => import("@/components/editor/plugins/TableHoverActionsPlugin"), {
|
|
62
|
-
ssr: false,
|
|
63
|
-
})
|
|
64
|
-
const CodeActionMenuPlugin = dynamic(() => import("@/components/editor/plugins/CodeActionMenuPlugin"), { ssr: false })
|
|
65
|
-
const FloatingTextFormatToolbarPlugin = dynamic(
|
|
66
|
-
() => import("@/components/editor/plugins/FloatingTextFormatToolbarPlugin"),
|
|
67
|
-
{ ssr: false },
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const QUOTES = [
|
|
71
|
-
{ text: "The best way to predict the future is to invent it.", author: "Alan Kay" },
|
|
72
|
-
{ text: "Do not wait to strike till the iron is hot, but make it hot by striking.", author: "William Butler Yeats" },
|
|
73
|
-
{ text: "Creativity is intelligence having fun.", author: "Albert Einstein" },
|
|
74
|
-
{ text: "Start where you are. Use what you have. Do what you can.", author: "Arthur Ashe" },
|
|
75
|
-
{ text: "Your time is limited, so don't waste it living someone else's life.", author: "Steve Jobs" },
|
|
76
|
-
{ text: "The only way to do great work is to love what you do.", author: "Steve Jobs" },
|
|
77
|
-
{ text: "Success is not the key to happiness. Happiness is the key to success.", author: "Albert Schweitzer" },
|
|
78
|
-
{ text: "In the middle of difficulty lies opportunity.", author: "Albert Einstein" },
|
|
79
|
-
{ text: "What we think, we become.", author: "Buddha" },
|
|
80
|
-
{ text: "The journey of a thousand miles begins with one step.", author: "Lao Tzu" },
|
|
81
|
-
{ text: "Believe you can and you're halfway there.", author: "Theodore Roosevelt" },
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
function useRotatingQuote() {
|
|
85
|
-
const [quote, setQuote] = useState<{ text: string; author: string } | null>(null);
|
|
86
|
-
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
// Load initial quote
|
|
89
|
-
const loadQuote = () => {
|
|
90
|
-
const newQuote = QUOTES[Math.floor(Math.random() * QUOTES.length)];
|
|
91
|
-
setQuote(newQuote);
|
|
92
|
-
localStorage.setItem(
|
|
93
|
-
"editorQuote",
|
|
94
|
-
JSON.stringify({ ...newQuote, timestamp: Date.now() })
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
loadQuote(); // load one immediately
|
|
99
|
-
|
|
100
|
-
const interval = setInterval(loadQuote, 3 * 60 * 60 * 100 ); // every 3 hours
|
|
101
|
-
|
|
102
|
-
return () => clearInterval(interval);
|
|
103
|
-
}, []);
|
|
104
|
-
|
|
105
|
-
return quote;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
export default function Core() {
|
|
111
|
-
const { historyState } = useSharedHistoryContext()
|
|
112
|
-
const quote = useRotatingQuote();
|
|
113
|
-
const isEditable = useLexicalEditable()
|
|
114
|
-
const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)
|
|
115
|
-
const [editor] = useLexicalComposerContext()
|
|
116
|
-
const [activeEditor, setActiveEditor] = useState(editor)
|
|
117
|
-
const [isLinkEditMode, setIsLinkEditMode] = useState<boolean>(false)
|
|
118
|
-
|
|
119
|
-
const onRef = useCallback((_floatingAnchorElem: HTMLDivElement) => {
|
|
120
|
-
if (_floatingAnchorElem !== null) {
|
|
121
|
-
setFloatingAnchorElem(_floatingAnchorElem)
|
|
122
|
-
}
|
|
123
|
-
}, [])
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<>
|
|
127
|
-
{isEditable && (
|
|
128
|
-
<ToolbarPlugin
|
|
129
|
-
editor={editor}
|
|
130
|
-
activeEditor={activeEditor}
|
|
131
|
-
setActiveEditor={setActiveEditor}
|
|
132
|
-
setIsLinkEditMode={setIsLinkEditMode}
|
|
133
|
-
/>
|
|
134
|
-
)}
|
|
135
|
-
|
|
136
|
-
<div className="flex justify-center w-full md:px-6 md:bg-muted/30 min-h-screen md:min-h-96 pt-24">
|
|
137
|
-
<div
|
|
138
|
-
className={cn(
|
|
139
|
-
"relative w-full max-w-5xl rounded-2xl shadow-2xl prose prose-lg lg:prose-xl leading-relaxed",
|
|
140
|
-
)}
|
|
141
|
-
>
|
|
142
|
-
<RichTextPlugin
|
|
143
|
-
contentEditable={
|
|
144
|
-
<div ref={onRef} className="relative">
|
|
145
|
-
<ContentEditable
|
|
146
|
-
id="lexical-editor"
|
|
147
|
-
autoFocus
|
|
148
|
-
className={cn(
|
|
149
|
-
"editor-content relative z-20 min-h-[80vh] md:p-12 outline-none rounded-2xl",
|
|
150
|
-
"focus:outline-none focus:ring-0 text-foreground"
|
|
151
|
-
)}
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
}
|
|
155
|
-
placeholder={
|
|
156
|
-
<div className="absolute text-bold md:top-18 top-6 left-2 md:text-6xl md:left-12 italic text-gray-400 pointer-events-none select-none">
|
|
157
|
-
{quote ? `"${quote.text}" ~ ${quote.author}` : "Loading quote..."}
|
|
158
|
-
</div>
|
|
159
|
-
}
|
|
160
|
-
ErrorBoundary={LexicalErrorBoundary}
|
|
161
|
-
/>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<AutoFocusPlugin defaultSelection={"rootStart"} />
|
|
165
|
-
<ClearEditorPlugin />
|
|
166
|
-
<ShortcutsPlugin editor={activeEditor} setIsLinkEditMode={setIsLinkEditMode} />
|
|
167
|
-
<LexicalOnChangePlugin />
|
|
168
|
-
<LinkPlugin />
|
|
169
|
-
<HorizontalRulePlugin />
|
|
170
|
-
<TabFocusPlugin />
|
|
171
|
-
<PollPlugin />
|
|
172
|
-
<ExcalidrawPlugin />
|
|
173
|
-
<FigmaPlugin />
|
|
174
|
-
<EquationsPlugin />
|
|
175
|
-
<SpeechToTextPlugin />
|
|
176
|
-
<TableCellResizerPlugin />
|
|
177
|
-
<LayoutPlugin />
|
|
178
|
-
<CollapsiblePlugin />
|
|
179
|
-
<CodeHighlightPlugin />
|
|
180
|
-
<DragDropPaste />
|
|
181
|
-
<TabIndentationPlugin maxIndent={7} />
|
|
182
|
-
<LexicalAutoLinkPlugin />
|
|
183
|
-
<LinkWithMetaDataPlugin />
|
|
184
|
-
<ListPlugin />
|
|
185
|
-
<LinkPlugin />
|
|
186
|
-
<StepperPlugin />
|
|
187
|
-
<TwitterPlugin />
|
|
188
|
-
<CheckListPlugin />
|
|
189
|
-
<ImagesPlugin />
|
|
190
|
-
<InlineImagePlugin />
|
|
191
|
-
<AutoEmbedPlugin />
|
|
192
|
-
<HintPlugin />
|
|
193
|
-
<YouTubePlugin />
|
|
194
|
-
<HistoryPlugin externalHistoryState={historyState} />
|
|
195
|
-
<MarkdownShortcutPlugin />
|
|
196
|
-
<ClickableLinkPlugin disabled={isEditable} />
|
|
197
|
-
<TablePlugin hasCellMerge={true} hasCellBackgroundColor={true} hasHorizontalScroll={true} />
|
|
198
|
-
|
|
199
|
-
{floatingAnchorElem && isEditable && (
|
|
200
|
-
<>
|
|
201
|
-
<DraggableBlockPlugin anchorElem={floatingAnchorElem} />
|
|
202
|
-
<FloatingLinkEditorPlugin
|
|
203
|
-
anchorElem={floatingAnchorElem}
|
|
204
|
-
isLinkEditMode={isLinkEditMode}
|
|
205
|
-
setIsLinkEditMode={setIsLinkEditMode}
|
|
206
|
-
/>
|
|
207
|
-
<FloatingTextFormatToolbarPlugin setIsLinkEditMode={setIsLinkEditMode} anchorElem={floatingAnchorElem} />
|
|
208
|
-
<TableCellActionMenuPlugin anchorElem={floatingAnchorElem} cellMerge={true} />
|
|
209
|
-
<CodeActionMenuPlugin anchorElem={floatingAnchorElem} />
|
|
210
|
-
<TableHoverActionsPlugin anchorElem={floatingAnchorElem} />
|
|
211
|
-
</>
|
|
212
|
-
)}
|
|
213
|
-
|
|
214
|
-
{isEditable && <SlashCommand />}
|
|
215
|
-
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</>
|
|
219
|
-
)
|
|
220
|
-
}
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type AIAction =
|
|
3
|
-
| "MakeLong"
|
|
4
|
-
| "MakeShort"
|
|
5
|
-
| "FixSpellingGrammar"
|
|
6
|
-
| "ImproveWriting"
|
|
7
|
-
| "ChatWithSelectedString"
|
|
8
|
-
| "autoComplete"
|
|
9
|
-
| "GenerateAgain"
|
|
10
|
-
| "SimplifyLanguage"
|
|
11
|
-
| "WriteHint"
|
|
12
|
-
| "Steps"
|
|
13
|
-
| "askPageQuestion";
|
|
14
|
-
|
|
15
|
-
const GenerateAgainInstruction = `
|
|
16
|
-
Create a system that allows the AI to regenerate its response if the user is not satisfied with the initial answer.
|
|
17
|
-
# Steps
|
|
18
|
-
1. Upon receiving a user query, generate an initial response.
|
|
19
|
-
2. Provide the option for the user to indicate whether they are satisfied with the response.
|
|
20
|
-
3. If the user indicates dissatisfaction, immediately offer to regenerate a new response.
|
|
21
|
-
4. Regenerate the response using new phrasing or additional context to better address the user's query.
|
|
22
|
-
5. Repeat the option to indicate satisfaction for the regenerated response.
|
|
23
|
-
|
|
24
|
-
# Output Format
|
|
25
|
-
|
|
26
|
-
- Initial response: A complete and concise answer to the user's query.
|
|
27
|
-
- User satisfaction indicator: A simple prompt (e.g., "Are you satisfied with this response? [Yes/No]")
|
|
28
|
-
- Regenerated response: A new version of the response, aimed at rectifying any deficiencies in the initial answer.
|
|
29
|
-
|
|
30
|
-
# Notes
|
|
31
|
-
|
|
32
|
-
- The system should ensure that regenerated responses do not simply rephrase but enhance the content or depth based on assumed user dissatisfaction causes.
|
|
33
|
-
- Keep track of regenerated responses to avoid repeating the same or overly similar answers.
|
|
34
|
-
- Consider limitations to the number of regenerated responses to manage system performance and user experience.`;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const autoCompleteInstruction=` Generate a completion without combining it with the user's text. Limit the response to a concise length and do not include additional commentary or explanations.`
|
|
39
|
-
const improveMesgInstruction= `Provide constructive feedback to improve the writing of a user, focusing on clarity, grammar, style, and coherence.
|
|
40
|
-
Assess the user's writing thoughtfully before providing feedback, ensuring to highlight both strengths and areas for improvement. Offer specific, actionable suggestions to help the user enhance their writing skills.
|
|
41
|
-
|
|
42
|
-
# Steps
|
|
43
|
-
|
|
44
|
-
1. **Read and Analyze** the provided text to understand its context, purpose, and audience.
|
|
45
|
-
2. **Identify Strengths**: Note areas where the user excels in their writing.
|
|
46
|
-
3. **Highlight Issues**: Identify aspects that need improvement, such as grammatical errors, awkward phrasing, or unclear arguments.
|
|
47
|
-
4. **Provide Suggestions**: Offer clear, practical advice on how to address the identified issues.
|
|
48
|
-
5. **Conclude with Encouragement**: Motivate the user to apply the feedback and continue improving their writing.
|
|
49
|
-
|
|
50
|
-
# Output Format
|
|
51
|
-
|
|
52
|
-
Provide feedback in a structured paragraph format. Use bullet points or numbered lists for specific suggestions when needed.
|
|
53
|
-
|
|
54
|
-
# Examples
|
|
55
|
-
|
|
56
|
-
**User's Text:**
|
|
57
|
-
"I think it's important because to the happiness of people is sometimes underestimated but more important than money."
|
|
58
|
-
|
|
59
|
-
**Feedback:**
|
|
60
|
-
- Strengths: Your writing demonstrates a passionate perspective on the importance of happiness.
|
|
61
|
-
- Issues:
|
|
62
|
-
- The sentence is somewhat confusing due to misplaced phrases.
|
|
63
|
-
- There is a grammatical error with the use of "because."
|
|
64
|
-
- Suggestions:
|
|
65
|
-
1. Consider rephrasing for clarity: "I believe happiness is often underrated and is more important than money."
|
|
66
|
-
2. Remove unnecessary words that obstruct the message.
|
|
67
|
-
|
|
68
|
-
**User's Text:**
|
|
69
|
-
"The cat swiftly leaped over the wall, its movements were agile and graceful, capturing the attention of everyone nearby."
|
|
70
|
-
|
|
71
|
-
**Feedback:**
|
|
72
|
-
- Strengths: Vivid imagery is successfully used to engage the reader.
|
|
73
|
-
- Issues:
|
|
74
|
-
- The sentence could be split for better readability.
|
|
75
|
-
- Suggestions:
|
|
76
|
-
1. Break the sentence into two: "The cat swiftly leaped over the wall. Its movements were agile and graceful, capturing the attention of everyone nearby."
|
|
77
|
-
|
|
78
|
-
# Notes
|
|
79
|
-
|
|
80
|
-
- Tailor feedback according to the level of the user's proficiency.
|
|
81
|
-
- Be specific in your suggestions to aid clarity and understanding.
|
|
82
|
-
- Encourage sustained practice and application of advice for continuous improvement.`
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const FixSpellingGrammarInstruction=`Correct any spelling and grammar errors in a given text.
|
|
86
|
-
|
|
87
|
-
# Steps
|
|
88
|
-
|
|
89
|
-
1. Read the provided text carefully.
|
|
90
|
-
2. Identify any spelling mistakes and correct them.
|
|
91
|
-
3. Look for grammatical errors, such as incorrect verb tense, subject-verb agreement, punctuation errors, and incomplete sentences, and correct them.
|
|
92
|
-
4. Ensure the text flows logically and coherently without altering the original meaning.
|
|
93
|
-
5. Double-check the revised text for any remaining errors.
|
|
94
|
-
|
|
95
|
-
# Output Format
|
|
96
|
-
|
|
97
|
-
The corrected text should be provided in a clear and readable paragraph format, preserving the original structure and meaning as much as possible.
|
|
98
|
-
|
|
99
|
-
# Examples
|
|
100
|
-
|
|
101
|
-
**Input:** "i has go to the store yesterday for buy some apples"
|
|
102
|
-
|
|
103
|
-
**Output:** "I went to the store yesterday to buy some apples."
|
|
104
|
-
|
|
105
|
-
**Input:** "She dont like to play soccer, she prefers basketball."
|
|
106
|
-
|
|
107
|
-
**Output:** "She doesn't like to play soccer; she prefers basketball."`
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// stop
|
|
112
|
-
const MakeShortInstruction=`
|
|
113
|
-
Shorten the provided text while keeping its context intact.
|
|
114
|
-
|
|
115
|
-
# Steps
|
|
116
|
-
|
|
117
|
-
1. Read the provided text carefully.
|
|
118
|
-
2. Identify sections that can be condensed without losing key information.
|
|
119
|
-
3. Rephrase or remove redundant or non-essential parts of the text.
|
|
120
|
-
4. Ensure the revised text retains its original context and meaning.
|
|
121
|
-
|
|
122
|
-
# Output Format
|
|
123
|
-
|
|
124
|
-
The shortened text should be presented in a clear and concise paragraph format, preserving the original context as much as possible.
|
|
125
|
-
|
|
126
|
-
# Examples
|
|
127
|
-
|
|
128
|
-
**Input:** "I had to go to the store yesterday to buy some supplies because we were running low."
|
|
129
|
-
|
|
130
|
-
**Output:** "I went to the store yesterday for supplies."
|
|
131
|
-
|
|
132
|
-
**Input:** "Although she doesn't like playing soccer, she enjoys basketball more and plays it every weekend."
|
|
133
|
-
|
|
134
|
-
**Output:** "She prefers basketball over soccer, playing it weekly.""`
|
|
135
|
-
|
|
136
|
-
const MakeLongInstruction=` Expand the provided short text while keeping its context intact.
|
|
137
|
-
|
|
138
|
-
# Steps
|
|
139
|
-
|
|
140
|
-
1. Read the provided text carefully.
|
|
141
|
-
2. Identify areas where additional details or elaborations can be added.
|
|
142
|
-
3. Expand sections with relevant information while maintaining the original context and meaning.
|
|
143
|
-
4. Ensure the expanded text preserves its original message and tone.
|
|
144
|
-
|
|
145
|
-
# Output Format
|
|
146
|
-
|
|
147
|
-
The expanded text should be presented in a detailed paragraph format, enriching the original content while preserving its context as much as possible.
|
|
148
|
-
|
|
149
|
-
# Examples
|
|
150
|
-
|
|
151
|
-
**Input:** "I went to the store for supplies."
|
|
152
|
-
|
|
153
|
-
**Output:** "Yesterday, I went to the local store, which I hadn't visited in a while, to purchase a range of supplies. This included essential items we needed because we were running low, such as groceries, cleaning products, and some personal items."
|
|
154
|
-
|
|
155
|
-
**Input:** "She prefers basketball over soccer."
|
|
156
|
-
|
|
157
|
-
**Output:** "While she appreciates the dynamics of soccer, she finds basketball much more engaging and enjoyable. She actively participates in basketball games every weekend because it's her favorite sport, and she loves practicing different techniques and plays with her friends."`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const SimplifyLanguageInstruction=`
|
|
163
|
-
Simplify the language of the provided text, ensuring it remains clear, concise, and easy to understand.
|
|
164
|
-
|
|
165
|
-
# Steps
|
|
166
|
-
|
|
167
|
-
1. Read the given text carefully to understand its meaning.
|
|
168
|
-
2. Identify complex words or phrases that could be simplified.
|
|
169
|
-
3. Replace complex words or structures with simpler alternatives while retaining the original meaning.
|
|
170
|
-
4. Ensure the resulting text maintains coherence and readability.
|
|
171
|
-
|
|
172
|
-
# Output Format
|
|
173
|
-
|
|
174
|
-
Provide the simplified version of the text in one or more paragraphs, maintaining proper grammar and structure.
|
|
175
|
-
|
|
176
|
-
# Examples
|
|
177
|
-
|
|
178
|
-
**Input:**
|
|
179
|
-
"The utilization of advanced computational methodologies can facilitate the enhancement of operational efficiency in various industries."
|
|
180
|
-
|
|
181
|
-
**Output:**
|
|
182
|
-
"Using advanced computing methods can help make different industries more efficient."
|
|
183
|
-
|
|
184
|
-
# Notes
|
|
185
|
-
|
|
186
|
-
- Avoid oversimplifying technical terms that are necessary for understanding.
|
|
187
|
-
- Maintain the integrity and original intent of the text.
|
|
188
|
-
- Additional context or explanation should only be added if it aids in clarity.
|
|
189
|
-
`
|
|
190
|
-
const WriteHintInstruction=`
|
|
191
|
-
Generate a concise message based on the provided context and user input, categorized by type such as error, success, info, or warning. Ensure that the message does not exceed 50 words.
|
|
192
|
-
# Steps
|
|
193
|
-
|
|
194
|
-
1. **Understand Context**: Read the provided context and user input carefully to identify the nature of the message needed.
|
|
195
|
-
2. **Determine Message Type**: Classify the message type as one of the following - error, success, info, or warning.
|
|
196
|
-
3. **Compose Message**: Write a clear, concise message appropriate for the determined type, ensuring it aligns with the context provided.
|
|
197
|
-
4. **Word Count Check**: Confirm the message does not exceed 50 words.
|
|
198
|
-
|
|
199
|
-
# Output Format
|
|
200
|
-
|
|
201
|
-
Provide a message in plain text, not exceeding 50 words.
|
|
202
|
-
|
|
203
|
-
# Examples
|
|
204
|
-
|
|
205
|
-
**Example 1**
|
|
206
|
-
|
|
207
|
-
- Context: User input failed due to network timeout.
|
|
208
|
-
- Type: Error
|
|
209
|
-
- Message: "The operation could not be completed due to a network timeout. Please check your internet connection and try again."
|
|
210
|
-
|
|
211
|
-
**Example 2**
|
|
212
|
-
|
|
213
|
-
- Context: User successfully uploaded a file.
|
|
214
|
-
- Type: Success
|
|
215
|
-
- Message: "Your file has been uploaded successfully. You can now access it from your dashboard."
|
|
216
|
-
|
|
217
|
-
**Example 3**
|
|
218
|
-
|
|
219
|
-
- Context: Upcoming system maintenance scheduled.
|
|
220
|
-
- Type: Info
|
|
221
|
-
- Message: "Please note that the system will undergo maintenance on [Date] from [Start Time] to [End Time]. During this period, access may be limited."
|
|
222
|
-
|
|
223
|
-
**Example 4**
|
|
224
|
-
|
|
225
|
-
- Context: User attempting risky operation.
|
|
226
|
-
- Type: Warning
|
|
227
|
-
- Message: "Are you sure you want to proceed? This action could affect your system stability. Please proceed with caution."
|
|
228
|
-
|
|
229
|
-
# Notes
|
|
230
|
-
-make sure do not Reponse with anything except the message.
|
|
231
|
-
- Ensure the tone and content of the message accurately reflect the message type and context.
|
|
232
|
-
- Be mindful of the word limit while maintaining clarity and precision in the message`
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const StepsInstruction=`
|
|
236
|
-
Generate a structured response in the format of a JSON object, detailing the given topic as steps.
|
|
237
|
-
|
|
238
|
-
- Each step should contain three elements: "id", "title", and "content".
|
|
239
|
-
- "id" should be a unique identifier starting from 0 and increasing sequentially.
|
|
240
|
-
- "title" should summarize the step in a concise manner.
|
|
241
|
-
- "content" should provide an explanation or additional details about the step.
|
|
242
|
-
|
|
243
|
-
# Steps
|
|
244
|
-
|
|
245
|
-
1. Break the topic down into logical, sequential steps.
|
|
246
|
-
2. Begin each step with an incrementing "id" starting from 0.
|
|
247
|
-
3. Write a "title" for each step summarizing its objective.
|
|
248
|
-
4. Elaborate on the details of the step in the "content" field.
|
|
249
|
-
|
|
250
|
-
# Output Format
|
|
251
|
-
|
|
252
|
-
Your response should be a JSON array where each item follows this structure:
|
|
253
|
-
|
|
254
|
-
{
|
|
255
|
-
"id": [sequential integer starting from 0],
|
|
256
|
-
"title": "[step title]",
|
|
257
|
-
"content": "[step explanation]"
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
# Examples
|
|
261
|
-
|
|
262
|
-
**Input:** "Preparing a simple meal"
|
|
263
|
-
|
|
264
|
-
**Output:**
|
|
265
|
-
|
|
266
|
-
[
|
|
267
|
-
{
|
|
268
|
-
"id": 0,
|
|
269
|
-
"title": "gather ingredients",
|
|
270
|
-
"content": "List and assemble all the ingredients required for the recipe."
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
"id": 1,
|
|
274
|
-
"title": "prepare ingredients",
|
|
275
|
-
"content": "Wash, chop, and measure the ingredients as needed for the recipe."
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"id": 2,
|
|
279
|
-
"title": "begin cooking",
|
|
280
|
-
"content": "Follow the recipe steps to cook the meal, starting with heating the pan."
|
|
281
|
-
}
|
|
282
|
-
]
|
|
283
|
-
|
|
284
|
-
# Notes
|
|
285
|
-
|
|
286
|
-
- Be concise in writing titles, yet comprehensive in content explanations.
|
|
287
|
-
- Ensure the steps are logically ordered and cover the task comprehensively.
|
|
288
|
-
`
|
|
289
|
-
|
|
290
|
-
export {
|
|
291
|
-
GenerateAgainInstruction,
|
|
292
|
-
autoCompleteInstruction,
|
|
293
|
-
improveMesgInstruction,
|
|
294
|
-
FixSpellingGrammarInstruction,
|
|
295
|
-
MakeLongInstruction,
|
|
296
|
-
MakeShortInstruction,
|
|
297
|
-
SimplifyLanguageInstruction,
|
|
298
|
-
WriteHintInstruction,
|
|
299
|
-
StepsInstruction,
|
|
300
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
const MOBILE_BREAKPOINT = 768
|
|
4
|
-
|
|
5
|
-
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
-
|
|
8
|
-
React.useEffect(() => {
|
|
9
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
-
const onChange = () => {
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
-
}
|
|
13
|
-
mql.addEventListener("change", onChange)
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
-
return () => mql.removeEventListener("change", onChange)
|
|
16
|
-
}, [])
|
|
17
|
-
|
|
18
|
-
return !!isMobile
|
|
19
|
-
}
|
|
@@ -1,67 +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 {useCallback, useEffect, useRef} from 'react';
|
|
10
|
-
|
|
11
|
-
const getElement = (): HTMLElement => {
|
|
12
|
-
let element = document.getElementById('report-container');
|
|
13
|
-
|
|
14
|
-
if (element === null) {
|
|
15
|
-
element = document.createElement('div');
|
|
16
|
-
element.id = 'report-container';
|
|
17
|
-
element.style.position = 'fixed';
|
|
18
|
-
element.style.top = '50%';
|
|
19
|
-
element.style.left = '50%';
|
|
20
|
-
element.style.fontSize = '32px';
|
|
21
|
-
element.style.transform = 'translate(-50%, -50px)';
|
|
22
|
-
element.style.padding = '20px';
|
|
23
|
-
element.style.background = 'rgba(240, 240, 240, 0.4)';
|
|
24
|
-
element.style.borderRadius = '20px';
|
|
25
|
-
|
|
26
|
-
if (document.body) {
|
|
27
|
-
document.body.appendChild(element);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return element;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default function useReport(): (
|
|
35
|
-
arg0: string,
|
|
36
|
-
) => ReturnType<typeof setTimeout> {
|
|
37
|
-
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
38
|
-
const cleanup = useCallback(() => {
|
|
39
|
-
if (timer.current !== null) {
|
|
40
|
-
clearTimeout(timer.current);
|
|
41
|
-
timer.current = null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (document.body) {
|
|
45
|
-
document.body.removeChild(getElement());
|
|
46
|
-
}
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
return cleanup;
|
|
51
|
-
}, [cleanup]);
|
|
52
|
-
|
|
53
|
-
return useCallback(
|
|
54
|
-
(content) => {
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
|
-
console.log(content);
|
|
57
|
-
const element = getElement();
|
|
58
|
-
if (timer.current !== null) {
|
|
59
|
-
clearTimeout(timer.current);
|
|
60
|
-
}
|
|
61
|
-
element.innerHTML = content;
|
|
62
|
-
timer.current = setTimeout(cleanup, 1000);
|
|
63
|
-
return timer.current;
|
|
64
|
-
},
|
|
65
|
-
[cleanup],
|
|
66
|
-
);
|
|
67
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {useEffect, useState} from 'react';
|
|
2
|
-
|
|
3
|
-
export const useResizeObserver = (
|
|
4
|
-
target: Element | null,
|
|
5
|
-
callback?: (entry: DOMRectReadOnly) => void
|
|
6
|
-
) => {
|
|
7
|
-
const [size, setSize] = useState<DOMRectReadOnly>();
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!target) return;
|
|
11
|
-
|
|
12
|
-
const observer = new ResizeObserver(([entry]) => {
|
|
13
|
-
setSize(entry.contentRect);
|
|
14
|
-
callback?.(entry.contentRect);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
observer.observe(target);
|
|
18
|
-
return () => observer.disconnect();
|
|
19
|
-
}, [target, callback]);
|
|
20
|
-
|
|
21
|
-
return size;
|
|
22
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { SharedHistoryContext } from "../providers/SharedHistoryContext";
|
|
3
|
-
import { ToolbarContext } from "../providers/ToolbarContext";
|
|
4
|
-
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import theme from "./themes/editor-theme";
|
|
8
|
-
import Core from "./Core";
|
|
9
|
-
import nodes from "./nodes";
|
|
10
|
-
|
|
11
|
-
export default function Editor({
|
|
12
|
-
isEditable = false,
|
|
13
|
-
content,
|
|
14
|
-
}: {
|
|
15
|
-
isEditable: boolean;
|
|
16
|
-
content?: unknown;
|
|
17
|
-
}) {
|
|
18
|
-
const initialConfig = {
|
|
19
|
-
namespace: "Bloger editor",
|
|
20
|
-
theme,
|
|
21
|
-
// editorState:
|
|
22
|
-
// typeof content === "string" ? content : JSON.stringify(content),
|
|
23
|
-
nodes: [...nodes],
|
|
24
|
-
onError: (error: Error) => {
|
|
25
|
-
throw error;
|
|
26
|
-
},
|
|
27
|
-
editable: isEditable,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<LexicalComposer initialConfig={initialConfig}>
|
|
32
|
-
<SharedHistoryContext>
|
|
33
|
-
<ToolbarContext>
|
|
34
|
-
<Core/>
|
|
35
|
-
</ToolbarContext>
|
|
36
|
-
</SharedHistoryContext>
|
|
37
|
-
</LexicalComposer>
|
|
38
|
-
);
|
|
39
|
-
}
|