@collabchron/notiq 0.3.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 +66 -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,346 +0,0 @@
|
|
|
1
|
-
import { blockTypeToBlockName } from "@/components/providers/ToolbarContext";
|
|
2
|
-
import {
|
|
3
|
-
$getSelection,
|
|
4
|
-
COMMAND_PRIORITY_LOW,
|
|
5
|
-
FORMAT_TEXT_COMMAND,
|
|
6
|
-
getDOMSelection,
|
|
7
|
-
LexicalEditor,
|
|
8
|
-
SELECTION_CHANGE_COMMAND,
|
|
9
|
-
} from "lexical";
|
|
10
|
-
import { Dispatch, useCallback, useEffect, useRef } from "react";
|
|
11
|
-
import { TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
12
|
-
import { getDOMRangeRect } from "@/components/editor/utils/getDOMRangeRect";
|
|
13
|
-
import { setFloatingElemPosition } from "@/components/editor/utils/setFloatingElemPosition";
|
|
14
|
-
import { mergeRegister } from "@lexical/utils";
|
|
15
|
-
import { Separator } from "@/components/ui/separator";
|
|
16
|
-
import BlockFormatDropDown from "../drop-downs/block-format";
|
|
17
|
-
import { useIsMobile } from "@/components/editor/hooks/use-mobile";
|
|
18
|
-
import { Toggle } from "@/components/ui/toggle";
|
|
19
|
-
import { SHORTCUTS } from "@/components/editor/plugins/ShortcutsPlugin/shortcuts";
|
|
20
|
-
import { Bold, Code, Italic, Link, UnderlineIcon } from "lucide-react";
|
|
21
|
-
import Color from "../drop-downs/color";
|
|
22
|
-
import { sanitizeUrl } from "@/components/editor/utils/url";
|
|
23
|
-
import TextFormat from "../drop-downs/text-format";
|
|
24
|
-
import Font from "../drop-downs/font";
|
|
25
|
-
import FontSize from "../drop-downs/font-size";
|
|
26
|
-
import AiButton from "../ai/ai-button";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export default function TextFormatFloatingToolbar({
|
|
34
|
-
editor,
|
|
35
|
-
anchorElem,
|
|
36
|
-
isLink,
|
|
37
|
-
isBold,
|
|
38
|
-
isItalic,
|
|
39
|
-
isUnderline,
|
|
40
|
-
isUppercase,
|
|
41
|
-
isLowercase,
|
|
42
|
-
isCapitalize,
|
|
43
|
-
isCode,
|
|
44
|
-
fontColor,
|
|
45
|
-
isStrikethrough,
|
|
46
|
-
isSubscript,
|
|
47
|
-
isSuperscript,
|
|
48
|
-
bgColor,
|
|
49
|
-
setIsLinkEditMode,
|
|
50
|
-
blockType,
|
|
51
|
-
fontFamily,
|
|
52
|
-
rootType,
|
|
53
|
-
textAlign,
|
|
54
|
-
fontSize,
|
|
55
|
-
}: {
|
|
56
|
-
editor: LexicalEditor;
|
|
57
|
-
anchorElem: HTMLElement;
|
|
58
|
-
isBold: boolean;
|
|
59
|
-
isCode: boolean;
|
|
60
|
-
bgColor: string;
|
|
61
|
-
fontColor: string;
|
|
62
|
-
isItalic: boolean;
|
|
63
|
-
isLink: boolean;
|
|
64
|
-
fontFamily: string;
|
|
65
|
-
isUppercase: boolean;
|
|
66
|
-
isLowercase: boolean;
|
|
67
|
-
fontSize: string;
|
|
68
|
-
isCapitalize: boolean;
|
|
69
|
-
isStrikethrough: boolean;
|
|
70
|
-
isSubscript: boolean;
|
|
71
|
-
isSuperscript: boolean;
|
|
72
|
-
isUnderline: boolean;
|
|
73
|
-
setIsLinkEditMode: Dispatch<boolean>;
|
|
74
|
-
blockType: keyof typeof blockTypeToBlockName;
|
|
75
|
-
rootType: "root" | "table";
|
|
76
|
-
textAlign: "left" | "center" | "right" | "justify" | null;
|
|
77
|
-
}): React.JSX.Element {
|
|
78
|
-
const popupCharStylesEditorRef = useRef<HTMLDivElement | null>(null);
|
|
79
|
-
const isSmall = useIsMobile();
|
|
80
|
-
|
|
81
|
-
const insertLink = useCallback(() => {
|
|
82
|
-
if (!isLink) {
|
|
83
|
-
setIsLinkEditMode(true);
|
|
84
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
85
|
-
} else {
|
|
86
|
-
setIsLinkEditMode(false);
|
|
87
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
88
|
-
}
|
|
89
|
-
}, [editor, setIsLinkEditMode, isLink]);
|
|
90
|
-
function mouseMoveListener(e: MouseEvent) {
|
|
91
|
-
if (
|
|
92
|
-
popupCharStylesEditorRef?.current &&
|
|
93
|
-
(e.buttons === 1 || e.buttons === 3)
|
|
94
|
-
) {
|
|
95
|
-
if (popupCharStylesEditorRef.current.style.pointerEvents !== "none") {
|
|
96
|
-
const x = e.clientX;
|
|
97
|
-
const y = e.clientY;
|
|
98
|
-
const elementUnderMouse = document.elementFromPoint(x, y);
|
|
99
|
-
|
|
100
|
-
if (!popupCharStylesEditorRef.current.contains(elementUnderMouse)) {
|
|
101
|
-
// Mouse is not over the target element => not a normal click, but probably a drag
|
|
102
|
-
popupCharStylesEditorRef.current.style.pointerEvents = "none";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function mouseUpListener(e: MouseEvent) {
|
|
108
|
-
if (popupCharStylesEditorRef?.current) {
|
|
109
|
-
if (popupCharStylesEditorRef.current.style.pointerEvents !== "auto") {
|
|
110
|
-
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
if (popupCharStylesEditorRef?.current) {
|
|
117
|
-
document.addEventListener("mousemove", mouseMoveListener);
|
|
118
|
-
document.addEventListener("mouseup", mouseUpListener);
|
|
119
|
-
|
|
120
|
-
return () => {
|
|
121
|
-
document.removeEventListener("mousemove", mouseMoveListener);
|
|
122
|
-
document.removeEventListener("mouseup", mouseUpListener);
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}, [popupCharStylesEditorRef]);
|
|
126
|
-
|
|
127
|
-
const $updateTextFormatFloatingToolbar = useCallback(() => {
|
|
128
|
-
const selection = $getSelection();
|
|
129
|
-
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
130
|
-
const nativeSelection = getDOMSelection(editor._window);
|
|
131
|
-
|
|
132
|
-
if (!popupCharStylesEditorElem) return;
|
|
133
|
-
|
|
134
|
-
const rootElement = editor.getRootElement();
|
|
135
|
-
if (
|
|
136
|
-
selection &&
|
|
137
|
-
nativeSelection &&
|
|
138
|
-
!nativeSelection.isCollapsed &&
|
|
139
|
-
rootElement &&
|
|
140
|
-
rootElement.contains(nativeSelection.anchorNode)
|
|
141
|
-
) {
|
|
142
|
-
const rangeRect = getDOMRangeRect(nativeSelection, rootElement);
|
|
143
|
-
|
|
144
|
-
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
145
|
-
}
|
|
146
|
-
}, [editor, anchorElem]);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
useEffect(() => {
|
|
152
|
-
const scrollerElem = anchorElem.parentElement;
|
|
153
|
-
|
|
154
|
-
const update = () => {
|
|
155
|
-
editor.getEditorState().read(() => {
|
|
156
|
-
$updateTextFormatFloatingToolbar();
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
window.addEventListener("resize", update);
|
|
161
|
-
if (scrollerElem) {
|
|
162
|
-
scrollerElem.addEventListener("scroll", update);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return () => {
|
|
166
|
-
window.removeEventListener("resize", update);
|
|
167
|
-
if (scrollerElem) {
|
|
168
|
-
scrollerElem.removeEventListener("scroll", update);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}, [editor, $updateTextFormatFloatingToolbar, anchorElem]);
|
|
172
|
-
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
editor.getEditorState().read(() => {
|
|
175
|
-
$updateTextFormatFloatingToolbar();
|
|
176
|
-
});
|
|
177
|
-
return mergeRegister(
|
|
178
|
-
editor.registerUpdateListener(({ editorState }) => {
|
|
179
|
-
editorState.read(() => {
|
|
180
|
-
$updateTextFormatFloatingToolbar();
|
|
181
|
-
});
|
|
182
|
-
}),
|
|
183
|
-
|
|
184
|
-
editor.registerCommand(
|
|
185
|
-
SELECTION_CHANGE_COMMAND,
|
|
186
|
-
() => {
|
|
187
|
-
$updateTextFormatFloatingToolbar();
|
|
188
|
-
return false;
|
|
189
|
-
},
|
|
190
|
-
COMMAND_PRIORITY_LOW
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
}, [editor, $updateTextFormatFloatingToolbar]);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return (
|
|
197
|
-
<div
|
|
198
|
-
id="toolbar"
|
|
199
|
-
ref={popupCharStylesEditorRef}
|
|
200
|
-
className={`
|
|
201
|
-
h-[30px] p-1 px-2 max-sm:p-2 max-sm:h-[295px] max-sm:w-[32px] max-sm:overflow-y-auto
|
|
202
|
-
border dark:border-zinc-800 dark:bg-zinc-900 text-zinc-950 dark:text-zinc-50 border-zinc-200 bg-white/90
|
|
203
|
-
inline-flex flex-row max-sm:flex-col items-center shadow-md absolute top-0 left-0 text-sm rounded-[6px]
|
|
204
|
-
`}
|
|
205
|
-
>
|
|
206
|
-
<AiButton editor={editor}/>
|
|
207
|
-
<Separator
|
|
208
|
-
orientation="vertical"
|
|
209
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
210
|
-
/>
|
|
211
|
-
<BlockFormatDropDown
|
|
212
|
-
editor={editor}
|
|
213
|
-
blockType={blockType}
|
|
214
|
-
style={{ height: "25px" }}
|
|
215
|
-
ShowChevronsUpDown={false}
|
|
216
|
-
side={isSmall ? "right" : "bottom"}
|
|
217
|
-
sideOffset={isSmall ? 10 : 5}
|
|
218
|
-
/>
|
|
219
|
-
<Separator
|
|
220
|
-
orientation="vertical"
|
|
221
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
222
|
-
/>
|
|
223
|
-
<FontSize
|
|
224
|
-
selectionFontSize={fontSize.slice(0, -2)}
|
|
225
|
-
editor={editor}
|
|
226
|
-
disabled={false}
|
|
227
|
-
className="h-[25px]"
|
|
228
|
-
classNameContent="max-sm:flex-col"
|
|
229
|
-
/>
|
|
230
|
-
<Separator
|
|
231
|
-
orientation="vertical"
|
|
232
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
233
|
-
/>
|
|
234
|
-
<Font
|
|
235
|
-
disabled={false}
|
|
236
|
-
style={{ fontFamily: fontFamily, height: "25px", padding: "0px 13px" }}
|
|
237
|
-
value={fontFamily}
|
|
238
|
-
editor={editor}
|
|
239
|
-
ShowChevronsUpDown={false}
|
|
240
|
-
side={isSmall ? "right" : "bottom"}
|
|
241
|
-
sideOffset={isSmall ? 10 : 5}
|
|
242
|
-
/>
|
|
243
|
-
<Separator
|
|
244
|
-
orientation="vertical"
|
|
245
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
246
|
-
/>
|
|
247
|
-
<div className="flex flex-row max-sm:flex-col gap-1 items-center justify-center">
|
|
248
|
-
<Toggle
|
|
249
|
-
variant={"outline"}
|
|
250
|
-
size={"floting"}
|
|
251
|
-
pressed={isBold}
|
|
252
|
-
onPressedChange={() => {
|
|
253
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
254
|
-
}}
|
|
255
|
-
tip={`Bold ${SHORTCUTS.BOLD}`}
|
|
256
|
-
aria-label={`Format text as bold. Shortcut: ${SHORTCUTS.BOLD}`}
|
|
257
|
-
>
|
|
258
|
-
<Bold />
|
|
259
|
-
</Toggle>
|
|
260
|
-
<Toggle
|
|
261
|
-
variant={"outline"}
|
|
262
|
-
size={"floting"}
|
|
263
|
-
pressed={isItalic}
|
|
264
|
-
onPressedChange={() => {
|
|
265
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
266
|
-
}}
|
|
267
|
-
tip={`Italic (${SHORTCUTS.ITALIC})`}
|
|
268
|
-
type="button"
|
|
269
|
-
aria-label={`Format text as italics. Shortcut: ${SHORTCUTS.ITALIC}`}
|
|
270
|
-
>
|
|
271
|
-
<Italic />
|
|
272
|
-
</Toggle>
|
|
273
|
-
<Toggle
|
|
274
|
-
variant={"outline"}
|
|
275
|
-
size={"floting"}
|
|
276
|
-
pressed={isUnderline}
|
|
277
|
-
onPressedChange={() => {
|
|
278
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
279
|
-
}}
|
|
280
|
-
tip={`Underline (${SHORTCUTS.UNDERLINE})`}
|
|
281
|
-
type="button"
|
|
282
|
-
aria-label={`Format text to underlined. Shortcut: ${SHORTCUTS.UNDERLINE}`}
|
|
283
|
-
>
|
|
284
|
-
<UnderlineIcon />
|
|
285
|
-
</Toggle>
|
|
286
|
-
<Toggle
|
|
287
|
-
variant={"outline"}
|
|
288
|
-
size={"floting"}
|
|
289
|
-
pressed={isCode}
|
|
290
|
-
onPressedChange={() => {
|
|
291
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
292
|
-
}}
|
|
293
|
-
tip={`Insert code block (${SHORTCUTS.INSERT_CODE_BLOCK})`}
|
|
294
|
-
type="button"
|
|
295
|
-
aria-label="Insert code block"
|
|
296
|
-
>
|
|
297
|
-
<Code />
|
|
298
|
-
</Toggle>
|
|
299
|
-
<Toggle
|
|
300
|
-
variant={"outline"}
|
|
301
|
-
size={"floting"}
|
|
302
|
-
onPressedChange={insertLink}
|
|
303
|
-
pressed={isLink}
|
|
304
|
-
aria-label="Insert link"
|
|
305
|
-
tip={`Insert link (${SHORTCUTS.INSERT_LINK})`}
|
|
306
|
-
type="button"
|
|
307
|
-
>
|
|
308
|
-
<Link />
|
|
309
|
-
</Toggle>
|
|
310
|
-
</div>
|
|
311
|
-
<Separator
|
|
312
|
-
orientation="vertical"
|
|
313
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
314
|
-
/>
|
|
315
|
-
<Color
|
|
316
|
-
disabled={false}
|
|
317
|
-
side={isSmall ? "right" : "bottom"}
|
|
318
|
-
sideOffset={isSmall ? 10 : 5}
|
|
319
|
-
style={{ height: "25px" }}
|
|
320
|
-
color={fontColor}
|
|
321
|
-
bgColor={bgColor}
|
|
322
|
-
editor={editor}
|
|
323
|
-
/>
|
|
324
|
-
<Separator
|
|
325
|
-
orientation="vertical"
|
|
326
|
-
className="max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
327
|
-
/>
|
|
328
|
-
<TextFormat
|
|
329
|
-
disabled={false}
|
|
330
|
-
editor={editor}
|
|
331
|
-
ShowChevronsUpDown={false}
|
|
332
|
-
side={isSmall ? "right" : "bottom"}
|
|
333
|
-
sideOffset={isSmall ? 10 : 5}
|
|
334
|
-
style={{ height: "2px" }}
|
|
335
|
-
toolbarState={{
|
|
336
|
-
isLowercase,
|
|
337
|
-
isUppercase,
|
|
338
|
-
isCapitalize,
|
|
339
|
-
isStrikethrough,
|
|
340
|
-
isSubscript,
|
|
341
|
-
isSuperscript
|
|
342
|
-
}}
|
|
343
|
-
/>
|
|
344
|
-
</div>
|
|
345
|
-
);
|
|
346
|
-
}
|
package/src/lib/edgestore.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { EdgeStoreRouter } from '@/app/api/edgestore/[...edgestore]/route';
|
|
4
|
-
import { createEdgeStoreProvider } from '@edgestore/react';
|
|
5
|
-
|
|
6
|
-
const { EdgeStoreProvider, useEdgeStore } =
|
|
7
|
-
createEdgeStoreProvider<EdgeStoreRouter>();
|
|
8
|
-
|
|
9
|
-
export { EdgeStoreProvider, useEdgeStore };
|
|
File without changes
|
package/src/lib/utils.ts
DELETED
|
@@ -1,77 +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 {SerializedDocument} from '@lexical/file';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
async function* generateReader<T = any>(
|
|
13
|
-
reader: ReadableStreamDefaultReader<T>,
|
|
14
|
-
) {
|
|
15
|
-
let done = false;
|
|
16
|
-
while (!done) {
|
|
17
|
-
const res = await reader.read();
|
|
18
|
-
const {value} = res;
|
|
19
|
-
if (value !== undefined) {
|
|
20
|
-
yield value;
|
|
21
|
-
}
|
|
22
|
-
done = res.done;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function readBytestoString(
|
|
27
|
-
reader: ReadableStreamDefaultReader,
|
|
28
|
-
): Promise<string> {
|
|
29
|
-
const output = [];
|
|
30
|
-
const chunkSize = 0x8000;
|
|
31
|
-
for await (const value of generateReader(reader)) {
|
|
32
|
-
for (let i = 0; i < value.length; i += chunkSize) {
|
|
33
|
-
output.push(String.fromCharCode(...value.subarray(i, i + chunkSize)));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return output.join('');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function docToHash(doc: SerializedDocument): Promise<string> {
|
|
40
|
-
const cs = new CompressionStream('gzip');
|
|
41
|
-
const writer = cs.writable.getWriter();
|
|
42
|
-
const [, output] = await Promise.all([
|
|
43
|
-
writer
|
|
44
|
-
.write(new TextEncoder().encode(JSON.stringify(doc)))
|
|
45
|
-
.then(() => writer.close()),
|
|
46
|
-
readBytestoString(cs.readable.getReader()),
|
|
47
|
-
]);
|
|
48
|
-
return `#doc=${btoa(output)
|
|
49
|
-
.replace(/\//g, '_')
|
|
50
|
-
.replace(/\+/g, '-')
|
|
51
|
-
.replace(/=+$/, '')}`;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export async function docFromHash(
|
|
55
|
-
hash: string,
|
|
56
|
-
): Promise<SerializedDocument | null> {
|
|
57
|
-
const m = /^#doc=(.*)$/.exec(hash);
|
|
58
|
-
if (!m) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
const ds = new DecompressionStream('gzip');
|
|
62
|
-
const writer = ds.writable.getWriter();
|
|
63
|
-
const b64 = atob(m[1].replace(/_/g, '/').replace(/-/g, '+'));
|
|
64
|
-
const array = new Uint8Array(b64.length);
|
|
65
|
-
for (let i = 0; i < b64.length; i++) {
|
|
66
|
-
array[i] = b64.charCodeAt(i);
|
|
67
|
-
}
|
|
68
|
-
const closed = writer.write(array).then(() => writer.close());
|
|
69
|
-
const output = [];
|
|
70
|
-
for await (const chunk of generateReader(
|
|
71
|
-
ds.readable.pipeThrough(new TextDecoderStream()).getReader(),
|
|
72
|
-
)) {
|
|
73
|
-
output.push(chunk);
|
|
74
|
-
}
|
|
75
|
-
await closed;
|
|
76
|
-
return JSON.parse(output.join(''));
|
|
77
|
-
}
|